Hey, i have a pretty basic doubt that is giving me a lot of trouble. Have a look at this
private function init():void
{
for(var i:int=0; i<15; i++)
{
historymc = new historyDip();
stageRef.addChild(historymc);
[COLOR=Red]historymc.name = String(i);[/COLOR]
trace(historymc.name);
historymc.x = 399.1;
historymc.y = yPos;
historymc.z = zPos;
if(i==0)
{
historymc.alpha = 1;
}else
{
historymc.alpha = 0.6;
}
zPos = zPos+200;
yPos = yPos-30;
}
nav.next_btn.addEventListener(MouseEvent.CLICK, nexting);
}
In the above init function i create 15 instances of this movie clip historymc. I give them each a name according to what the value of i is. That is 0,1,2…
Now
private function nexting(e:MouseEvent):void
{
kill = currentPos;
kill2 = String(int(currentPos)+1);
TweenLite.to(this[kill], 0.5, {z:200, ease:Circ.easeOut, onComplete:fadeIt});
}
private function fadeIt():void
{
TweenLite.to(this[kill], 0.5, {alpha:0, ease:Circ.easeOut});
TweenLite.to(this[kill2], 0.5, {z:0, ease:Circ.easeOut, onComplete:bringIt});
}
private function bringIt():void
{
TweenLite.to(this[kill2], 0.5, {alpha:1, ease:Circ.easeOut});
}
Above currentPos right now just has a string value of 0. I want the tweenlite method to animate the instances i created in the init function. However I am having trouble getting the instanceName right.
I get the error - “Property 0 not found on histroyClass and there is no default value” when I click the next button.
I am not being able to call the instance name I gave in the init function inside the event handler. Is this a scoping issue. Event getChildByName doesn’t work. How do I solve this issue.