dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Mouse over to play movie clip

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

    Mouse over to play movie clip

    Truly basic question I know but I can't seem to find an answer elsewhere and you don't even want to know how long I've spent on this. I'm trying to create a button that plays a movie clip and stops when it's moused over. I've attached a file (help.fla) that illustrates my problem. I'm working in CS4 Flash (not sure if that's the same as MX04? Didn't see it on the pull down list) Your help would be more than appreciated! Thanks so much.
    Attached Files Attached Files

  2. #2
    Juvenile Delinquent CVO Chris's Avatar
    Join Date
    Jul 2002
    Location
    Ulster, UK
    Posts
    520
    You don't need to use gotoAndStop. Just stop(); will do. The following will stop the movieclip on rollover:

    PHP Code:
    blue_mc.buttonMode=true;
    blue_mc.addEventListener(MouseEvent.ROLL_OVERmcOverfalse0true);

    function 
    mcOver(e:MouseEvent):void {
        
    blue_mc.stop();

    If you want it to stop and then start again the next time it is rolled over you need to test to see if the movie is playing or not using an if statement.

    PHP Code:
    var mcplaying:Boolean true;
    blue_mc.buttonMode=true;
    blue_mc.addEventListener(MouseEvent.ROLL_OVERmcOverfalse0true);

    function 
    mcOver(e:MouseEvent):void {
        if (
    mcplaying == true) {
            
    blue_mc.stop();
            
    mcplaying false;
        } else { 
            
    blue_mc.play();
            
    mcplaying true;
        }

    Last edited by CVO Chris; 05-27-2010 at 02:47 PM.

Tags for this Thread

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