AS3 FlashDevelop项目使用as3isolib路径问题
我正在使用 as3isolib 制作 isogame,在 win7 下使用 FlashDevelop。游戏需要加载一些用AS2编码的外部SWF。 当我调试应用程序时,它会在玩家到达给定位置时设法加载 SWF。该程序实例化一个按钮(从该 SWF),该按钮关闭(removeChild)该按钮和加载的 SWF。但是,当我将 bin 文件夹复制/粘贴到其他位置(出于向其他团队成员显示的目的)时,SWF 并未加载(但该 SWF 中包含的按钮已加载!)。 文件夹结构如下:
- isoGame/bin;
- isoGame/libs/...所有库;
- isoGame/src/... 主要动作脚本;
- isoGame/src/game... 全部自定义为
- isoGame/scr/game/assets
有一个名为 Assets.as 的文件,其中包含所有资源的路径。例如,“OVA.swf”。该文件被复制到 /assets 和 /bin 内。但同样,当我想更改文件夹位置时,SWF 未加载。
加载SWF的函数是:
private function onUpdate( e:Event ):void
{
if (_avatar.x == 4 * _level.CELLSIZE && _avatar.y == 4 * _level.CELLSIZE)
{
//_swfFile = new URLRequest(Assets.OVA1_PATH);
_swfLoader.load(new URLRequest(Assets.OVA1_PATH));
_swfLoader.x = (Constants.PLAYER_WIDTH - 550) / 2;
_swfLoader.y = (Constants.PLAYER_HEIGHT - 400) / 2;
close_btn = new Assets.CLOSE_BTN_CLASS();
close_btn.addEventListener( MouseEvent.MOUSE_UP, onCloseOVA );
close_btn.x = 550 + _swfLoader.x;
close_btn.y = _swfLoader.y;
//adding the objects
addChild(_swfLoader);
addChild(close_btn);
}
}
谢谢!
I'm doing an isogame with as3isolib, using FlashDevelop under win7. The game needs to load some external SWF coded with AS2.
When I debug the application, it manages to load the SWF when the player reaches a given position. The program instantiates a button (from that SWF) which closes (removeChild) both the button and the loaded SWF. But when I copy/paste the bin folder, to other location (for display purposes to the other team mates), the SWF it's not loaded (but the button contained in that SWF is loaded!).
Folder structure as follows:
- isoGame/bin;
- isoGame/libs/...all libs;
- isoGame/src/... the main actionscript;
- isoGame/src/game... all custom as
- isoGame/scr/game/assets
There's a file called Assets.as, that contains the path to all resources. For instance, "OVA.swf". That file is copied inside /assets and /bin. But again, when I want to change the folder location, the SWF is not loaded.
The function loading the SWF is:
private function onUpdate( e:Event ):void
{
if (_avatar.x == 4 * _level.CELLSIZE && _avatar.y == 4 * _level.CELLSIZE)
{
//_swfFile = new URLRequest(Assets.OVA1_PATH);
_swfLoader.load(new URLRequest(Assets.OVA1_PATH));
_swfLoader.x = (Constants.PLAYER_WIDTH - 550) / 2;
_swfLoader.y = (Constants.PLAYER_HEIGHT - 400) / 2;
close_btn = new Assets.CLOSE_BTN_CLASS();
close_btn.addEventListener( MouseEvent.MOUSE_UP, onCloseOVA );
close_btn.x = 550 + _swfLoader.x;
close_btn.y = _swfLoader.y;
//adding the objects
addChild(_swfLoader);
addChild(close_btn);
}
}
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决了!
刚刚更改了 SWF 的安全性。
转到文件->发布设置->本地播放安全:仅访问网络
这样,SWF 文件就可以很好地加载(上面写有 AS2.0 代码)。
顺便说一句,我不知道如果这些文件位于可供公共访问的服务器上,情况是否会相反。当我进行测试时,我会将它们写在这里。
SOLVED!
Just changed the security of the SWF.
Go to File->Publish settings-> Local playback security: Access network only
This way, the SWF files are nicely loaded (with the AS2.0 code written on it).
By the way, I don't know if this will be the opposite if those files are on a server for public access. When I do the testings, I'll write them here.