通过Loader将参数传递给swf

编程入门 行业动态 更新时间:2024-10-12 20:25:17
本文介绍了通过Loader将参数传递给swf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个swf(child.swf),我想加载到另一个(parent.swf)。我希望通过我正在使用的加载器将参数传递给child.swf。 请注意,我没有试图通过的FlashVars parent.swf已经有,而是我试图通过自定义参数加载一个瑞士法郎通过另一个瑞士法郎。

解决方案

在子swf中,写一个函数(下面的代码中的init)来接收任何参数。当Loader发出Event.COMPLETE信号时,如下调用parent.swf函数: $ $ $ $ $ $ $ $ $ $ var request:URLRequest = new URLRequest child.swf); var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE,loadHandler); loader.load(request); 函数loadHandler(event:Event):void { var childSwf:Object = event.target.content; childSwf.init(PARAMS); }

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.

解决方案

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 ); }

更多推荐

通过Loader将参数传递给swf

本文发布于:2023-11-24 02:20:50,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1623615.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:参数   Loader   swf

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!