ステージ全体を上から下までカバーするナビゲーション項目を備えた Web サイトを開発しています (下の変更された画像を参照)。ユーザーがマウスでステージを終了するのは非常に簡単で、MouseEvent.MOUSE_OUT「オフにする」ために必要なイベントをトリガーしません。ナビアイテム。
Event.MOUSE_LEAVEマウスがステージを離れたことを検出し、有効なナビゲーション項目をオフにするために使用する必要がありますか? それが私がやろうとしていたことですが、リスナーからの出力を取得するのに問題がありました。何か案は?
代替テキスト http://marcysutton.com/blog/wp-content/uploads/2010/01/redpropeller.png
Flash IDE のムービークリップに関連付けられたクラスの場合、これはEvent.MOUSE_LEAVEリスナーを登録するための正しい構文ですか? 私が何をしても何もしないようです。イベントを発生させるためにブラウザにムービーを埋め込まなければならない場合はありますか?
this.stage.addEventListener(Event.MOUSE_LEAVE, mouseLeaveListener);
ここに私の MainNav.as クラスがあります:
package com.redpropeller {
import com.greensock.*;
import com.greensock.plugins.*;
import flash.display.*;
import flash.text.*;
import flash.events.*;
public class MainNav extends MovieClip { // MainNav is a movieclip in the IDE
    public var colors:Array;
    public function MainNav():void {
        colors = new Array(0xee3124, 0xc72a1f, 0xa62c24, 0x912923, 0x7e221c);
        TweenPlugin.activate([TintPlugin]);
        // trying to target stage through this object
        this.stage.addEventListener(Event.MOUSE_LEAVE, mouseLeaveListener);
        for(var i:Number=0; i<this.numChildren; i++){
            var n = this.getChildAt(i);
            n.useHandCursor = true;
            n.buttonMode = true;
            n.addEventListener(MouseEvent.MOUSE_OVER, navBtnOn);
            n.addEventListener(MouseEvent.MOUSE_OUT, navBtnOff);
        }
    }
    public function mouseLeaveListener(e:Event):void {
        trace('mouseleave'); // nothing ever happens
    }
    private function navBtnOn(e:MouseEvent):void {
        TweenLite.to(e.currentTarget.bar_mc, 0.01, {tint:0x333333});
    }
    private function navBtnOff(e:MouseEvent):void {
        TweenLite.to(e.currentTarget.bar_mc, 0.01,
            {tint:uint(colors[this.getChildIndex(MovieClip(e.currentTarget))])});
            // changes color back to specific tint
    }
}
}