|
-
Senior Member
dynamic color
I want to set the color of setPixel in bitmapData dynamicaly. What I mean is that I find a value for red, green and blue, convert to hex and then use setPixel(x,y,c); to draw. The problem is that if I try
Code:
r=255;
g=0;
b=20;
var c:String = "0x"+r.toString(16)+g.toString(16)+b.toString(16);
myBitmapData.setPixel(x, y, c);
I get the following error:
**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 143: Type mismatch.
myBitmapData.setPixel(x, y, c);
I have tried with the color object but I can't get it to work.
-
Patron Saint of Beatings
Answer:
That's because c should be a number according to Flash's documetation.
Solution:
I have no idea. >_<
-
Try doing: myBitmapData.setPixel(x, y, Number(c));
-
That should work because it's requring a number and not a String.
-
Senior Member
Thanks, that worked
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
|