Reputation: 5851
Greeting, I have two flash files myVideo1.swf and myVideo2.swf Each one contents FLVPLAYBack component . 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. I want when I click play button on myVideo2.swf the myVideo1.swf would stopped. Bother flash files are in the same folder. Please advice how to do this in action script 3 Regards,
Upvotes: 0
Views: 448
Reputation: 727
First when you load your swf you need to set the loader context domain to your current domain
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;
Upvotes: 1