Hi Guys!
I work with two cameras. The first one uses the top 95% of the display and the second camera the 5% at the bottom for displaying menus and so.
My object has been embedded in the code and is displayed in the top part of the display (called topView). At the bottom part of the display (called bottomView) I created a simple CubeGeometry for testing purposes. Everything works perfect, e.g. when clicking the cube the cubes alpha value changes to make it transparent.
But now my problem:
When importing a second AWD it will always be displayed in my topView next to the first AWD file although I add it with the same syntax I added the cube:
bottomView.scene.addChild(slider);
Then I thought it could be the sliders position - so I changed it. What happened? Both imported objects moved to the bottomView.
I coded my problem in this way:
[Embed(source=..., mymeType=...] --> my first AWD
private var importObject : Class;
[Embed(source=..., mymeType=...] --> second AWD
private var regler : Class;
private var topView:View3D;
private var bottomView:View3D;
private var schieber:Mesh;
private var object:Mesh;
.....
private function setupMultiView():void
{
...
var camera1:Camera3D = new Camera3D(lens);
...
var camera2:Camera3D = new Camera3D();
...
topView = new View3D(scene,camera1);
topView.height = stage.stageHeight*.95;
addChild(topView);
bottomView = new View3D(scene,camera2);
bottomView.height=stage.stageHeight*.05;
...
}
private function objectLoad() : void
{
Parsers.enableAllBundled();
AssetLibrary.addEventListener(AssetEvent.ASSET_COMPLETE, onAssetComplete);
AssetLibrary.loadData(new importObject() ); --> first AWD
}
private function objectLoad2():void
{
Parsers.enableAllBundled();
AssetLibrary.addEventListener(AssetEvent.ASSET_COMPLETE, onAssetComplete2);
AssetLibrary.loadData(new regler() ); --> second AWD
}
private function onAssetComplete(ev:AssetEvent) : void
{
removeEventListener(AssetEvent.ASSET_COMPLETE, onAssetComplete);
object = ev.asset as Mesh;
object.scale(1);
topView.scene.addChild(object); -->first AWD in topView
}
private function onAssetComplete2(ev2:AssetEvent) : void
{
removeEventListener(AssetEvent.ASSET_COMPLETE, onAssetComplete2);
schieber = ev2.asset as Mesh;
schieber.scale(0.1);
bottomView.scene.addChild(schieber);-->second AWD in topView
}
If I call objectLoad() the AWD will be shown in topView. If I call objectLoad2() the AWD will also be shown in topView.
But when I change the function onAssetComplete2 and change the position of the second imported AWD the position of the first loaded AWD changes too.
Does anyone know where I do the mistake?