A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: [RESOLVED] Stage.addEventListener() Not Working Right?

Hybrid View

  1. #1
    Junior Member
    Join Date
    Jan 2010
    Posts
    2

    resolved [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});
    }

  2. #2
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    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(00);
    graphics.drawRect(00stage.stageWidthstage.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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center