A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: animated buttons question

  1. #1
    Junior Member
    Join Date
    Jul 2004
    Location
    Boston
    Posts
    6

    animated buttons question

    hi,
    i just joined this forum and have been enlighted by many of the threads i have been reading.

    unfortunatly i can't seem to find exactly what i am trying to do here explained in a way i can understand.

    what i have is a button, i made a movie clip instance inside of the down part of the button. what i want to have happen is when the button is pushed down the movie clip plays. i have gotten it to work but not to play by itself. to be slightly clearer, what i would like is a button that when it is pushed it plays the movie that i have inside of the down psrt of the button "it spinning around" i don't want it to have to be dependent on being 'down' to work. so if i could figure out how to program it to work on the mouse event of pushing the button down would be great.

    i am using flash mx, and any help would be more that appreciated!!

    you can view my "so far" at http://www.doublejdesign.com, this is my first attempts at flash.
    oh, dear god... why is this so hard? my brain hurts.

  2. #2
    Member
    Join Date
    Jul 2004
    Posts
    36
    put the animated movieclip in the up fram eof the button

    the first two frames of the movieclip are keyframes

    firstframe no actions

    second frame is

    Code:
    if (_root.wannabe!="god") {  
    gotoAndPlay(1);
    }
    third frame onwards is the movie (to loop better make the last frame

    Code:
    gotoAndPlay(3);
    the buttons actions are

    Code:
    on (release) {
    	_root.wannabe="god";
    }

  3. #3
    Junior Member
    Join Date
    Jul 2004
    Location
    Boston
    Posts
    6
    this is great, but what should the "wananbe" and god be replaced by in the code. i am really new at this and i really dont know. is "wannabe" your assumed name for a frame label or what. would this code work if i just dropped it in as is?

    if you could be just a little bit more explicit it would be great.

    sorry but i am reeeeaaaaalllyy new at this.
    oh, dear god... why is this so hard? my brain hurts.

  4. #4
    Member
    Join Date
    Jul 2004
    Posts
    36
    you can replace it with anything ya want ^_^

    it will work as it is, for on ebutton

    change wannabe to different variables on different buttons...

    EG:

    home button
    :
    on (release) {
    _root.playhome="yes";
    }

    and the movieclip would be
    if (_root.playhome!="yes") {
    gotoAndPlay(1);
    }


    and then on say "About button"

    about button
    :
    on (release) {
    _root.playabout="yes";
    }

    and the movieclip would be
    if (_root.playabout!="yes") {
    gotoAndPlay(1);
    }




    ----


    understand?

  5. #5
    Junior Member
    Join Date
    Jul 2004
    Location
    Boston
    Posts
    6
    oh also flash will not allow me to put any actions on a button up, over, down or hit. is that wrong ?
    oh, dear god... why is this so hard? my brain hurts.

  6. #6
    Member
    Join Date
    Jul 2004
    Posts
    36
    well of course.

    buttons use actionscript on the outside

    like

    on (release) {
    do your thing
    }

    --

    on (press) {
    do your thing
    }

    --

    on (rollover) {
    do your thing
    }

    --

    actions on the frames of a button would mess it up

  7. #7
    Junior Member
    Join Date
    Jul 2004
    Location
    Boston
    Posts
    6
    now i am totally confused. where exactly do i put them then?
    oh, dear god... why is this so hard? my brain hurts.

  8. #8
    Member
    Join Date
    Jul 2004
    Posts
    36
    on the outside, wherever you out the button

    click the button once, not twice

  9. #9
    Senior Member green_eye's Avatar
    Join Date
    Apr 2004
    Location
    Sarasota, Florida
    Posts
    1,496
    the link is broken
    do you want a btn to controll a movie clip
    Did you create a btn and put a movie clip in the over state and you want to hit the btn only once and it loops

    make your btn into a movie clip and then when over play animation when click do something else onRollOut do something else
    It is more than a btn because a btn cannot have rollOver/rollOut animations

  10. #10
    Junior Member
    Join Date
    Jul 2004
    Location
    Boston
    Posts
    6
    alright, to re-re-explain. hopefully clearer this time (do my explanations show how little i know? - HAHA!)

    i have designed a button that has an animation under the down section. the way that i did this was to turn the part i wanted to animate into a movie clip and then animate it.

    i would like the button to have this movie clip auto play after it is clicked.

    as it stands right now i have it working just fine AS LONG AS I HOLD THE MOUSE DOWN, what i would like to have happen is after one click it runs the animation.

    would _wannabees_ above advice be the way to do this? would any one mind giving me a slightly dumbed down tutorial?

    i understand how to add action script to the timeline but i am not sure where to put it. if you are adding 'script to a button how does this get performed as you can't add it to the (up,over,down or hit) frames.

    also last question (for now at least hahaha) where should i put the movie instance and where should i put the code to trigger it.

    thanks for any and all help!! and thanks for the above information as well. i just wish i understood it.

    thanks!!
    oh, dear god... why is this so hard? my brain hurts.

  11. #11
    Member
    Join Date
    Jul 2004
    Posts
    36
    here i made a thing for you, very simple stuff
    Attached Files Attached Files

  12. #12
    Junior Member
    Join Date
    Jul 2004
    Location
    Boston
    Posts
    6
    like sunshine on a mountain i think it just dawned on me what you have been saying wannabee, it will have to wait until i get home to check, as i am at work, but please oh please let my ignorance have passed. this has been driving me batso for a week.

    would it also be possible for me to not make a button instance but put all of this information into the main movie. i.e. on roll over do 'x' on press do 'y'? and if so.... why the hell didn't i think of that a week ago??? (yes, that was retorical)
    oh, dear god... why is this so hard? my brain hurts.

  13. #13
    Member
    Join Date
    Jul 2004
    Posts
    36
    Originally posted by theprescription
    ...would it also be possible for me to not make a button instance but put all of this information into the main movie. i.e. on roll over do 'x' on press do 'y'?
    ... thats what a button is for ...

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