2012-06-17 34 views
0

我一直在嘗試在幾個小時內找到相應的代碼。但我發現的那些似乎都沒有工作。我真的需要幫助...我絕望... 我有2個SWF文件。我在第一個swf文件(下一個按鈕)的末尾添加了一個按鈕。我想在按下此按鈕時轉到第二個swf文件。我知道如何使用actionscript 2.0(LoadMovie)來做到這一點......但是我在ActionScript 3.0中開始使用swf,現在我需要在AS 3.0中編寫代碼。 有人可以幫我用這個代碼?我嘗試了一些我從其他用戶看到的代碼,但我不知道我在做什麼錯,他們中的任何一個都適合我!按鈕在AS 3.0中打開swf

非常感謝!

+2

讓我們瞭解您已經嘗試 –

+0

瞭解如何使用谷歌:http://www.ilike2flash.com/2009/11/load-external-swf-in-as3 .html –

回答

0

這應有助於:

// Set the URL of the second movie 
var url:String = "url_of_your_second_movie" 

// Create the loader object using the specified URL 
var loader:Loader=new Loader(); 
var request:URLRequest; 
request= new URLRequest(url); 

// Set the COMPLETE event handler 
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete); 

// Start the load 
loader.load(request); 

// Fill the COMPLETE event handler as needed 
private function onComplete(e:Event):void 
{ 
    // Add the loaded content to the display list 
    addChild(e.currentTarget.content); 
    // Do whatever else is needed once the movie is completed 
} 
+0

很酷。謝謝您的幫助。這兩個選項都有效,您發佈的代碼和網站建議。 – Flowers