2010-10-18 62 views
0

我已經創建了一個簡單的Flash對象,使用「navigatetoURL」將瀏覽器重定向到不同的網頁,同時從外部接口調用URL到執行嵌入Flash文件的頁面的JavaScript。Flash發展問題與發佈

我能夠建立一切都很好,我創建的HTML頁面(使用swfobject.embedSWF嵌入Flash文件)運行良好,並重定向瀏覽器。但是,當我移動所有功能所需的文件(.swf文件,swfobject.js和嵌入flash對象的html文件)時,網頁不再重定向。只顯示一個空白區域,它似乎是Flash對象,並且沒有任何內容被重定向。

Flashdevelop中是否有任何編譯選項,我錯過了以防止更正此問題?

這裏是ActionScript 3代碼:

package 
{ 
import flash.display.Sprite; 
import flash.events.Event; 
import flash.net.navigateToURL; 
import flash.net.URLRequest; 
import flash.net.URLVariables; 
import flash.external.ExternalInterface; 

public class FlashTest extends Sprite 
{ 
public function FlashTest() 
{ 
    var url:String = ExternalInterface.call("GetURL"); 
    var hash:String = ExternalInterface.call("GetHash"); 
    var new_url:String = url + hash; 
    var request:URLRequest = new URLRequest(new_url); 
    navigateToURL(request, "_self"); 

} 
} 
} 

的HTML代碼:

<html> 
<head> 

<script src='js/swfobject.js' type='text/javascript'></script> 
<script type='text/javascript'> 
swfobject.embedSWF('Flashtest.swf', 'altContent', '100%', '100%', '10.0.0'); 
function GetURL() 
{ 
    return 'http://www.cnn.com'; 
} 

function GetHash() 
{ 
    return '?hash=2398asb9s8234'; 
} 

</script> 
</head> 
<body> 
<div id='altContent'> 
<h1>Flash_test</h1> 
<p>Alternative content</p> 
<p><a href='http://www.adobe.com/go/getflashplayer'><img 
src='http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif' 
alt='Get Adobe Flash player' /></a></p> 
</div> 
</body> 
</html> 
+0

我縮小了一點。當目錄改變時,一個簡單的hello world swf文件就可以工作。這似乎與我的特殊瑞士法郎有關。 – 2010-10-18 21:12:06

回答

0

其實,我一直在與SWF的麻煩之中,它們被添加到HTML DOM之前開始, /或在DOM準備好之前。看看Adobes own article on ExternalInterface.call and javascript isReady。 我也有看allowScriptAccess參數:

<script type="text/javascript"> 
    var so = new SWFObject("movie.swf", "mymovie", "400", "200", "8", "#336699"); 
    so.addVariable("allowScriptAccess", "always"); 
    so.write("flashcontent"); 
</script> 
0

它實際上是一個Flash Player的安全問題。如果您將這些文件移出bin文件夾並在本地運行它們,則它們將不再起作用。

每次在flashdevelop中創建項目時,「bin」文件夾都會添加到flash播放器的例外列表中。 如果您將文件移動到另一個文件夾,則在瀏覽器中打開html時,它們將不再工作,因此無法工作。

解決的辦法是手動修改Flash Player安全配置文件,並添加新的路徑,或訪問: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html 點擊全局安全設置>始終允許>編輯ocations>添加位置>新路徑,其中瀏覽文件位於。