2014-02-07 40 views
0

我新來here.i有一個問題,我試圖導入外部瑞士法郎到Movieclip,但當我這樣做...我的瑞士法郎不align.i不知道爲什麼。如何將外部swf對齊到特定的MovieClip?

,我使用的代碼是:

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

回答

0

使用contentLoaderInfoEvent.COMPLETE像這樣,

var request:URLRequest = new URLRequest("prod.swf"); 
var loader:Loader = new Loader(); 
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onSWFLoad); 
loader.load(request); 
addChild(loader); 

function onSWFLoad(e:Event):void 
{ 
    var loadedSWF:MovieClip = MovieClip(e.target.content); 

    //Now you can access and set MovieClip's properties like width, height, position etc 

    someMovieClip.addChild(loadedSWF); 

    loadedSWF.x = 100; //x Position 
    loadedSWF.y = 100; //y Position 

} 
相關問題