Communicating with a loaded as2 swf in another as2 swf
I have loaded an AS2 swf inside another AS2 swf using MovieClipLoader. I have no control(cannot edit) over the child swf. Is there a way I can communicate with the child swf from the parent sw开发者_如何转开发f.
The child swf is not accepting any LocalConnection Objects. Can I call a method in the child swf some other way?
Thanks, Sri
I made the mistake of adding code interacting with the loaded swf buttons in the onLoadComplete
listener which doesn't work unless you are interacting with the loaded swf container only, dynamic text or buttons inside loaded swf can't be accessed. To control the objects inside the child (buttons, dynamic text etc) add your code in the onLoadInit
listener. As an example
mclListener.onLoadInit = function(childSwf:MovieClip, status:Number):Void {
childSwf.btnInsideChild.onRelease = function()
{
childSwf._x += 10;
}
};
moved my loaded childswf by clicking the buttons inside the loaded swf
you can access any public methods/properties on the child swf after it is initialized. Listen for the onLoadInit
handler, and access child members from there. LocalConnection objects aren't required if your swfs exist in the same AVM runtime instance.
You can access like child MovieClip / Custom Class Instance. When you are loading you have to define one variable and you have to use variable for accessing public methods of the Child external swf. it is treated as Child Display Object. And as per the flash UI Display list system, MovieClip can contains unlimited level nested Child Display Object.
精彩评论