|
-
help: Color changing function
Working in AS2 here trying to make a simple function to change the color of an object passed to it. I'm not getting a complier error but it's not working either.
PHP Code:
import flash.geom.ColorTransform;
function color_change(color, mc) {
var colorTrans = new ColorTransform();
colorTrans.rgb = color;
mc.colorTransform = colorTrans;
}
I'm using the function call below:
PHP Code:
change_color(0xFFFF00, _root.stabar);
Thanks for the help.
-
Senior Member
Does an AS2 movieclip have a "colorTransform" member, or are you just adding a new member and assigning it a value? (I think the latter would have no effect).
I never did much AS2. The way I read the documentation, it says that you should add a new flash.filters.ColorMatrixFilter to the MovieClips "filters" member (filters is an array, just push the ColorMatrixFilter at the end). Someone with greater AS2 experience can probably be more helpful.
-
file not found
I beleive you may be looking for something along these lines:
Code:
function color_change(color, mc) {
var colorTrans = new Color(mc);
colorTrans.setRGB(0x000000);
}
This is just off the top of my head though, so I'm not sure if it will work like you want.
-
That Worked
Oddly enough that did. I was using the import because the CS3 help file says (for .getRGB):
Deprecated since Flash Player 8. The Color class has been deprecated in favor of the flash.geom.ColorTransform class.
I used the import successfully in another AS2 script I made but oh well. It works, I'm running with it. Thanks for the help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|