-
[RESOLVED] Stage.addEventListener() Not Working Right?
I created an FLA file that has a control bar (with play, pause, etc.) that I want to appear only when the mouse is moved onto the stage. When the mouse is moved off the stage, I want it to fade.
I used the code below but it seems that the MOUSE_OVER event is only captured when the mouse is moved over some object on the stage. When the mouse is over an unused part of the stage, the event is not fired and the control bar remains invisible.
Any help would be appreciated.
I'm working in Adobe CS3/AS3. I'm an experienced programmer but new to AS3.
barBg_mc is the name of the control bar in the code below.
Code:
import caurina.transitions.*;
stage.addEventListener(MouseEvent.MOUSE_OVER, event_ControlBar_Show);
stage.addEventListener(MouseEvent.MOUSE_OUT, event_ControlBar_Hide);
function event_ControlBar_Show(e:MouseEvent) {
Tweener.addTween(barBg_mc, {alpha:1, time:1});
}
function event_ControlBar_Hide(e:MouseEvent) {
Tweener.addTween(barBg_mc, {alpha:0, time:1});
}
-
Try listening for Event.MOUSE_LEAVE and MouseEvent.MOUSE_MOVE - if you're still getting the same behavior, draw a clear shape into your stage:
PHP Code:
graphics.beginFill(0, 0);
graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeigth);
You may also want to utilize Event.ACTIVATE and Event.DEACTIVATE.
Please use [php] or [code] tags, and mark your threads resolved 8)
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
|