Update:
I try access to (MySWF(movieClip)).id but I get a weird message error:
1120: Access of undefined property aslider
which is defined in MySWF.init. If I remove (MySWF(movieClip)).id program works perfect !
Isn't this weird especially as I have added addEventListener(Event.ADDED_TO_STAGE, init); in MySWF constructor to ensure that aslider is on the stage.
In main:
private var idMySWF:int;
public function loadMySWF(event:MouseEvent) {
idMySWF = 1;
var myLoader:Loader = new Loader();
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
myLoader.load(new URLRequest("MySWF.swf"));
myZone.addChild(myLoader);
}
public function loadComplete(evt:Event):void {
var movieClip:MovieClip;
var myLoader:Loader;
myLoader = evt.currentTarget.loader as Loader;
movieClip = MovieClip(loader.content);
myLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE, loadComplete);
myLoader = null
movieClip.addEventListener(CustomEvent.ON_CUSTOM_EVENT,OnCustomEvent);
(MySWF(movieClip)).id = idMySWF;
}
In MySWF:
private var _id:int;
public function get id():int {
return _id;
}
public function set id(__id:int):void {
_id = __id;
}
public function MySWF() {
addEventListener(Event.ADDED_TO_STAGE, init);
}
public function init( e:Event ):void {
removeEventListener( Event.ADDED_TO_STAGE, init );
aslider.addEventListener(SliderEvent.CHANGE,OnSliderEventChange);
}