简体   繁体   English

从另一个 swf 文件访问 swf 组件

[英]Access swf component from another swf file

Greeting, I have two flash files myVideo1.swf and myVideo2.swf Each one contents FLVPLAYBack component.您好,我有两个 flash 文件 myVideo1.swf 和 myVideo2.swf 每个内容 FLVPLAYBack 组件。 myVideo1.swf FLVPLAYBack component instance name is “video1” myVideo2.swf FLVPLAYBack component instance name is “video2” I want to be able to access myVideo2.swf from myVideo1.swf using as3. myVideo1.swf FLVPLAYBack 组件实例名称为“video1” myVideo2.swf FLVPLAYBack 组件实例名称为“video2” 我希望能够使用 as3 从 myVideo1.swf 访问 myVideo2.swf。 I want when I click play button on myVideo2.swf the myVideo1.swf would stopped.我希望当我单击 myVideo2.swf 上的播放按钮时 myVideo1.swf 会停止。 Bother flash files are in the same folder.麻烦 flash 文件位于同一文件夹中。 Please advice how to do this in action script 3 Regards,请建议如何在动作脚本中执行此操作 3 问候,

First when you load your swf you need to set the loader context domain to your current domain首先,当您加载您的 swf 时,您需要将加载器上下文域设置为您当前的域

    loader = new Loader();
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);
    var request:URLRequest = new URLRequest('swf/assets.swf');
    var context:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain);
    loader.load(request, context);

Then you can access library items set to export using:然后,您可以使用以下方式访问设置为导出的库项目:

    var MyClass:Class = Class(ApplicationDomain.currentDomain.getDefinition("export_id"));
    var myInstance:Sprite = new MyClass() as Sprite;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM