鼠标悬停在整个舞台? [英] Mouse Over in whole Stage?

查看:182
本文介绍了鼠标悬停在整个舞台?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要当一个用户都有自己的鼠标在我的闪存阶段运行ActionScript函数。 不要在舞台上的特定按钮/图像只是在舞台上。 但是,试图用鼠标动作在舞台上时,我得到这个消息: 此操作需要一个目的是要在舞台上选择。

I want to run an Actionscript function when a user has his mouse in my flash stage. Not in a specific button/image on the stage but just in the stage. But when trying to use mouse over action on stage i get this message: "This action requires an object to be selected on stage."

那么,我该如何使用鼠标悬停在整个舞台?

So, how can i use mouse over in the whole stage?

推荐答案

在AS3中有一个事件时,鼠标离开舞台,所以你可以做这样的事情来得到,如果用户的鼠标在舞台上的。

In AS3 there's an event for when mouse leaves the stage so you could do something like this to get if the users mouse is in the stage.


var _mouseOnStage : Boolean = true;

stage.addEventListener(MouseEvent.MOUSE_LEAVE, onMouseLeave);
stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);

function onMouseLeave(e:MouseEvent) : void {
    _mouseOnStage = false;
}

function onMouseMove(e:MouseEvent):void{
    _mouseOnStage = true;
}

这篇关于鼠标悬停在整个舞台?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆