Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Help creating a flash preloader

Avatar of flynny
flynnyFlag for United Kingdom of Great Britain and Northern Ireland asked on
Adobe Flash
4 Comments1 Solution255 ViewsLast Modified:
Hi all,

we are trying to create a preloader for a flash banner on our site it is a large animations as it consists of a video embedded in it).

so we want to create a preloader to give the user some indication of how the download;

i found a skeleton preloader project. however it doesn't seem to be working?? we are using flash cs4.

it seems to fall over here;

      removeChild(myPreloader);

with the error

ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
      at flash.display::DisplayObjectContainer/removeChild()
      at preloader_complete_fla::MainTimeline/showContent()[preloader_complete_fla.MainTimeline::frame1:25]
Cannot display source code at this location.

any ideas whats going on?
var myRequest:URLRequest = new URLRequest("flash_we_are_loading.swf");
var myLoader:Loader = new Loader();

myLoader.load(myRequest);

myLoader.contentLoaderInfo.addEventListener(Event.OPEN,showPreloader);
myLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,showProgress);
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,showContent);

var myPreloader:Preloader = new Preloader();

function showPreloader(event:Event):void {
	addChild(myPreloader);
	myPreloader.x = stage.stageWidth/2;
	myPreloader.y = stage.stageHeight/2;
}

function showProgress(event:ProgressEvent):void {
	var percentLoaded:Number = event.bytesLoaded/event.bytesTotal;
	myPreloader.loading_txt.text = "Loading - " + Math.round(percentLoaded * 100) + "%";
	myPreloader.bar_mc.width = 198 * percentLoaded;
}

function showContent(event:Event):void {
	removeChild(myPreloader);
	addChild(myLoader);
}
ASKER CERTIFIED SOLUTION
Avatar of blue-genie
Commented:
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answers