Skip to main content
Participant
September 24, 2012
Answered

loading multiple external swf files

  • September 24, 2012
  • 1 reply
  • 794 views

I am trying to load multiple swf files into my flash project. I have it to where it will load one but when i write the code for the others it always loads they same one. here is my code

stop();

btn1.addEventListener(MouseEvent.CLICK,f);

var loader_mc : Loader = new Loader();

var urlRequest : URLRequest = new URLRequest("swf/graphics.swf");

function f(e:Event){

loader_mc.load(urlRequest);

addChild(loader_mc);

}

logos.addEventListener(MouseEvent.CLICK,g);

var myloader_mc : Loader = new Loader();

var myurlRequest : URLRequest = new URLRequest("swf/logos.swf");

function g(e:Event){

          loader_mc.load(urlRequest);

          addChild(loader_mc);

}

brochures.addEventListener(MouseEvent.CLICK,h);

var myotherloader_mc : Loader = new Loader();

var myotherurlRequest : URLRequest = new URLRequest("swf/BROCHURES/brochures.swf");

function h(e:Event){

          loader_mc.load(urlRequest);

          addChild(loader_mc);

}

the code for the logos.swf and brochures.swf always loads the graphics.swf. how can i fix this?

This topic has been closed for replies.
Correct answer Ned Murphy

While you appear to be creating new loaders, you are not using them.  All your functions use the same loading lines...

   loader_mc.load(urlRequest);

   addChild(loader_mc);

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
September 24, 2012

While you appear to be creating new loaders, you are not using them.  All your functions use the same loading lines...

   loader_mc.load(urlRequest);

   addChild(loader_mc);

Participant
September 24, 2012

so do i need to change those to myloader and my other loader?

Ned Murphy
Legend
September 24, 2012

Yes, and your other url requests too.