Results 1 to 9 of 9

Thread: [Flash] Button Click loads Frame 2 [Resolved]

  1. #1
    ASP.NET Moderator mendhak's Avatar
    Join Date
    Feb 02
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,174

    Resolved [Flash] Button Click loads Frame 2 [Resolved]

    I'll have to explain this one. I've attached a diagram with this post.

    Scene 1 contains two movie clips which I have named BMC1 and CAMC1.

    BMC1 plays when the movie loads, but CAMC1 is on hold.

    WHen BMC1 finishes playing, there will be buttons there. All I'd like to do is to click on a button and make CAMC1 move to it's second frame.

    In BMC1's button's action, I did this:

    Code:
    on (release) {
        tellTarget ("_root.CAMC1") {
            gotoAndPlay (2);
        }
    }
    Here's what happens

    The movie clip CAMC1 will play as normal and go to Frame 2
    When I click the same button again,
    CAMC1 goes back to it's frame 1
    When I click again
    CAMC1 goes to frame 2.

    This occurs, even though I've placed Stop Actions on top of each frame in CAMC1.

    I know this is a little long winded, but any hints or directions would be good.


    *sigh*

    Last edited by mendhak; Nov 10th, 2004 at 11:48 PM.

  2. #2
    ASP.NET Moderator mendhak's Avatar
    Join Date
    Feb 02
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,174
    Here's the diagram

    I made it with my superior graphics skills.
    Attached Images Attached Images  

  3. #3
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 03
    Location
    USA, Maryland
    Posts
    4,981
    How many frames exist in the second movie clip?

  4. #4
    ASP.NET Moderator mendhak's Avatar
    Join Date
    Feb 02
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,174
    Exactly 2.

    Frame 1 is blank.
    Frame 2 is not blank.

  5. #5
    ASP.NET Moderator mendhak's Avatar
    Join Date
    Feb 02
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,174
    OK, here's a very very very simpe flash FLA file that demonstrates the problem:

    The "box" is MovieClip1, the "blob" is MovieClip2.

    Wait for box to finish moving. Then click on it. MC2 goes to frame 2. Click again, it goes to frame 1.

    The action in the button is:

    Code:
    on (release) {
        tellTarget ("_root.BLOB1") {
            gotoAndPlay (2);
        }
    }
    Attached Files Attached Files

  6. #6
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 03
    Location
    USA, Maryland
    Posts
    4,981
    It's because the second movie clip has two frames. When you reach the end of a flash movie/movie clip, even if you have a stop() on the frame, if you try to move on then it'll go back to the beginning. I'm pretty sure this is your problem since you're trying to play a frame you're already on so it just continues the movie.

    I would suggest checking which frame movie clip 2 is on and if it's on 2, then do nothing.

  7. #7
    ASP.NET Moderator mendhak's Avatar
    Join Date
    Feb 02
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,174
    Kas, based upon what you told me, I thought I'd experiment a bit, and this is what I ended up doing

    In MC2, I added a blank keyframe just before the second frame.

    I've uploaded the same example, slightly modified. It's what I'm looking for.

    Now I'd only like to know whether this is acceptable Flash practice (if there is such a term)


    Thanks kaz
    Attached Files Attached Files

  8. #8
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 03
    Location
    USA, Maryland
    Posts
    4,981
    There isn't really an acceptable flash practice. I would have used some checking with variables but as long as you reach your desired result with minimal overhead, I see nothing wrong with it.

  9. #9
    ASP.NET Moderator mendhak's Avatar
    Join Date
    Feb 02
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,174
    Alright. Thanks again, I'll be back for more.

Posting Permissions

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