Hi,
I use this to create new instances of a movieclip:
Code:
var myOnStageClip:MovieClip = this.text_mc;
var myLinkage:Class = Class(getDefinitionByName(getQualifiedClassName(myOnStageClip)));
var myDuplicateClip:MovieClip = new myLinkage();
Setting properties of components inside this mc works fine:
Code:
myDuplicateClip.text1.text = "something";
However there are some vars in this mc on the the first frame, something like:
var myurl:String;
When I set this var in the code after the mc is duplicated:
Code:
var myOnStageClip:MovieClip = this.text_mc;
var myLinkage:Class = Class(getDefinitionByName(getQualifiedClassName(myOnStageClip)));
var myDuplicateClip:MovieClip = new myLinkage();
myDuplicateClip.text1.text = "something";
myDuplicateClip.myurl = "http://www......";
trace(myDuplicateClip.myurl) returns the contents of the var correctly.
However, when duplicating the movie clip, another movie clip is also duplicated with a var referencing the first duplicated movie clip:
Code:
var myOnStageClip1:MovieClip = this.drag_mc;
var myLinkage1:Class = Class(getDefinitionByName(getQualifiedClassName(myOnStageClip1)));
var myDuplicateClip1:MovieClip = new myLinkage1();
myDuplicateClip1.source_mc = myDuplicateClip;
The second movieclip has an eventlistner:
Code:
function MouseDown(event:MouseEvent):void{
trace("url" + source_mc.myurl + " " + source_mc.text1.text);
}
The trace comment outputs:
The var myurl in souce_mc is empty!
I hope I have explained the problem clearly. Does anyone have an idea of what is going on here?
Thanks,
Raoul