PDA

View Full Version : progressBar fails when SWF is loaded into another SWF?



Yuu
June 25th, 2008, 04:28 PM
I've got a child SWF that loads images from XML. in that child I've got a progress bar component tied to the loading if the image.

When I test that child on it's own, the progress bar displays as it should.

The problem comes when I load that child into it's parent SWF file. The progress bar magically disappears, and I get this message



TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::ProgressBar/drawTrack()
at fl.controls::ProgressBar/draw()
at fl.core::UIComponent/callLaterDispatcher()


Can anyone illuminate this rookie as to what's going on?

Also I've got a question about properly getting the amount of the image that's loaded. But that's probably best left for a different thread.

Thanks for any help.

bzouchir
June 26th, 2008, 03:52 AM
This is because the addChild method is being called before the loader has completed loading the swf.

add
loader.contentLoaderInfo.addEventListener(Event.Co mplete, handleComplete);

then in handleComplete addChild

post your code here if you couldn't get it to work

ventoline
February 3rd, 2009, 11:33 AM
I'm having the same problem , i don't see where the addchild method would be called before the loader is done loading... Are there any tricks with UILoaders?