A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: MOUSE_OVER and MOUSE_OUT.. help needed

  1. #1
    Junior Member
    Join Date
    Mar 2008
    Posts
    25

    MOUSE_OVER and MOUSE_OUT.. help needed

    Hello there

    I need a little help with the MOUSE_OVER and MOUSE_OUT commands.

    Basically ive got a little part of a site ive made in flash where i want to roll over a section and out pops a side bar, i then want it to disappear again when the mouse leaves the side bar...

    Ive set up within the 1 movie clip 2 sections (the opening of the bar and the closing of the bar) with stop(); tags at the end of each sequence to stop them running into eachother.

    So for example its setup like this:

    PHP Code:
    this.buttonMode true;

    this.addEventListener(MouseEvent.MOUSE_OVER,function():void {
    gotoAndPlay("open")
    }
    );

    this.addEventListener(MouseEvent.MOUSE_OUT,function():void {
    gotoAndPlay("close")
    }
    ); 
    The problem is that obviously everytime the mouse goes over the section (this.) it then resets itself back to the beggining of the "open" sequence.

    I need it to open when the mouse goes over it and stay open until the mouse leaves the movie clip again.

    Please help!!

  2. #2
    Member
    Join Date
    May 2005
    Location
    San Francisco
    Posts
    55
    I'm having a similar issue where i have a navbar with a bunch of buttons placed on top of a background. I want the background to face to opaque when moused over, and to transparent when ROLL_OUT, but when i mouse over each button it triggers the animation to cycle again.

    Here's my code:

    PHP Code:
    package {

        
    import flash.display.*;
        
    import flash.net.*;
        
    import flash.events.*;
        
    import flash.text.*;
        
    import fl.transitions.Tween;
        
    import fl.transitions.easing.*;
        
    import fl.transitions.TweenEvent;



        public class 
    Mitch extends MovieClip {

            public var 
    Stat:Boolean false;


            
    // create a new LocalConnection instance used to send
            // calls to a LocalConnection instance in another movie
            
    var outgoing_lc:LocalConnection = new LocalConnection();

            public function 
    Mitch() {

                
    slug.addEventListener(MouseEvent.ROLL_OVERmyOver);
                
    slug.addEventListener(MouseEvent.ROLL_OUTmyOff);
                
    slug.addEventListener(MouseEvent.CLICKmyTrace);

                
    residents.addEventListener(MouseEvent.ROLL_OVERmyOver);
                
    residents.addEventListener(MouseEvent.ROLL_OUTmyOff);
                
    residents.addEventListener(MouseEvent.CLICKlinkResident);

                
    residents.buttonMode true;

                
    business.addEventListener(MouseEvent.ROLL_OVERmyOver);
                
    business.addEventListener(MouseEvent.ROLL_OUTmyOff);
                
    business.addEventListener(MouseEvent.CLICKlinkBusiness);
                
    business.buttonMode true;

                
    government.addEventListener(MouseEvent.ROLL_OVERmyOver);
                
    government.addEventListener(MouseEvent.ROLL_OUTmyOff);
                
    government.addEventListener(MouseEvent.CLICKlinkGovernment);
                
    government.buttonMode true;

                
    visitors.addEventListener(MouseEvent.ROLL_OVERmyOver);
                
    visitors.addEventListener(MouseEvent.ROLL_OUTmyOff);
                
    visitors.addEventListener(MouseEvent.CLICKlinkVisitors);
                
    visitors.buttonMode true;

                
    online.addEventListener(MouseEvent.ROLL_OVERmyOver);
                
    online.addEventListener(MouseEvent.ROLL_OUTmyOff);
                
    online.addEventListener(MouseEvent.CLICKlinkOnline);
                
    online.buttonMode true;

                
    help.addEventListener(MouseEvent.ROLL_OVERmyOver);
                
    help.addEventListener(MouseEvent.ROLL_OUTmyOff);
                
    help.addEventListener(MouseEvent.CLICKlinkHelp);
                
    help.buttonMode true;

                
    textv.addEventListener(MouseEvent.ROLL_OVERmyOver);
                
    textv.addEventListener(MouseEvent.ROLL_OUTmyOff);
                
    textv.addEventListener(MouseEvent.CLICKloadError);
                
    textv.buttonMode true;

            }

            function 
    myTrace(event:MouseEvent):void {
                
    trace("Home --> Click");
            }
            function 
    myOver(e:MouseEvent):void {
                
    trace(bg.cover_mc.alpha);
                if (
    bg.cover_mc.alpha <= .5) {
                    var 
    myTween:Tween = new Tween(bg.cover_mc"alpha"Strong.easeIn01.5true);

                }
            }
            function 
    myOff(e:MouseEvent):void {
                
    trace(bg.cover_mc.alpha);
                var 
    myTween:Tween = new Tween(bg.cover_mc"alpha"Strong.easeIn10.5true);

            }
            function 
    listRollOver(e:ListEvent):void {
                
    trace("You rolled over " e.item.label);
            }
            function 
    link(event:MouseEvent):void {
                
    trace("Home --> limk");
                
    outgoing_lc.send("Channel""link");
            }
            function 
    linkResident(event:MouseEvent):void {
                
    trace("Home --> linkResident");
                
    outgoing_lc.send("Channel""linkResident");
            }
            function 
    linkBusiness(event:MouseEvent):void {
                
    trace("Home --> linkBusiness");
                
    outgoing_lc.send("Channel""linkBusiness");
            }
            function 
    linkGovernment(event:MouseEvent):void {
                
    trace("Home --> linkGovernment");
                
    outgoing_lc.send("Channel""linkGovernment");
            }
            function 
    linkVisitors(event:MouseEvent):void {
                
    trace("Home --> linkVisitors");
                
    outgoing_lc.send("Channel""linkVisitors");
            }
            function 
    linkOnline(event:MouseEvent):void {
                
    trace("Home --> linkOnline");
                
    outgoing_lc.send("Channel""linkOnline");
            }
            function 
    linkHelp(event:MouseEvent):void {
                
    trace("Home --> linkHelp");
                
    outgoing_lc.send("Channel""linkHelp");
            }
            function 
    linkTextv(event:MouseEvent):void {
                
    trace("Home --> linkText");
                
    outgoing_lc.send("Channel""linkText");
            }
            function 
    loadError(event:MouseEvent):void {
                
    trace("Home --> Error");
                
    outgoing_lc.send("Channel""myError");
            }
        }


  3. #3
    Junior Member
    Join Date
    Apr 2008
    Posts
    3
    chosendesigns:

    Try This: currently your script reads:

    gotoAndPlay("open")

    change this to

    open.gotoAndPlay(1)

    IMPORTANT: Also make sure you have changed the instance name of the movie clip to "open".

  4. #4
    Junior Member
    Join Date
    Mar 2008
    Posts
    25
    the "open" and "close" parts are frame labels within the movieclip not movie clips.. so the "open" label runs from frame 2-10 say and "close" from 11-19.

    It will still give me the same problem..

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