-
Color changing help
Hey all,
I feel sort of stupid asking this, but for the life of me I cant seem to find/figure out an answer to this script.
I am trying to create a simple little script to change the color of a circle every time the user clicks anywhere in the flash movie. I swear that the code below should work and I cant find out where I am going wrong. Help, please? (er side note, I just realized that the code that I posted wont change it *everytime* but at this point I just want to be able to change it at all. I'll work on it from there)
class shooter extends MovieClip
{
function onLoad()
{
shooter.onRelease(mouseDown)
{
var colorful = new Color("_root.shooter_ball");
colorful.setRGB(0x0000FF);
}
}
}
-
try without the " :
var colorful = new Color(_root.shooter_ball);
or just:
var colorful = new Color(shooter_ball);
but If you are trying to use this in CS3:
"The method Color is no longer supported. The Color class has been removed. Use the flash.geom.ColorTransform class for equivalent functionality.."
-
Senior Member
For AS3, try something like this,
PHP Code:
var cir:Sprite = new Sprite();
cir.graphics.beginFill(0xFF0000, 1); cir.graphics.drawCircle(200, 250, 30); cir.graphics.endFill(); addChild(cir);
stage.addEventListener(MouseEvent.CLICK, mClick, false, 0, true);
function mClick(e:MouseEvent):void { var ct:ColorTransform = new ColorTransform(); ct.color = Math.random() * 0xFFFFFF; cir.transform.colorTransform = ct; }
Wile E. Coyote - "Clear as mud?"
-
Clarification
I am working with CS4 but I'm using Actionscript 2. Was the Color function removed in Actionscript 3 or just Creative suite 3?
-
Senior Member
Wile E. Coyote - "Clear as mud?"
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
|