为什么此代码不适用于Flash 10?:
onClipEvent(load){
//Import the classes needed to transform the color
import flash.geom.ColorTransform;
import flash.geom.Transform;
//A starting amount to tint the image
redamount = 0;
//Is the image getting more red or more blue?
goingred = true;
}
//Run at the start of each frame
onClipEvent(enterFrame) {
//if going red is set to true, set the color transform to tint the image more red
if (goingred) {
redamount++;
//otherwise, it is getting more blue
} else {
redamount--;
}
//the boundaries. If a limit (0 or 64) has been reached, flip from going red to going blue
if (redamount == 0 || redamount == 64) {
goingred = !goingred;
}
//Declare a new ColorTransform object
var colorTrans:ColorTransform = new ColorTransform();
//Set the red offset to the specified amount. Higher is stronger
colorTrans.redOffset = redamount;
//when the red offset is low, the blue offset is high, and vice versa.
colorTrans.blueOffset = 64-redamount;
//Create a new Transform object. This is attached to the movieclip 'tintedimage'
var trans:Transform = new Transform(this);
//apply the color transform to the transform object
trans.colorTransform = colorTrans;
}
答案 0 :(得分:0)
试试这个......
//Import the classes needed to transform the color import flash.geom.ColorTransform; import flash.geom.Transform; //Declare a new ColorTransform object var colorTrans:ColorTransform = new ColorTransform(); var readamount:Number; var goingred:Boolean; onClipEvent(load){ //A starting amount to tint the image redamount = 0; //Is the image getting more red or more blue? goingred = true; } //Run at the start of each frame onClipEvent(enterFrame) { //if going red is set to true, set the color transform to tint the image more red if (goingred) { redamount++; //otherwise, it is getting more blue } else { redamount--; } //the boundaries. If a limit (0 or 64) has been reached, flip from going red to going blue if (redamount == 0 || redamount == 64) { goingred = !goingred; } //Set the red offset to the specified amount. Higher is stronger colorTrans.redOffset = redamount; //when the red offset is low, the blue offset is high, and vice versa. colorTrans.blueOffset = 64-redamount; //apply the color transform to the transform object this.transform.colorTransform = colorTrans; }
答案 1 :(得分:0)
该代码适用于Actionscript 2而不是3 ..编译动作脚本2的flash文件,它将起作用