Skip navigation
faedother
Currently Being Moderated

Defining Variables so that MC can use them too.

Oct 21, 2009 4:18 PM

OK I know that this is a basic question. I have variables defined in the Root directory of the flash file so that the If statement in the root directory can use them. However there are goto-statements in the movie clip right under the Root directory that also uses the same variables.  How do I define the variables so that act like 'global variables'? I mean I want to define the variables so that the code in the movie clip will use them along with the code in the root directory.

 
Replies
  • Currently Being Moderated
    Oct 21, 2009 10:43 PM   in reply to faedother

    What you mean under "root directory". Is it the main timeline? If it is and you have a variable named 'test' in it you may use MovieClip( this.root ).test to get the value.

    i.e.

    something like this in main timeline;

    var test: uint = 34;

     

    and this in timeline of movieclip added into stage;

    trace( MovieClip( this.root ).test )

     

    will trace '34' in the output.

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 22, 2009 9:14 AM   in reply to faedother

    In short words - "Yes"

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points