博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
2012、10、05 听课笔记
阅读量:5051 次
发布时间:2019-06-12

本文共 2591 字,大约阅读时间需要 8 分钟。

                                                              擦窗户制作

package{

              import flash.display.Sprite;

              import flash.display.Loader;

              import flash.net.URLRequest;
              import flash.events.Event;
              import flash.filters.BlurFilter;
              import flash.display.Bitmap;
              import flash.events.MouseEvent;
              import flash.display.Shape;
 
 public class Main extends Sprite
 {
                  private var _pic:Loader;
                  private var bit:Bitmap;
                  private var zhezhao:Sprite;
                  private var bo:Boolean = false;
    public function Main():void
  {
   init();
  }
  private function init():void
  {
        _pic = new Loader();
        _pic.contentLoaderInfo.addEventListener(Event.COMPLETE,loadok);
        _pic.load(new URLRequest('a.jpg'));
  }
  private function loadok(evt:Event):void
  {
         addChild(_pic);
         bit = new Bitmap(evt.target.loader.content.bitmapData);
          模糊滤镜
         var lvjing:BlurFilter = new BlurFilter();
         lvjing.blurX = 10;
         lvjing.blurY = 10;
         _pic.filters = [lvjing];
         
         addChild(bit);
       
        zhezhao = new Sprite();
        bit.mask = zhezhao;
        addChild(zhezhao);
       
        stage.addEventListener(MouseEvent.MOUSE_DOWN,down);
        stage.addEventListener(MouseEvent.MOUSE_MOVE,mmove);
        stage.addEventListener(MouseEvent.MOUSE_UP,up);
  }
  private function down(evt:MouseEvent):void
  {
        bo= true
  }
  private function up(evt:MouseEvent):void
  {
        bo= false
  }
  private function mmove(evt:MouseEvent):void
  {
     if(bo)
    {
              var a:Shape = new Shape();
              a.graphics.beginFill(0x00ff00);
              a.graphics.drawCircle(mouseX,mouseY,20);
             a.graphics.endFill();
             zhezhao.addChild(a);
    }
  }
 }
}

 

 

                                                                                放大镜的制作

 

package{

                 import flash.display.Sprite;

                 import flash.display.BitmapData;

                 import flash.display.Bitmap;

                 import flash.display.Loader;

                 import flash.net.URLRequest;

                 import flash.events.Event;

                 import flash.events.MouseEvent;

 

 public class Main extends Sprite

{

           private var picbitmap:BitmapData  

           private var mybitmap:Bitmap   

    public function Main():void

    {   

       init();

 }

  private function init():void  

 {   

          var loader:Loader = new Loader();  

          loader.contentLoaderInfo.addEventListener(Event.COMPLETE,loadok);  

          var = new URLRequest('a.jpg');  

           loader.load(url);  

 }

          private function loadok(evt:Event):void  

           {  

                   picbitmap = evt.target.content.bitmapData;  

                    var a:Bitmap = new Bitmap(picbitmap);  

                    a.width=400;

                    a.height=300;  

                    addChild(a);

                    /

                    var tu:Sprite= new Sprite();

                    tu.graphics.beginFill(0x000000);

                    tu.graphics.drawCircle(0,0,60);

                   tu.graphics.endFill();  

                   tu.startDrag(true);  

                   addChild(tu);

                     

                   mybitmap = new Bitmap(picbitmap);  

                   mybitmap.mask = tu;  

                   addChild(mybitmap);

                   ///   

                  stage.addEventListener(MouseEvent.MOUSE_MOVE,onmove);

        }

  private function onmove(evt:MouseEvent):void

         {  

                   mybitmap.x = (mybitmap.width-400)*(stage.mouseX/400)*-1

                   mybitmap.y = (mybitmap.height-300)*(stage.mouseY/300)*-1  

          }

     } 

  }

 

转载于:https://www.cnblogs.com/klh5211314/archive/2012/10/09/2717380.html

你可能感兴趣的文章
Vue 框架-01- 入门篇 图文教程
查看>>
多变量微积分笔记24——空间线积分
查看>>
poi操作oracle数据库导出excel文件
查看>>
(转)Intent的基本使用方法总结
查看>>
Windows Phone开发(24):启动器与选择器之发送短信
查看>>
JS截取字符串常用方法
查看>>
Google非官方的Text To Speech和Speech Recognition的API
查看>>
stdext - A C++ STL Extensions Libary
查看>>
Django 内建 中间件组件
查看>>
bootstrap-Table服务端分页,获取到的数据怎么再页面的表格里显示
查看>>
进程间通信系列 之 socket套接字及其实例
查看>>
天气预报插件
查看>>
Unity 游戏框架搭建 (十三) 无需继承的单例的模板
查看>>
模块与包
查看>>
mysql忘记root密码
查看>>
apache服务器中设置目录不可访问
查看>>
嵌入式Linux驱动学习之路(十)字符设备驱动-my_led
查看>>
【NOIP模拟】密码
查看>>
java容器---------手工实现Linkedlist 链表
查看>>
three.js 性能优化的几种方法
查看>>