Fenrir370 0 Newbie Poster

so i have a class assignment to link all our game files, im trying to load a "lose.swf" after the car crashes. our teacher only gave us this line of code to use and i cant seem to figure out how to get the MovieClip(stage.getChildAt(0)).loadThisScreen("lose.swf");
part to work properly ( we did not learn flash coding we just learned to animation part ) but from my c++ class i can kinda understand whats going on.

import ash.net.URLRequest;
// Creating the loader ----------------------------------------------------/
var loader:Loader = new Loader();
loader.load(new URLRequest("homeScreen.swf")); // adding your homeScreen
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loop);
// Function that loops variables for percent loaded text and scaling the progress bar -----------------------------------/
function loop(e:ProgressEvent):void
var perc:Number = e.bytesLoaded / e.bytesTotal;
var s:String = Math.ceil(perc*100).toString()+"%";
percent_txt.text = s;
bar_mc.scaleX = perc;
//Unloading the loader and removing the pre-loader elements --------------/
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, done);
function done(e:Event):void
// nally, add the loader to the stage to display it ------------------------------------/
function loadThisScreen(screen:String):void
 loader.load(new URLRequest(screen));
// Code that goes on the end of the crash frame ------------------------------------/
// Code that goes on the last frame of the main timeline when you win ------------------------------------/
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.