一聚教程网:一个值得你收藏的教程网站

热门教程

七色花--as3变色应用练习

时间:2022-07-02 17:08:50 编辑:袖梨 来源:一聚教程网

类:

package {
 //********************************************************//
 //*******本类由浪子啸天创意设计****************************//
 //*******有什么问题请mail:webmaster@flasc.cn******************//
 //*******更多的请访问:http://www.flasc.cn***//
 //*******转载请注明处处,请保留版权*************************//
 //*******************************************************//
 import flash.geom.ColorTransform;
 import flash.display.*;
 public class Trgb extends MovieClip {
  public var col:ColorTransform=new ColorTransform  ;
  public function Trgb() {
   col.color=rgb();
   this.transform.colorTransform=col;
  }
  public function rgb():uint {
   return (Math.random() * 0xffffff + 0xff000000);
  }
 }
}

flash9中代码:

import flash.geom.ColorTransform;
var myTimer:Timer = new Timer(100,90);
var i:Number=myTimer.currentCount;
function StartTimer() {
 myTimer.addEventListener("timer", addmc);
 myTimer.start();
}
function addmc(i:Number) {
 i=myTimer.currentCount;
 var mymc=new Trgb();
 addChild(mymc);
 mymc.x=250;
 mymc.y=200;
 mymc.rotation=4*i;
}
StartTimer()

 

热门栏目