A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: Movie clip button acting out

  1. #1
    Junior Member
    Join Date
    May 2007
    Posts
    24

    Unhappy Movie clip button acting out

    My movie clip button isn't acting like a button and it's looping even though I have a stop on it's timeline. Here is my code:

    about_mc.buttonMode = true;
    about_mc.addEventListener(MouseEvent.Mouse_Over, aboutClick);
    function aboutClick(e:MouseEvent.MOUSE_OVER):void { trace("aboutClick"); }

    I get an error message of:
    1046: Type was not found or was not a compile-time constant: MOUSE_OVER.
    Attached Files Attached Files

  2. #2
    Senior Member
    Join Date
    May 2010
    Location
    Russia: Western Siberia
    Posts
    268
    That's because you call it the wrong way. That's what you do:
    Actionscript Code:
    function aboutClick(e:MouseEvent.MOUSE_OVER):void { trace("aboutClick"); }

    And that's how it should be:
    Actionscript Code:
    function aboutClick(e:MouseEvent):void { trace("aboutClick"); }

    You don't have to add "MOUSE_OVER" to a function data type


    The second thing is:

    about_mc.addEventListener(MouseEvent.Mouse_Over, aboutClick);

    but you have to type it this way:


    about_mc.addEventListener(MouseEvent.MOUSE_OVER, aboutClick);

    // note MOUSE_OVER is all caps
    Last edited by caseyryan; 05-25-2010 at 05:39 AM.

  3. #3
    Junior Member
    Join Date
    May 2007
    Posts
    24

    Movie clip acting out

    Thank you! Why does the mc run without any mouse over movement though? I'd like the action to occur only when it's moused over.

    Thanks again.

  4. #4
    Senior Member
    Join Date
    May 2010
    Location
    Russia: Western Siberia
    Posts
    268
    You're welcome

    Why does the mc run without any mouse over movement though?
    Have you applied a stop(); method to its first frame properly?
    Just check it out again, maybe you have a typo somewhere. The function call must be exactly like this: stop(); with parenthesis

  5. #5
    Junior Member
    Join Date
    May 2007
    Posts
    24
    With a stop in the first frame of my mc the button/mc doesn't play. Attached is my .fla. Would love it if you could check it out.

    Thanks again!
    Attached Files Attached Files

  6. #6
    Senior Member
    Join Date
    May 2010
    Location
    Russia: Western Siberia
    Posts
    268
    It must not play. You did not apply a gotoAndPlay(); method to it

    Actually you have to do this and then add a stop(); method also to the last frame of your movie clip.
    I've done it now, check it out.

    BTW Pretty creative work, I liked the way you've designed this movie clip
    Attached Files Attached Files

  7. #7
    Junior Member
    Join Date
    May 2007
    Posts
    24
    You are the very best! Thanks so much.

    I've added a few more tweaks to it and have another question. I'd like three things to happen. MC plays "fade on" when there is a mouse over. Then MC plays "fade off" when you roll off. When clicked, it'll move to the next label (not designed yet). But, my issue is, again w/ the mc not stopping at the correct place. I've got looping issues.

    Where is my code wrong? New file attached.

    Again, I really really appreciate your help. I've been trying to get this working for seriously weeks.
    Attached Files Attached Files

  8. #8
    Junior Member
    Join Date
    May 2007
    Posts
    24
    I just noticed that it works fine the first time, but if you try to roll over it again, the playhead doesn't go back to the beginning. How can I fix that?

  9. #9
    Junior Member
    Join Date
    May 2007
    Posts
    24
    Well, I've made some progress on my own, but I've still got a few questions.

    1. I've got the button working now, but only because I used the frame number vs my frame label at .gotoAndPlay. When I put the frame label in the mc jumps to only that frame and doesn't "play" the mc. Any idea on why that is?

    2. My mc animates nicely unless it's clicked on one of the moving parts, then it gets jumpy and jerky. Is there a way I can make the entire animation fluid instead of only the non-moving parts?

    Again, I've uploaded my file in case my explanation is hard to understand.

    Thanks to anyone checking it out!
    Attached Files Attached Files

  10. #10
    Senior Member
    Join Date
    May 2010
    Location
    Russia: Western Siberia
    Posts
    268
    Well, you can't just fix this problem. In order to fix it you have to convert all of your dots to movie clips, give them all instance names and then, in your code, set all of them not to be mouse children like so: dot_mc.mouseChildren = false;
    It's far not the best desicion, so it would be better if you just put all of your dots in a another movie clip than the word "about". The "about" itself put above that movie clip just changing it's alpha property.
    that's what I mean:

    Actionscript Code:
    var tweenAboutAlpha:Tween;
    about_mc.alpha = 0;

    about_mc.addEventListener(MouseEvent.MOUSE_OVER, tweenAlpha);

    function tweenAlpha(e:MouseEvent):void
    {
        // this line of code will show your about button when you roll over it with a mouse
        tweenAboutAlpha = Tween(about_mc, "alpha", Regular.easeOut, 0, 1, 1, true);
        // and this one will play the animation of your dots, that are located under the about button
       dots_mc.gotoAndPlay(2);
    }
    Something like this. Just play around with that

  11. #11
    Junior Member
    Join Date
    May 2007
    Posts
    24
    Thanks for the info. I'll get playing with it and see if I can make it happen. I really appreciate your help. Thanks a million!

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