lundi 20 juin 2016

AS3 Editing after being clicked befor executing gotoAndPlay("abc");

Greetings stackoverflow members,

i have 3 animated movieclips nested in a movieclip. What I'm trying to do is to get the name of the instance clicked and edit it befor applying gotoAndPlay. I can get the name but when ever I try to edit it I'm getting the Error:

Symbol 'Buttons MC', Layer 'Actions', Frame 1, Line 30 1061: Call to a possibly undefined method gotoAndPlay through a reference with static type String.

Here's my code so far:

   [Bindable] var targetName:String;

var _userInput:String = new String();
_userInput = targetName;

//array for buttons
var btnArray:Array = [INS_Btn1, INS_Btn2, INS_Btn3];

//add eventlistiners
for(var i:uint=0; i<btnArray.length; i++) {
    btnArray[i].addEventListener(MouseEvent.ROLL_OVER, bRollover);
    btnArray[i].addEventListener(MouseEvent.ROLL_OUT, bOut);
    btnArray[i].addEventListener(MouseEvent.CLICK, bClick);

//btn over state
function bRollover(event:MouseEvent):void{"Over");
//btn out state
function bOut(event:MouseEvent):void{"Out");
//btn click state
function bClick(event:MouseEvent):void{
    targetName = +("_ani")

What I want is that the MC clicked should go and play the animation of an onther MC. Best I should mention that I'm a beginner in AS3.

Aucun commentaire:

Enregistrer un commentaire