1
votes

let's say i have this object on stage and it is called myShape and i want to manipulate it via action-script and apply a gradient color to it .. no if it is a fill color i could have used the colortransform method but i don't think that it will work .. and please don't suggest me to draw the shape with action script .

 import flash.geom.*
 import flash.display.*
 var fillType:String = GradientType.LINEAR;
 var colors:Array = [0xFF0000, 0x0000FF];
 var alphas:Array = [1, 1];
 var ratios:Array = [0x00, 0xFF];
 var matr:Matrix = new Matrix();
 matr.createGradientBox(200, 100, 0, 0, 0);
 var spreadMethod:String = SpreadMethod.PAD;
 myShape.graphics.beginGradientFill(fillType, colors, alphas, ratios, matr, spreadMethod);        

now when i test this i don't get any errors but i doesn't apply any thing ..

1
is this question so hard or what ? .. lol - hussein
if it wasn't you would have found the solution by yourself :p - Kodiak
i really searched this subject a lot ..not being a geek but this is really a stupid thing to have a research about .. but it is also a stupid thing to have in action script 3 or isn't it ?. and im still waiting for an answer .. lol - hussein

1 Answers

1
votes

I would create a bounding rectangle Shape, fill it with the gradient and apply the object as a mask. Is it possible in your case?