[英]AS3 iOS : Loading external swf
I'm trying to load a swf in another using AIR3.6. 我正在尝试使用AIR3.6在另一个SWF文件中加载SWF文件。 I duplicated the code I found here http://blogs.adobe.com/airodynamics/2012/11/09/packaging-and-loading-multiple-swfs-in-air-apps-on-ios/ but in vain.
我复制了我在http://blogs.adobe.com/airodynamics/2012/11/09/packaging-and-loading-multiple-swfs-in-air-apps-on-ios/上找到的代码,但徒劳无功。 It does'nt work.
它不起作用。 So I think I didn't understand part of the procedure.
因此,我认为我不了解部分程序。
That what I have done : 那就是我所做的:
• I have a first fla I can correctly publish for iOS. •我有第一本可以为iOS正确发布的文件。
• In this fla I have this code : •在这种情况下,我有以下代码:
var mLoader:Loader = new Loader();
var mRequest:URLRequest = new URLRequest("test.swf");
var _lc:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);
mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
mLoader.load(mRequest);
function onCompleteHandler(loadEvent:Event)
{
addChild(loadEvent.currentTarget.content);
}
• In the publish settings I went to the General tab and I included my second swf : test.swf •在发布设置中,转到“常规”选项卡,并添加了第二个swf:test.swf
• The second swf (test.swf). •第二个swf(test.swf)。 I published it with AIR 3.6 for iOS.
我使用AIR 3.6 for iOS发布了它。 It has no actionscript at all.
它根本没有动作脚本。 There is only a green shape in it.
里面只有绿色的形状。
• When I test my first fla, the second one is correctly loaded. •当我测试第一个fla时,第二个fla已正确加载。
• When I publish it in my iPad, the second swf is NOT loaded. •当我在iPad中发布它时,第二个瑞士法郎未加载。
Can someone tells me where I was wrong ? 有人可以告诉我我错了吗?
Thanks. 谢谢。
All right, 10 seconds after publishing my question, I found my solution. 好的,在发布问题10秒钟后,我找到了解决方案。 I only forgot to put the _lc:LoaderContext in the mLoader.load().
我只忘记将_lc:LoaderContext放在mLoader.load()中。 So here is it :
就是这样:
var mLoader:Loader = new Loader();
var mRequest:URLRequest = new URLRequest("test.swf");
var _lc:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);
mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
mLoader.load(mRequest, _lc);
function onCompleteHandler(loadEvent:Event)
{
addChild(loadEvent.currentTarget.content);
}
Note to moderators : Not sure this will be helpfull for anyone, but I don't know how to delete a post. 主持人注意:不确定这对任何人都有用,但我不知道如何删除帖子。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.