RE: [Flashcoders] Flashing Flash
John, I built a simplified version that works just fine (see below). HTH // Button component next_btn.addEventListener(MouseEvent.CLICK, doNext); var big_container:Sprite = new Sprite(); big_container.x = big_container.y = 100; addChild(big_container); var container_left:Sprite = new Sprite(); big_container.addChild(container_left); var imageArr:Array = [images/01.jpg, images/02.jpg, images/03.jpg, images/04.jpg, images/05.jpg, images/06.jpg, images/07.jpg, images/08.jpg, images/09.jpg, images/10.jpg, images/11.jpg, images/12.jpg, images/13.jpg]; var index:uint = 0; function doNext(e:MouseEvent = null):void{ trace(\ndoNext():: index =,index); var path:String = imageArr[index]; var req:URLRequest = new URLRequest(path); var loader:Loader = new Loader(); loader.addEventListener(IOErrorEvent.IO_ERROR, function(e:IOErrorEvent):void{ trace(e) }); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, nextLoaded); loader.load(req); // manage the index if(index imageArr.length - 1){ // increment index by one index++; }else{ // set index back to zero index = 0; } } function nextLoaded(evt:Event):void{ trace(\nnextLoaded()); var loaderInfo:LoaderInfo = evt.target as LoaderInfo; var displayObject:DisplayObject = loaderInfo.content; container_left.addChildAt(displayObject, 0); trace( - container_left.numChildren =,container_left.numChildren); if(container_left.numChildren 1){ container_left.removeChildAt(1); } trace( - container_left.numChildren =,container_left.numChildren); } // load the first image doNext(); Regards, Keith Reinfeld Home Page: http://keithreinfeld.home.comcast.net -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders- boun...@chattyfig.figleaf.com] On Behalf Of John Singleton Sent: Thursday, May 20, 2010 7:03 AM To: Flash Coders List Subject: Re: [Flashcoders] Flashing Flash - Original Message From: Keith Reinfeld keithreinf...@comcast.net To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Wed, May 19, 2010 1:53:06 PM Subject: RE: [Flashcoders] Flashing Flash Don't remove container_middle at all. Instead add/remove its children: container_middle.addChildAt(newImage, 0); container_middle.removeChildAt(1); Well I thought that was a pretty slick idea, and cleaner code all the way around. However, no cigar. I had to place the new code further down. Here's what I ended up with: function LoadLeft():void { if(start_flag == true) { container_left = new Sprite(); big_container.addChild(container_left) } else { big_container.removeChild(container_left2); } 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; container_left.addChildAt(displayObject, 0); if(start_flag == false) { container_left.addChildAt(displayObject, 0); try { container_left.removeChildAt(1); } catch(error: Error) { trace('Error in removwChildAt(1)'); } } else { 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})); } Nonetheless, it still blinks at me as before :( TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Flashing Flash
- Original Message From: Keith Reinfeld keithreinf...@comcast.net To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Wed, May 19, 2010 1:53:06 PM Subject: RE: [Flashcoders] Flashing Flash Don't remove container_middle at all. Instead add/remove its children: container_middle.addChildAt(newImage, 0); container_middle.removeChildAt(1); Well I thought that was a pretty slick idea, and cleaner code all the way around. However, no cigar. I had to place the new code further down. Here's what I ended up with: function LoadLeft():void { if(start_flag == true) { container_left = new Sprite(); big_container.addChild(container_left) } else { big_container.removeChild(container_left2); } 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; container_left.addChildAt(displayObject, 0); if(start_flag == false) { container_left.addChildAt(displayObject, 0); try { container_left.removeChildAt(1); } catch(error: Error) { trace('Error in removwChildAt(1)'); } } else { 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})); } Nonetheless, it still blinks at me as before :( TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Flashing Flash
Hi; I have this code: big_container.removeChild(container_middle); big_container.removeChild(container_middle2); container_middle = new Sprite(); big_container.addChild(container_middle) It loops and is called in each iteration except the first. The problem is, when it runs, the image in the container momentarily disappears then reappears, which doesn't look good. How work around this? TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Flashing Flash
W/O seeing what is exactly going on... maybe set the alpha to 0 till it's been added? On Wed, May 19, 2010 at 9:19 AM, John Singleton johnsingleton...@yahoo.comwrote: Hi; I have this code: big_container.removeChild(container_middle); big_container.removeChild(container_middle2); container_middle = new Sprite(); big_container.addChild(container_middle) It loops and is called in each iteration except the first. The problem is, when it runs, the image in the container momentarily disappears then reappears, which doesn't look good. How work around this? TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Flashing Flash
Looping in frame code, looping in ENTER_FRAME event or looping via a timer? On Wed, May 19, 2010 at 1:16 PM, Bob Wohl bob.w...@gmail.com wrote: W/O seeing what is exactly going on... maybe set the alpha to 0 till it's been added? On Wed, May 19, 2010 at 9:19 AM, John Singleton johnsingleton...@yahoo.comwrote: Hi; I have this code: big_container.removeChild(container_middle); big_container.removeChild(container_middle2); container_middle = new Sprite(); big_container.addChild(container_middle) It loops and is called in each iteration except the first. The problem is, when it runs, the image in the container momentarily disappears then reappears, which doesn't look good. How work around this? TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- -jonathan howe ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Flashing Flash
Don't remove container_middle at all. Instead add/remove its children: container_middle.addChildAt(newImage, 0); container_middle.removeChildAt(1); Regards, Keith Reinfeld Home Page: http://keithreinfeld.home.comcast.net -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders- boun...@chattyfig.figleaf.com] On Behalf Of jonathan howe Sent: Wednesday, May 19, 2010 12:23 PM To: Flash Coders List Subject: Re: [Flashcoders] Flashing Flash Looping in frame code, looping in ENTER_FRAME event or looping via a timer? On Wed, May 19, 2010 at 1:16 PM, Bob Wohl bob.w...@gmail.com wrote: W/O seeing what is exactly going on... maybe set the alpha to 0 till it's been added? On Wed, May 19, 2010 at 9:19 AM, John Singleton johnsingleton...@yahoo.comwrote: Hi; I have this code: big_container.removeChild(container_middle); big_container.removeChild(container_middle2); container_middle = new Sprite(); big_container.addChild(container_middle) It loops and is called in each iteration except the first. The problem is, when it runs, the image in the container momentarily disappears then reappears, which doesn't look good. How work around this? TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- -jonathan howe ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders