Skip to main content
Known Participant
April 8, 2010
Answered

reading a var on main, from a MC

  • April 8, 2010
  • 1 reply
  • 1271 views

hi, on my first frame in the main timeline, i specify a var

var geklikt:String = "About";

now on the same timeline, on the same frame, theres an MC
in that MC, i want to read the value of the var created on the maintime line.

how do i do this plz?

should be simple, but it seems i cant figure it out

thx in advance peepz

This topic has been closed for replies.
Correct answer Kartik_Mehta

Hi,

Try doing this it will help you.

var mc:MovieClip = this.parent as MovieClip;
MovieClip(this.root).gotoAndStop(mc.geklikt);

1 reply

Kartik_Mehta
Inspiring
April 8, 2010

Hi Allice.D,

You can use the following code to get your first frame variable:-

var mc:MovieClip = this.parent as MovieClip;
trace(mc.geklikt)

by doing this on main time line inside movieclip you can access main time variable.

Allice_DAuthor
Known Participant
April 8, 2010

hey man, thx for the reply

but when i do

var mc:MovieClip = this.parent as MovieClip;
trace(mc.geklikt)
MovieClip(this.root).gotoAndStop(geklikt);

it doesnt work


and when i do

var mc:MovieClip = this.parent as MovieClip;
trace(mc.geklikt)
var geklikt:String = "About";
MovieClip(this.root).gotoAndStop(geklikt);

it works

i used the same line to specify geklikt in the mc as on the main timeline

why isnt it passing the var?

any other way of showing me whats inside a var?

like in html and php i would use echo(geklikt)

thx again

Kartik_Mehta
Kartik_MehtaCorrect answer
Inspiring
April 8, 2010

Hi,

Try doing this it will help you.

var mc:MovieClip = this.parent as MovieClip;
MovieClip(this.root).gotoAndStop(mc.geklikt);