Welcome to TalkGraphics.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2000
    Location
    Dallas, Tx
    Posts
    277

    Default

    How can I use a variable for an action? If I set variable "myAction" =
    gotoAndStop(2), how can I call on it to perform the action? Here's an
    example of what I'm trying to do:

    VARIABLE VALUE
    myAction1 _root.gotoAndStop(2);
    myAction2 getURL("http://www.mydomain.com","_blank");

    So, if I have a movieClip button with the actions set by the "onRelease"
    action, how can I make it perform the action? The following is an example
    of what I've been trying but it doesn't work:

    myButtonMC1.onRelease = funtion(){
    this[myAction1];
    }
    myButtonMC2.onRelease = funtion(){
    this[myAction2];
    }

    Thanks for any help,

    Scott

  2. #2
    Join Date
    Aug 2000
    Location
    Dallas, Tx
    Posts
    277

    Default

    How can I use a variable for an action? If I set variable "myAction" =
    gotoAndStop(2), how can I call on it to perform the action? Here's an
    example of what I'm trying to do:

    VARIABLE VALUE
    myAction1 _root.gotoAndStop(2);
    myAction2 getURL("http://www.mydomain.com","_blank");

    So, if I have a movieClip button with the actions set by the "onRelease"
    action, how can I make it perform the action? The following is an example
    of what I've been trying but it doesn't work:

    myButtonMC1.onRelease = funtion(){
    this[myAction1];
    }
    myButtonMC2.onRelease = funtion(){
    this[myAction2];
    }

    Thanks for any help,

    Scott

  3. #3
    Join Date
    Aug 2000
    Location
    Toronto, Ontario, Canada
    Posts
    432

    Default

    myaction = "gotoAndStop(2)";
    eval(myaction);

    using eval will treat the string in your variable as actionscript.


    hth,
    Deep (just a guy)
    <font face="arial" size="2">
    Pradeep Kumar Nair, B.Math
    Content Manager
    9 Story Entertainment
    http://www.9story.com
    ICQ: 39102360
    </font>
    hth,
    Deep (just a guy)
    --
    Pradeep Kumar Nair, B.Math
    CTO
    9 Story Entertainment
    http://www.9story.com

  4. #4
    Join Date
    Aug 2000
    Location
    Dallas, Tx
    Posts
    277

    Default

    I would have never thought of that. I haven't tried it yet, but I definitely will. I'll let you know how it works out.

    I haven't been to this board for some time now, but I'm glad I checked it out tonight!!

    Thanks Deep!!

    Scott

  5. #5
    Join Date
    Aug 2000
    Location
    Dallas, Tx
    Posts
    277

    Default

    Hi Deep,

    I tried using eval to treat the variable value as actionscript, but it's not working. I just used the code you posted. Is there something missing?

    Thanks a million, and you're still the greatest!

    Scott

 

 

Bookmarks

Posting Permissions

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