通过加载器传递paramaters到一个swf [英] passing paramaters to a swf via Loader

查看:254
本文介绍了通过加载器传递paramaters到一个swf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个SWF(child.swf),我想加载到另一个(parent.swf)。我希望传递一个参数来child.swf通过我使用的装载机。 注意,我不是想传递parent.swf Flash变量已经有,而是我想简单地通过另一个SWF自定义参数加载SWF。

I have a swf (child.swf) that I wish to load into another (parent.swf). I wish to pass a parameter to child.swf through the loader I am using. Note that I am not trying to pass FlashVars that parent.swf already has, but rather I am trying to simply load a swf through another swf with custom arguments.

任何想法?

推荐答案

在子SWF,编写一个函数(初始化在code以下)收取任何PARAMS。当装载信号引发Event.COMPLETE,调用从parent.swf的功能如下:

In the child swf, write a function (init in the code below) to receive any params. When the Loader signals Event.COMPLETE, call the function from parent.swf as follows:

var request:URLRequest = new URLRequest("child.swf");
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadHandler);
loader.load(request);

function loadHandler(event:Event):void
{
   var childSwf:Object = event.target.content;
   childSwf.init( PARAMS );
}

这篇关于通过加载器传递paramaters到一个swf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆