Skip to main content
April 18, 2011
Answered

Making a loadmovie in an empty movie clip

  • April 18, 2011
  • 1 reply
  • 737 views

Hi. I'm making a new as3 file, and there i made an animation, like an intro for my website, in a movie clip. But what i want is, when this animation or this movie clip ends, automatically it charges another swf with my website, without having to press any button. I read some tutorials on internet that i can make this, creating a new empty movie clip, and then writing some code, but it didn`t work me. Please can anybody help me with the exact code i have to write? I will appreciate so much that, because i'm new in this as3 topic. Thanks so much for ur time.

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

All you need to do is pull the code out of the function...

stop();
var loader:Loader =new Loader() ;
addChild(loader) ;

loader.load(new URLRequest("whatever.swf"));
loader.x =0
loader.y =0

And you mentioned adding the loaded object to a movieclip, so if you still plan to do that then give the movieclip an instance name and use it's name to add the loader to it instead of what your code does above...

Change: addChild(loader);

To:  mcName.addChild(loader);

1 reply

Ned Murphy
Legend
April 18, 2011

Can you show the code your tried that did not work?  Your description of what you are trying to do is not entirely clear.

April 18, 2011

I wanna load an External Swf Into a Movieclip. In the past for calling a movieclip with as2 it was this code:


on(release){
loadMovie("whatever.swf", "_level1");
}

Actually, i don't know how to traslate this codet o AS3.

I only could make this, making a mouse event, using this code:

stop();
var loader:Loader =new Loader() ;
addChild(loader) ;

button.addEventListener(MouseEvent.CLICK,onclickbutton);

function onclickbutton(e:MouseEvent):void{
loader.load(new URLRequest("whatever.swf"));
loader.x =0
loader.y =0

}

But in this case, i don't want to click any button for loading the swf. So I read, i can create a new empty movieClip, and make a loadmovie on it.

But i don't know how to do it =(

April 18, 2011

All you need to do is pull the code out of the function...

stop();
var loader:Loader =new Loader() ;
addChild(loader) ;

loader.load(new URLRequest("whatever.swf"));
loader.x =0
loader.y =0

And you mentioned adding the loaded object to a movieclip, so if you still plan to do that then give the movieclip an instance name and use it's name to add the loader to it instead of what your code does above...

Change: addChild(loader);

To:  mcName.addChild(loader);


thank you very much, that worked.