zoukankan      html  css  js  c++  java
  • 关于设计:Actionscript 有关鼠标事件笔记2

    3-10 线段涂鸦板

    paper_mc = new MovieClip();
    this.addChild(paper_mc);
    Mouse.hide();
    paint_mc.startDrag(true);

    paper_mc.graphics.lineStyle(10,0xFF0000,1);//用刷子的元件代替鼠标:

    stage.addEventListener("mouseDown",movePen);
    function movePen(me:MouseEvent){
     paper_mc.graphics.moveTo(this.mouseX, this.mouseY);
    }

    stage.addEventListener("mouseUp",drawPen);
    function drawPen(me:MouseEvent){
     paper_mc.graphics.lineTo(this.mouseX, this.mouseY);
    }

    3-11 影片剪辑的拖拽和停止拖拽

    tar_mc.alpha = 0.5;

    this.addEventListener("mouseDown", godrag);
    function godrag(me:MouseEvent){
     tar_mc.startDrag(true);
     tar_mc.alpha = 1;
    }

    this.addEventListener("mouseUp", stopdrag);
    function stopdrag(me:MouseEvent){
     tar_mc.stopDrag();
     tar_mc.alpha = 0.5;
    }

    3-13 判断物体鼠标指针的位置是否和物体重叠

    pic_mc.alpha=0.5;

    stage.addEventListener("mouseMove",showpic);
    function showpic(me:MouseEvent){
     var myX = this.mouseX;
     var myY = this.mouseY;
     var test = pic_mc.hitTestPoint(myX,myY,true);
     if (test){
      pic_mc.stop();
      pic_mc.alpha=1;
     }else{
      pic_mc.play();
      pic_mc.alpha=0.5;
     }
    }

    3-14 可拖拽并放大对象的放大镜

    zoom_mc.buttonMode = true;
    myX=zoom_mc.x;
    myY=zoom_mc.y;

    zoom_mc.addEventListener("mouseDown",pickZoom);
    function pickZoom(me:MouseEvent){
     zoom_mc.startDrag();
    }

    zoom_mc.addEventListener("mouseUp",putZoom);
    function putZoom(me:MouseEvent){
     zoom_mc.stopDrag();
     if(zoom_mc.dropTarget.name!="instance1"){
      zoom_mc.dropTarget.scaleX *=1.1;
      zoom_mc.dropTarget.scaleY *=1.1;
     }
     zoom_mc.x=myX;
     zoom_mc.y=myY;
    }

  • 相关阅读:
    基于Java的地铁线路查询系统设计思路
    个人总结05
    构建之法读书笔记03
    Java 8 (二) 新的时间API
    MySql基础笔记(三)其他重要的事情
    MySql基础笔记(二)Mysql语句优化---索引
    JavaScript基础笔记(十四)最佳实践
    JavaScript基础笔记(十三)测试和调试
    MySql基础笔记(一)Mysql快速入门
    JavaScript基础笔记(十二)Ajax
  • 原文地址:https://www.cnblogs.com/cnsg/p/2510974.html
Copyright © 2011-2022 走看看