A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Could someone take a look at this pseudocode snippet?

  1. #1
    Junior Member
    Join Date
    Aug 2001
    Posts
    11
    Hi folks. I'm a Flash newbie but I am adding some elements to our corporate website. The business is a cardiology clinic and the big-whigs want to display an animated heart button (among other things). Basically, they want to simulate a heartbeat on MouseOver.

    On the button instance panel, I have used the Swap Symbol button to replace my button on MouseOver with a slightly larger one. From there, I want the button to revert back to it's original state after pausing for a second, then back again after pausing 2 seconds, ad infinitum...as long as still in MouseOver.

    Here is my idea of some pseudocode:

    while (MouseOver) {
    //need code here to pause 1 sec, then...
    SwapSymbol ( BlueHeart );
    //need code here to pause 2 secs, then...
    SwapSymbol ( HeartBeat );
    }

    I also doubt that SwapSymbol is a relevant function call unless I define it. You guys are a wealth of knowledge and I appreciate any help you can give me. Thanks beforehand.

  2. #2
    Maya * ActionScript Addict DangerAhead's Avatar
    Join Date
    Jun 2000
    Location
    San Francisco
    Posts
    299

    K.I.S.S.

    No complex ActionScript needed here — K.I.S.S.

    why don't you:

    1. create a little beating heart MOVIE CLIP that loops — NO stop(); actions in it.

    2. Open up the button. add a layer with 4 key frames and place your new Heartbeating MC in FRAME2 (the "mouseOVER" frame) of your button. This way it will only be seen when moused over.

    that works.

  3. #3
    Senior Member
    Join Date
    Nov 2000
    Posts
    168
    Hey there, Welcome to Flashkit!

    Anyway what I would do is take those two images of the heart and put them in a seperate movie clip. Say put the smaller one on frame one through frame two and put a stop action on the first frame. Then put the larger image on fram three and keep it there as long as you like (how ever many frames you see fit) and on the last frame put a gotoAndPlay (2); action. This will loop it continuosly. Now you need to put that mc in the button. With your button on the main timeline now you can add your

    on (rollOver) {
    _root.imageClip.gotoAndPlay (2);
    }

    imageClip being whatever you named the instance of your movie clip.

    Please ask if you have questions

    -dan

  4. #4
    Senior Member
    Join Date
    Nov 2000
    Posts
    168
    the next one above works too!

  5. #5
    Junior Member
    Join Date
    Aug 2001
    Posts
    11

    Smile Great!

    Thx guys! I really appreciate it.

  6. #6
    Maya * ActionScript Addict DangerAhead's Avatar
    Join Date
    Jun 2000
    Location
    San Francisco
    Posts
    299

    choo got it man

    anytime. that's what FlashKit is for ... and stuff.

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