Skip to main content
Participant
October 7, 2011
Answered

How to use a movieclip path from a variable?

  • October 7, 2011
  • 2 replies
  • 858 views

so.. i have a variable that will change,

and i want to make it my movieclip path, example

var address1:String = New String

if ( someThing > anotherThing) {

     address1 = "mc_big.mc_test"

}

else {

    address1 = "mc_small.mc_test"

}

address1.gotoAndPlay ("this is a test")

well.. that dosent work... i need a way to do that..  im hours trying to figure it out, and nothing..

the only result i got, only works with a short address..

exemple

address1 = "mc_big"

this[address1].gotoAndPlay ('this works!!")

address1 = "mc_big.mc_test"

this[address1].gotoAndPlay ('this dont workt")

any help?

This topic has been closed for replies.
Correct answer kglad

address1= "mc_big.mc_test";

var a:Array=address1.split(".");

this[a[0]][a[1]].gotoAndPlay("whatever");

2 replies

October 7, 2011

maybe u could let address1 be a MovieClip:

var address1:MovieClip;

if ( someThing > anotherThing) {

     address1 = mc_big.mc_test;

}

else {

    address1 = mc_small.mc_test;

}

address1.gotoAndPlay(1);

Participant
October 7, 2011

i got it now..

sollution works

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
October 7, 2011

address1= "mc_big.mc_test";

var a:Array=address1.split(".");

this[a[0]][a[1]].gotoAndPlay("whatever");

Participant
October 7, 2011

THank you!! it works!!

kglad
Community Expert
Community Expert
October 8, 2011

you're welcome.