A Flash Developer Resource Site

Results 1 to 16 of 16

Thread: Simple Button Eludes Me

  1. #1
    FK's Resident Jakey
    Join Date
    Apr 2002
    Location
    Hamilton, Scotland
    Posts
    55

    Simple Button Eludes Me

    I have created a simple (very simple) flash site where there is 1 keyframe, and many tellTarget's for movies. However, i have one button which i want to click to start a tellTarget, and then click the same button again to use the same tellTarget, just to a different frame in the same movieclip.

    Problem: How can i use the same button, using the same onPress function, and still have 2 different functions working.

    Press button > Movie Plays > Press same button > Different Movie Plays.


    im not sure if this is an actionscript question.

    thanks for any help.

    if you want to know what i mean. http://www.geocities.com/stonelionband/temp/home.html
    i want the menu button to bring down, and take away the buttons.
    thanks again

  2. #2
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    What happens after the second press? Another press sends it back to the first targeted frame of that same movie clip?

  3. #3
    When do I get the little pics?
    Join Date
    Jul 2003
    Location
    Toronto, ON Canada! I AM CANADIAN
    Posts
    97
    Seperate the two different instances of the button using keyframes and simply adding an instance name to each of the movie clips ( a different name ) and simply add a...

    gotoandplay(NewInstanceKeyframe);

    Becuase you can apply a completely different set of actions to a different instance within the main timeline. Meaning that each instance's actions are mutually exclusive... or at least that's how I have found it to be...

    Add that action to the first function to make them switch... ONCE.

    However, if you want them to switch back and forth... it's a different set of instructions entirely...

    you could use an if statement that defines where the movie is with respect to the frame location the property "_currentFrame" would definately come in handy... you would also have label the frames... it would make the function easier to read for you... otherwise you could just use numbers...

    Regards,
    Last edited by 1beb; 08-23-2003 at 08:52 PM.
    Bertelsen
    1beb ²ºº³
    mrbertelsen AT hotmail DOT com

  4. #4
    FK's Resident Jakey
    Join Date
    Apr 2002
    Location
    Hamilton, Scotland
    Posts
    55

    RE: what happens next?

    after pressing the button, the tellTarget tells it to play a part of a movieclip, but the button remains in place. so the next click will do exactly the same as the first. so the same part always plays after clicking the button.

    thanks for the help guys.

  5. #5
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    You wanna try that again?

    One button, first press, using tellTarget or whatever, tells one movie clip to go play one frame, right?
    Second press of this same button, using tellTarget or whatever, tells the same movie clip as the first press to go to another frame, different from the first time, also right?

    What happens on the third press?

  6. #6
    FK's Resident Jakey
    Join Date
    Apr 2002
    Location
    Hamilton, Scotland
    Posts
    55

    RE:RE........what happens next?

    ok your confusing me and i made the thing!!!

    right here goes:

    first click > tellTarget (plays frames 2-66 of a movieclip)
    then stops.

    second click > tellTarget (plays frames 2-66 of a movieclip)
    then stops.

    the code doesn't actually say that(see below)

    but the movie plays below the button, so the button never actually changes. it keeps the same code, so will do the same thing.

    any good
    thanks again.

    on (press) {
    tellTarget ("/menu_button_lines") {
    gotoAndPlay(2);
    }
    }

  7. #7
    FK's Resident Jakey
    Join Date
    Apr 2002
    Location
    Hamilton, Scotland
    Posts
    55

    ...

    regardless of how many times i click the button, the same code is executed, and therefore the same thing happens. the same part of the movie plays.

  8. #8
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    If you think you're confused... What about me!

    This is your original question...

    ...i have one button which i want to click to start a tellTarget, and then click the same button again to use the same tellTarget, just to a different frame in the same movieclip.
    To me that says the first press of a button plays some frame in a movie clip, and then a second press of that same button plays another part of the same movie clip.

    But in your last post, you say each press plays frames 2 to 66... To me that's not a different serie of frames?

  9. #9
    FK's Resident Jakey
    Join Date
    Apr 2002
    Location
    Hamilton, Scotland
    Posts
    55

    ok, im going to start again...

    the quote, which im actually quite impressed i made so little sense, was what i wanted to do.

    i want the button to use a tellTarget and play frames 2-66 on the first click,
    then on the second click, use the same tellTarget, but with a different gotoAndPlay number, 67-'end'

    the problem is, there is no change after the first click. so the same code is executed every time the button is clicked.

    check it out here, it's the menu button up the top left http://www.geocities.com/stonelionband/temp/home.html

    i hope this makes sense soon, otherwise it's back to the drawing board for a timeline with 2 frame length.

    thanks again, you're doing a wonderfull job
    with all this help, ever consider becoming a moderator (hint hint)

  10. #10
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Now that we cleared that up, what would happen on a third press?

    And when you say movie clip, are you talking about the animation inside the button itself or what? None of your buttons in that menu calls anything as it is now?

  11. #11
    FK's Resident Jakey
    Join Date
    Apr 2002
    Location
    Hamilton, Scotland
    Posts
    55
    wwooooooooo, this is gettin tricky.
    none of the other buttons work, correct. the whole thing is just a shell at the moment, they will eventually call up different text into a text box or something in the middle.

    on a third press, the same code is executed, as the same button stays where it is. you are always pressing the same button, with the same code, doing the same thing. no matter how many times you press it. it goes and plays part of a movie clip (frames 2-66). i want that same button to do something like:
    press once > plays 2-66 of movieclipALPHA
    press twice> plays 67-end of movieclipALPHA
    press third> plays 2-66 of movieclipALPHA
    press fourth> plays 67-end of movieclipALPHA
    press fifth> plays 2-66 of movieclipALPHA
    press sixth> plays 67-end of movieclipALPHA
    press seventh> plays 2-66 of movieclipALPHA
    see?

    i just want the user to click the button, the lines to appear, and then to be able to click the same button the second time, but the lines to disappear. and go right back to the beggining as if they were about to click for the first time.

    i do hope this makes sense soon, as i have a sore head thinking about it this hard.

    thanks for your continuing efforts

  12. #12
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    That's what I was assuming from the start! If you had only understood it! You're in fact looking for a toggle button script!
    Let me create a simple example... You only have to use a variable, and check it within the button's script, to see if it should be playing the first set of frames or the second... Be back in a while!

  13. #13
    FK's Resident Jakey
    Join Date
    Apr 2002
    Location
    Hamilton, Scotland
    Posts
    55
    well as it's coming up on 4am, im off to bed.

    but i'll be on tomorrow for more of your wonderfull help.

    thanks for all the advice, and sorry if your head is starting to hurt from it all as well.


    thanks, and bye for now

  14. #14
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    OH! Across the big pond are you?

    Nighty!

  15. #15
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Here!
    Attached Files Attached Files

  16. #16
    FK's Resident Jakey
    Join Date
    Apr 2002
    Location
    Hamilton, Scotland
    Posts
    55
    yes im from scotland. land of haggis and irn bru.

    im sure the word oldnewbie has some relation to the word genius.

    that fla. you gave me worked a treat!!

    once again, thank you for all your hard work in solving this, rather trivial, yet most outrageously annoying problem. im sure i'll have many more in the days to come.

    thanks.

    atocp

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