-
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!!
-
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_OVER, myOver); slug.addEventListener(MouseEvent.ROLL_OUT, myOff); slug.addEventListener(MouseEvent.CLICK, myTrace);
residents.addEventListener(MouseEvent.ROLL_OVER, myOver); residents.addEventListener(MouseEvent.ROLL_OUT, myOff); residents.addEventListener(MouseEvent.CLICK, linkResident);
residents.buttonMode = true;
business.addEventListener(MouseEvent.ROLL_OVER, myOver); business.addEventListener(MouseEvent.ROLL_OUT, myOff); business.addEventListener(MouseEvent.CLICK, linkBusiness); business.buttonMode = true;
government.addEventListener(MouseEvent.ROLL_OVER, myOver); government.addEventListener(MouseEvent.ROLL_OUT, myOff); government.addEventListener(MouseEvent.CLICK, linkGovernment); government.buttonMode = true;
visitors.addEventListener(MouseEvent.ROLL_OVER, myOver); visitors.addEventListener(MouseEvent.ROLL_OUT, myOff); visitors.addEventListener(MouseEvent.CLICK, linkVisitors); visitors.buttonMode = true;
online.addEventListener(MouseEvent.ROLL_OVER, myOver); online.addEventListener(MouseEvent.ROLL_OUT, myOff); online.addEventListener(MouseEvent.CLICK, linkOnline); online.buttonMode = true;
help.addEventListener(MouseEvent.ROLL_OVER, myOver); help.addEventListener(MouseEvent.ROLL_OUT, myOff); help.addEventListener(MouseEvent.CLICK, linkHelp); help.buttonMode = true;
textv.addEventListener(MouseEvent.ROLL_OVER, myOver); textv.addEventListener(MouseEvent.ROLL_OUT, myOff); textv.addEventListener(MouseEvent.CLICK, loadError); 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.easeIn, 0, 1, .5, true);
} } function myOff(e:MouseEvent):void { trace(bg.cover_mc.alpha); var myTween:Tween = new Tween(bg.cover_mc, "alpha", Strong.easeIn, 1, 0, .5, true);
} 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"); } } }
-
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".
-
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|