flex:加载本地flash文件

问题描述:

我对 flex 3 还很陌生,但到目前为止它真的很酷.感谢你们,我已经嵌入了 2 个 mxml 组件,当我尝试使用 SWFLoader 对象加载 swf 文件时,现在在屏幕中央我收到以下错误:

i'm pretty new to flex 3 but it's really cool so far. i have embedded 2 mxml components thank to you guys, now in the center of the screen when i try to load an swf file using the SWFLoader object i get the following error:

错误 #2044:未处理的安全错误:.文本=错误 #2140:安全性沙盒违规:file:///C:/Users/ufk/Documents/Flex%20Builder%203/GamePage/bin-debug/GamePage.swf无法加载file:///C:/Users/ufk/Documents/Flex%20Builder%203/GamePage/bin-debug/crazy_counting.swf.无法加载本地文件系统和本地网络 SWF 文件彼此.

Error #2044: Unhandled securityError:. text=Error #2140: Security sandbox violation: file:///C:/Users/ufk/Documents/Flex%20Builder%203/GamePage/bin-debug/GamePage.swf cannot load file:///C:/Users/ufk/Documents/Flex%20Builder%203/GamePage/bin-debug/crazy_counting.swf. Local-with-filesystem and local-with-networking SWF files cannot load each other.

代码:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundGradientColors="[0xFFFFFF,0xAAAAAA]" xmlns:local="*">

<mx:SWFLoader id="game_swf" source="crazy_counting.swf" x="198" y="0" width="721" height="531"/>
<local:LiveScoringSystemVBox x="918" y="0" height="531" width="218"/></mx:应用程序>

转到 Project/Properties/Flex Compiler/Additional compiler arguments 并确保使用 -use 编译两个 SWF-network=false 标志.如果其中一个 SWF 可以与网络通信,则您无法将本地 SWF 加载到其中(反之亦然).

Go to Project/Properties/Flex Compiler/Additional compiler arguments and make sure that both SWF's are compiled with -use-network=false flag. If one of the SWF's can talk to network, you cannot load a local SWF into it (the reverse is also true).