dcsimg
A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Do variables have to be in the same layer?

  1. #1
    Junior Member
    Join Date
    Mar 2001
    Posts
    9
    Some help..

    I can't get varibles from a button to work on a mc..!!
    could someone take pity on me and give me a good lesson on using variables properly??

  2. #2
    Registered User
    Join Date
    Nov 2000
    Posts
    122
    a good way of doing it is to go:

    _root.variable

    when tring to access variable...

    so no matter where u are you ll get it from the main timeline...
    you have to setVariable in order to make the variable Global....

  3. #3
    Member
    Join Date
    Mar 2001
    Posts
    70
    Originally posted by twoei22
    a good way of doing it is to go:

    _root.variable

    when tring to access variable...

    so no matter where u are you ll get it from the main timeline...
    you have to setVariable in order to make the variable Global....
    Thanks for a million Twoei22 -you answered to (all?!) my problems!!!
    ... i am losing the rest of my hair with this freaking flash ...so it be -back to _roots, eh?

  4. #4
    Junior Member
    Join Date
    Mar 2001
    Posts
    9
    Ok.. but that doesn't really answer my question.
    I need to put my varibles on the button actions.. not on _root because i need the button action to set my variables.
    but i can't get the button to 'broadcast' the variables to a mc that is checking for them. not even to a _parent mc of that button. much less to the _root timeline.
    Even with just this small problem I can't get it to work. I cant get buttons to broadcast variables. I know i'm doing it wrong i just don't know what it is.
    What I really want to do is to have a button placed on the _level0._root timeline with a variable ie. on (release) {
    land=("1");
    } // I want this variable to go to an mc on _level1._root that is checking for it so it knows where to stop.
    So if anyone can help me w/ this I would be grateful.
    By the way thanks to TSO & twoei22 for the response.


  5. #5
    Registered User
    Join Date
    Nov 2000
    Posts
    122
    Yes!!!

    back to the _roots!!!!!

    tagkng , i m not really understanding ur problem...but a good way of seeing if your variable is beeing 'broadcasted' is to use :

    trace ( whatever );

    next to your setVariable action

    then when u preview (ctrl+enter) go to window > output

    when u click on ur button it should write in the output window whatever... if it doesnt you ll know that it s not accessin the variable...

    also it s better to use other variable values than 1 - 2 etc...
    it can become confusing...




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