|
-
dyanmic color fill
hey everyone, i am trying to create a character creator problem i come across is that I want the people to be able to say what colour skin they want etc etc now i already have the shape drawn in flash in the location _root.test.skin
how can i change the colour of the shape? so instead of it being pink it can be brown?
dont want to have to draw different shapes for each colour cause then the thing will be huge
many thanks for any help!
-
Registered User
hi,
You use the Color Class.
Your shape has to be a movie clip. Suppose it's called my_mc:
code:
var my_color = new Color(my_mc);
my_color.setRGB(0x663300); // color it brown
-
ok i got that working with the form fields as well, but my problem now is this
the user can type in a hex code e.g 0x454545 in the skin box, click the prievew button and it will re colour the image, but then if they cahnge it again and press the preiview button it will not change the image. I traced the form value and it is being changed but it is just not re-coloring the image, any ideas?
nevermind i fixed it 2 seconds after posting this, will post it here in a sec
Code:
on (release) {
if (this.test == "1") {
player.skin.setRGB(_root.formskin);
player.shirt.setRGB(_root.formshirt);
player.trouser.setRGB(_root.formtrouser);
player.shoe.setRGB(_root.formshoe);
} else {
trace(_root.formskin);
player.skin = new Color(_root.player.skin);
player.skin.setRGB(_root.formskin);
player.shirt = new Color(_root.player.shirt);
player.shirt.setRGB(_root.formshirt);
player.trouser = new Color(_root.player.trouser);
player.trouser.setRGB(_root.formtrouser);
player.shoe = new Color(_root.player.shoe);
player.shoe.setRGB(_root.formshoe);
this.test = "1";
}
}
Last edited by neomaximus2k; 03-12-2005 at 07:57 AM.
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
|