【发布时间】:2015-04-05 17:56:24
【问题描述】:
我发现我的项目在使用 Export Release Build 导出时无法正常工作。错误非常小:旨在删除视频并卸载任何剩余音频的 stop(0) 函数不起作用。
该文件在 bin-debug 文件夹中正常工作。只有在导出到发布文件夹时才会发生错误。我尝试将 bin-debug 中的“正确”.swf 文件与发布文件夹中的文件进行交换。这会导致“正确”文件失败。
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:local="*" >
<mx:Script>
<![CDATA[
[Bindable] public var videoAddress:String
private static const YOUTUBE_EMBED_URL:String = "http://www.youtube.com/v/";
[Bindable] public var videoUrl:String = "";
public function play():void {
Security.allowDomain("*");
videoUrl = YOUTUBE_EMBED_URL+videoAddress;
}
public function stop():void{
SoundMixer.stopAll();
swfLoader.unloadAndStop(true)
}
public function playVideo(buttonNumber:int):void{
stop()
switch(buttonNumber){
case 0:
videoAddress = "xUWeAOLY0FU?rel=0";
play()
break;
case 1:
videoAddress = "m2dg6teC7fg?rel=0";
play()
break;
default:
break;
}
}
]]>
</mx:Script>
<mx:HBox>
<mx:Button id="button0" label="Button0" click="playVideo(0)" useHandCursor="true" buttonMode="true" />
<mx:Button id="button1" label="Button1" click="playVideo(1)" useHandCursor="true" buttonMode="true" />
</mx:HBox>
<mx:VBox id="vBox" y="50" />
<mx:SWFLoader id="swfLoader" source="{videoUrl}" y="50"/>
我该如何纠正这个错误?我认为这可能是跨域策略的问题,所以我将流文件添加到服务器,但它仍然不起作用: corssdomain.xml
<?xml version="1.0"?>
<!-- http://www.foo.com/crossdomain.xml -->
<cross-domain-policy>
<site-control permitted-cross-domain-policies="by-content-type"/>
<allow-access-from domain="*"/>
<allow-access-from domain="i.ytimg.com"/>
<allow-access-from domain="youtube.com"/>
</cross-domain-policy>
【问题讨论】:
-
错误是什么?你的代码是什么?
-
Export Release 文件所在文件夹中的版本出现故障,但没有错误代码。 bin-debug 文件夹中的版本正常工作,直到整个 bin-debug 文件夹被移动,此时它也出现故障。
-
“无法正常工作”是什么意思。除了你之外,任何人都不清楚这一点。
标签: actionscript-3 apache-flex actionscript flash-builder