views:

288

answers:

1

I can show a swf into flash simply with this code

var request:URLRequest = new URLRequest("myswf.swf");
var loader:Loader = new Loader()
loader.load(request);
addChild(loader);

But with import > import to stage there is no any swf when ctrl+enter. There is only 5-6 empty frame in timeline. How can I solve this problem??

Another question, how can I do this with as 2.0 (im not familiar with as 2.0). This code not working :

loadMovie("myswf.swf");

Thanks in advance

A: 

Loader() and addChild() are both AS3, so won't work in AS2.

loadMovie() is a movieClip method, so it needs a movieClip instance to operate on:

myMovieClip.loadMovie("myswf.swf");

To load your swf into the main timeline, try:

this.loadMovie("myswf.swf");
Richard Inglis
Thank you Richard;
You're welcome - don't forget you can click the big tickmark to 'accept' an answer (this will encourage others to help you out in future!)
Richard Inglis