1
votes

getting error

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()

within cs5, any ideas. thanks. The animation imports fine, but I am getting that error without the progress bar being shown.

import fl.controls.ProgressBar;
var swfRequest:URLRequest = new URLRequest("animation2.swf"); //load animation file
var swfLoader:Loader = new Loader();
var progressBarr:ProgressBar = new ProgressBar();
progressBarr.source = swfLoader.contentLoaderInfo;
progressBarr.x = 27;
progressBarr.y = 155;

loadMovie();

function loadMovie():void{
    addChild(progressBarr);
    swfLoader.load(swfRequest);
}

swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoaded, false, 0, true); //when loaded call swfLoaded
//swfLoader.load(swfRequest);
//
function swfLoaded(event:Event):void{
     swfMC.addChild(swfLoader); //add animation to swfMC movie clip
     removeChild(progressBarr);
}

stop();
2

2 Answers

1
votes

giving no errors to me, in CS5, though one thing that you can check is, drag a progress bar component from the component window, save and run your file, then delete the instance. after that your code should do just fine.

also you can comment this line as:

var progressBarr:ProgressBar = new ProgressBar();
//progressBarr.source = swfLoader.contentLoaderInfo;
progressBarr.x = 27;
progressBarr.y = 155;

check fla here:

http://ashwani.50webs.com/test.fla

0
votes

Did you try calling

progressBarr.source = swfLoader.contentLoaderInfo;

after you intialized the loader? You may need to wait until that has been instantiated before assigning anything to its contentLoaderInfo. So, remove it up at the top and add it below the swfLoader.load call:

swfLoader.load(swfRequest);
progressBarr.source = swfLoader.contentLoaderInfo;