zoukankan      html  css  js  c++  java
  • 【代码片段】ActionScript3.0 鼠标滑过水波波动

    package {
        import be.nascom.flash.graphics.Rippler;
        
        import flash.display.Bitmap;
        import flash.display.Sprite;
        import flash.display.StageAlign;
        import flash.display.StageScaleMode;
        import flash.events.MouseEvent;
    
        [SWF(backgroundColor="0x000000", frameRate="30", width="425", height="282")]
        public class Ripple extends Sprite
        {
        	// Embed an image (Flex Builder only, use library in Flash Authoring)
            [Embed(source="images/2.jpg")]
            private var _sourceImage : Class;
            
            private var _target : Bitmap;
            private var _rippler : Rippler;
            
            public function Ripple()
            {
                stage.scaleMode = StageScaleMode.NO_SCALE;
                stage.align = StageAlign.TOP_LEFT;
                
                // create a Bitmap displayobject and add it to the stage 
                _target = new Bitmap(new _sourceImage().bitmapData);
                addChild(_target);
                
                // create the Rippler instance to affect the Bitmap object
                _rippler = new Rippler(_target, 60, 6);
                
                // create the event listener for mouse movements
                stage.addEventListener(MouseEvent.MOUSE_MOVE, handleMouseMove);
            }
            
            // creates a ripple at mouse coordinates on mouse movement
            private function handleMouseMove(event : MouseEvent) : void
            {
            	// the ripple point of impact is size 20 and has alpha 1
                _rippler.drawRipple(_target.mouseX, _target.mouseY, 20, 1);
            }
        }
    }
    

     注意事项:同目录下文件:Ripple.as(主要的代码都在里面)、Ripple.fla和Ripple.as(自己新建个文件导出下,注意文件名要相同)、images文件夹、be文件夹(存放Rippler.as第三方类库)

  • 相关阅读:
    DAO模式多表联查
    使用ADO.NET访问数据库
    连接查询和分组查询
    模糊查询和聚合函数
    poj 1220 NUMBER BASE CONVERSION
    poj 1964 City Game
    Odd number problem
    POJ 2983 M × N Puzzle
    L O V E
    【Mybatis】【3】处理大于号小于号及其他特殊字符
  • 原文地址:https://www.cnblogs.com/kojya/p/2514055.html
Copyright © 2011-2022 走看看