zoukankan      html  css  js  c++  java
  • 随机颜色画线

    import flash.events.MouseEvent;
    
    var darw:Boolean;
    stage.addEventListener(MouseEvent.MOUSE_DOWN,down);
    stage.addEventListener(MouseEvent.MOUSE_MOVE,Move);
    stage.addEventListener(MouseEvent.MOUSE_UP,up);
    
    function down(e:MouseEvent)
    {
    	darw = true;
    	var color:int=Math.random() * 0xffffff + 0xff000000
    	this.graphics.lineStyle(2,color,1);
    	this.graphics.moveTo(mouseX,mouseY);
    }
    
    function up(e:MouseEvent)
    {
    	darw = false
    }
    
    function Move(e:MouseEvent)
    {
    	if (darw)
    	{
    		this.graphics.lineTo(mouseX,mouseY);
    	}
    }
    
    
    package 
    {
    	import flash.display.MovieClip;
    	import flash.geom.ColorTransform;
    	import flash.events.*;
    	public class Star extends MovieClip
    	{
    		private var starColor:uint;
    		private var starRotation:Number;
    		public function Star()
    		{
    			this.starColor = Math.random() * 0xffffff;
    			var colorInfo:ColorTransform = this.transform.colorTransform;
    			colorInfo.color = this.starColor;
    			this.transform.colorTransform = colorInfo;
    			this.alpha = Math.random();
    			//Assign a random rotation speed
    			//this.starRotation = Math.random() * 10 - 5;
    			this.starRotation = Math.random() > 0.5 ? -1:1 * Math.random() * 5 + 5;
    			this.scaleX = Math.random();
    			this.scaleY = this.scaleX;
    			addEventListener(Event.ENTER_FRAME,rotateStar);
    		}
    		private function rotateStar(e:Event):void
    		{
    			this.rotation +=  this.starRotation;
    		}
    	}
    }
    
  • 相关阅读:
    Sed的使用方法简介
    Shell脚本基础
    网络配置与内核模块相关
    RPM管理,计划任务与性能监控
    SSH服务
    LVM与RAID阵列
    网络存储服务器
    FTP服务
    网络安全之iptables防火墙
    MySQL使用笔记(七)排序和限制数据记录查询
  • 原文地址:https://www.cnblogs.com/602147629/p/1989959.html
Copyright © 2011-2022 走看看