charger un swf et le poser sur la scene
Bonjour, j'essai de faire ça via une classe...
On dirais que ça pêche au niveau de addChild.. Enfin j'en sais trop rien finalement ^^
Voici ce que j'ai fais.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
package {
import flash.display.MovieClip;
import flash.display.Loader;
import flash.display.LoaderInfo;
import flash.net.URLRequest;
import flash.events.Event;
import flash.events.ProgressEvent;
public class Test extends MovieClip {
private var myImg:Loader = new Loader();
public function Test() {
init();
}
public function init():void {
// let's load the image
try {
myImg.load(new URLRequest("Ships/blazing_star/blazing_star.swf"));
} catch (error:Error) {
trace("Unable to load requested document.");
}
myImg.contentLoaderInfo.addEventListener(Event.COMPLETE,result);
}
public function result(evt:Event):void {
addChild(myImg);
myImg.x=100;
myImg.y=100;
}
}//end of class
}//end of package |
Et sur ma scene:
Code:
1 2
|
var test:Test = new Test(); |
Si vous avez une idée !
Merci de bien vouloir m'aider !
@++ !