Professional Web Applications Themes

attaching "do-all" function to button - Macromedia Flash Actionscript

not sure how to phrase this, but i hope it makes sense:: Is there a way to have one function attached to a button that will apply to all the different button states (and do different things)? Right now, I have to write one function for the over state, one for the down, one for the release, etc (and call each of these individually in each instance of the button)... Basically, it would be easier if I could put one line of code in my button, that calls a function that contains all the scripts for the different states. This ...

  1. #1

    Default attaching "do-all" function to button

    not sure how to phrase this, but i hope it makes sense::

    Is there a way to have one function attached to a button that will apply to
    all the different button states (and do different things)? Right now, I have to
    write one function for the over state, one for the down, one for the release,
    etc (and call each of these individually in each instance of the button)...
    Basically, it would be easier if I could put one line of code in my button,
    that calls a function that contains all the scripts for the different states.

    This way, if I create a new button, I only have to attach one thing, and not
    "on press...on release...on...etc..."..you get the point. It sounds like a
    trivial matter, but it would make certain things a little more streamlined.

    Anyway, if anyone has an ideas, or even understands what I'm talking
    about,,,let me know.

    thanks

    asiabackpacker Guest

  2. #2

    Default Re: attaching "do-all" function to button

    function blah(msg){
    trace(msg);
    }
    first_btn.onRelease = function(){
    blah("onrelease")
    }
    first_btn.onRollOver = function(){
    blah("rollover")
    }

    Like that?


    John

    --
    ----------------------------------------------------------------------------
    -----------
    RESOURCES
    [url]http://groups.google.com/advanced_group_search?hl=en&as_ugroup=*flash[/url]
    ----------------------------------------------------------------------------
    -----------
    TUTORIALS at
    [url]www.laiverd.com[/url]
    Flash & PHP Emailform
    Using textfiles in Flash
    ----------------------------------------------------------------------------
    -----------


    Laiverd.COM Guest

  3. #3

    Default Re: attaching "do-all" function to button

    you coud initiate a setInterval loop on(rollOver) that would poll for mouse presses etc and take appropriate action. clear your interval on(rollOut).
    kglad Guest

Similar Threads

  1. I don't see the "New function" button in RecordSet
    By newbiecf in forum Coldfusion - Getting Started
    Replies: 3
    Last Post: July 18th, 08:31 AM
  2. ListContains function sees "10" as "1"
    By blcott in forum Macromedia ColdFusion
    Replies: 1
    Last Post: May 1st, 12:26 PM
  3. Can actionscript change a "Button's" "Behavior"?
    By jay_architect webforumsuser@macromedia.com in forum Macromedia Flash Sitedesign
    Replies: 2
    Last Post: December 19th, 01:48 AM
  4. Replies: 0
    Last Post: July 16th, 06:07 AM
  5. Attaching "OnClick" Javascript code to dhtml popup menu links
    By yvangagnon webforumsuser@macromedia.com in forum Macromedia Fireworks
    Replies: 1
    Last Post: July 8th, 11:27 PM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139