2010-08-22 5 views
-4

Pourquoi ce code fonctionne pas pour Flash 10 ?:Une partie du code ne fonctionne pas dans 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

S'il vous plaît indentez votre code par quatre espaces afin qu'il soit correctement formaté. –

+2

Que voulez-vous dire par «pas de travail»? – BoltClock

+0

marque le code comme un code afin qu'il soit correctement formaté – KoolKabin

Répondre

0

essayer ...

 
//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; 
} 
0

que le code est pour Actionscript 2 pas 3 .. compilez votre fichier flash pour actionscript 2 et cela fonctionnera