Full View Hi; I have the following code. When it runs through BigContainer the second time, for some reason my containers disappear and nothing shows on the screen. This happens even if I take out my removeChild statements, and that's what's got me puzzled. Ideas?
var start_flag:Boolean = true; var start_flag2:Boolean = true; function BigContainer() { if(start_flag == false) { start_flag2 = false; } if(start_flag == true) { LoadImages(); start_flag = false; } else { if(i == 4) { i = 1; } else if(i == 3) { j = 1; } var timeline:TimelineLite = new TimelineLite({onComplete:LoadImages()}); timeline.append(new TweenLite(container_left, 3, {alpha: 1})); } } function LoadImages() { LoadLeft(); } function LoadLeft():void { if(start_flag == true) { container_left = new Sprite(); } else { big_container.removeChild(container_left); container_left = container_left2; } big_container.addChild(container_left) var path:String = "images/left" + i + ".png"; var req:URLRequest = new URLRequest(path); var loader:Loader = new Loader(); loader.load(req); loader.addEventListener(IOErrorEvent.IO_ERROR, function(e:IOErrorEvent):void{ trace(e) }); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, LoadLeftLoaded); } function LoadLeftLoaded(evt:Event):void { var loaderInfo:LoaderInfo = evt.target as LoaderInfo; var displayObject:DisplayObject = loaderInfo.content; displayObject.width = 319; displayObject.height = 502; big_container.removeChild(container_left2); container_left.addChild(displayObject); if(start_flag2 == true) { container_left.x = 1000; container_left.y = 20; } else { container_left.x = 30; container_left.y = 20; } var timeline:TimelineLite = new TimelineLite({onComplete:SpinLeft}); timeline.append(new TweenLite(container_left, 1, {x:30, y:20})); } function SpinLeft() { big_container.addChild(container_left2) var path:String = "images/left" + j + ".png"; var req:URLRequest = new URLRequest(path); var loader:Loader = new Loader(); loader.load(req); loader.addEventListener(IOErrorEvent.IO_ERROR, function(e:IOErrorEvent):void{ trace(e) }); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, SpinLeftLoaded); } function SpinLeftLoaded(evt:Event):void { var loaderInfo:LoaderInfo = evt.target as LoaderInfo; var displayObject:DisplayObject = loaderInfo.content; displayObject.width = 319; displayObject.height = 502; container_left2.addChild(displayObject); container_left2.x = 30; container_left2.y = -482; var rand:Number = new Number(randomNumber(rand_low, rand_high)); var timeline:TimelineLite = new TimelineLite({onComplete: CompleteLeft}); timeline.append(new TweenLite(container_left, rand/100, {alpha: 1})); timeline.append(new TweenLite(container_left, 1, {x:30, y:522})); var timeline2:TimelineLite = new TimelineLite(); timeline2.append(new TweenLite(container_left2, rand/100, {alpha: 1})); timeline2.append(new TweenLite(container_left2, 1, {x:30, y:20})); } function CompleteLeft() { left_done = true; AllDone(); } function AllDone() { if(right_done == true && mid_done == true && left_done == true) { right_done = false; mid_done = false; left_done = false; i += 1; j += 1; BigContainer() } } TIA, John _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders