zoukankan      html  css  js  c++  java
  • flash跟随鼠标样式

    package {
        import flash.display.Sprite;
        import flash.ui.Mouse;
        import flash.events.MouseEvent;
        import flash.events.Event;
        import flash.display.Shape;
        
    
        
        public class FollowMouse extends Sprite {
            
            private var _icon : Shape; //鼠标样式
            private var box : Sprite; //被点击的对像
            
            
            public function FollowMouse() {
                //鼠标样式不能为可接收事件对像,否则无法点击其它对像
                _icon = new Shape();
                _icon.graphics.beginFill(0xff0000);
                _icon.graphics.drawCircle(0, 0, 20);
                _icon.graphics.endFill();
                _icon.name = "mouse icon";
                
                this.stage.addChild(_icon);
                _icon.x = stage.stageWidth / 2 - _icon.width / 2;
                _icon.y = stage.stageHeight / 2 - _icon.height / 2;
                Mouse.hide();
                
                stage.addEventListener(MouseEvent.MOUSE_MOVE, onMove);
                
                box = new Sprite();
                box.graphics.beginFill(0x000000);
                box.graphics.drawRect(0, 0, 100, 100);
                box.graphics.endFill();
                addChild(box);
                box.addEventListener(MouseEvent.CLICK, boxClick);
                //_icon.addEventListener(MouseEvent.CLICK, iconClick);
                
            }
            
            private function iconClick(e : MouseEvent) : void {
                trace(".....................");
            }
            
            private function boxClick(e : MouseEvent) : void {
                box.visible = false;
            }
            
            private function onMove(e : MouseEvent) : void {
                _icon.x = mouseX;
                _icon.y = mouseY;
            }
        }
    }
  • 相关阅读:
    测光
    闪光灯
    快门
    光圈
    白加黑减
    曝光补偿
    取景雷区
    着眼点
    Web中的无状态含义
    图计算模型[转]
  • 原文地址:https://www.cnblogs.com/playerlife/p/2727430.html
Copyright © 2011-2022 走看看