Cannot bring var to _root
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Cannot bring var to _root

  1. #1
    Senior Member
    Join Date
    Sep 2002
    Posts
    119

    Cannot bring var to _root

    This is the situation:
    I have several MCs into one another(4) and a button at the bottom of all of them.
    The button is supposed to bring up a value contained into a textbox down there up to _root.textbox_variable

    Like this:
    on(press){
    _root.top_textbox_variable=bottom_text_value;
    {

    But it doesnt work. It only works when I have the textbox one level below _root. like this:

    on(press){
    _root.MC.MC_textbox_variable=bottom_text_value;
    {
    As if I cannot go to _root but yes to _root.Sub
    Any clue?
    Thanks again for the help.
    JC3

  2. #2
    general rule bender Gloomycus's Avatar
    Join Date
    Nov 2000
    Location
    ontario canada
    Posts
    1,538
    Because the variables exist inside the movie clips, you have to target them on the movie clips. The problem that you were having with your original script was that you were targeting variables on the main time line that don't affect anything inside your movieclips. Your second script is more correct. An alternative solution to get what you want is inside each movieclip have a script like so

    Code:
    onClipEvent(enterFrame) {
      myvar = _root.myvar;
    }
    This will pull the variables off the _root timeline and subsititute those variables into your movie clips.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width


HTML5 Development Center

Poll by Flashkit.com