闪烁-仅当用户尚未观看影片时才显示正在加载的消息

问题描述

| 我有一个Flash电影,它在首次加载时向用户显示一条消息。当用户的鼠标进入舞台或移动鼠标时,消息消失。但是,如果用户的鼠标在页面加载时的Flash电影上移动,我想隐藏该消息。这可能吗?还是需要首先进行交互? 谢谢     

解决方法

您可以创建一个Rectangle对象,其值与舞台的
x
y
width
height
相同。然后,创建一个条件(if语句),以检查启动应用程序时
Rectangle
对象是否包含阶段的
mouseX
mouseY
值。以下是对此的简单测试:
package 
{
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.geom.Rectangle;
    import flash.text.TextField;

    public class Main extends Sprite 
    {

        public function Main():void 
        {
            if (stage) init();
            else addEventListener(Event.ADDED_TO_STAGE,init);

        }// end function

        private function init(e:Event = null):void 
        {
            removeEventListener(Event.ADDED_TO_STAGE,init);

            var textField:TextField = new TextField();
            addChild(textField);

            var stageRect:Rectangle = new Rectangle(stage.x,stage.y,stage.stageWidth,stage.stageHeight);

            if (stageRect.contains(stage.mouseX,stage.mouseY))
            {
                textField.text = \"mouse is inside stage upon initiation\";

            }
            else
            {
                textField.text = \"mouse is outside stage upon initiation\";

            }// end if

        }// end function

    }// end class

}// end package
    

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...