Search code examples
flashactionscript-3timeline

How I can change a value of from a variable that is in the main timeline from other timeline?


In AS2 was easy to change a value from a variable that was in other timelines. Now I can't do it the old way!

Basically what I need is to change a value from a variable that is in the main timeline, from another timeline.

Example:

Main timeline:

var totalA:int = 0;

Other timeline, after adding the eventListener to the function:

parent.parent.totalA++;

So it doesn't work. Can anybody explain why? Thanks


Solution

  • Well...i solved it.

    Created a MovieClip with the path:

    var A_mc:MovieClip = MovieClip(this.parent.parent);
    

    Then i referenced it:

    A_mc.totalA++;