-
dyn. loading hex colors for MCs
Hy Flashers,
I'm trying to construct a movie in which all the color information is loaded in from a .txt file.
I'm having troubles in getting my MC (just a black square on white) to display the color loaded from a text file.
Also I can't seem to find a tutorial file on this topic..
Anyone???
Thankz
Lars
-
lars,
where are you hung up? are you getting the data in flash ok? or is it the part of using that data to change the mc's color? make sure your hex color (let's say you want it blue for now) is in the format:
-
Hy aa,
Well I'm displaying the hex value in a dynamic textfield which is loaded from a .txt file.
So I'm having trouble getting that color to my movieclip symbol
the var which contains the colordata is : color1
and the symbol 2b colored is instance : my_square
so my question would be :
how to "color" my symbol with the hex value of var : "color1"
thankz
Lars
Last edited by webwarrior3; 08-26-2003 at 09:02 AM.
-
Senior Member
to say Ur text field is named txt_color...
now,
temp_color = txt_color.text.split("#")[1]
then ...
color1.setRGB("0x"+temp_color)
-
Thankz,
I'm using this piece of code :
myColor = new Color(_root.my_square)
myColor.setRGB(0x0000ff)
It's changing the color perfectly, only the HEX value needs to be replaced with my var called "color1"
My skillz r a bit rusty after the holidays :
myColor.setRGB(color1) doesn't work...
myColor.setRGB('color1') doesn't work...
So how to get my var "color1" into the code above?
Thnkz
Lars
-
Senior Member
aha ... color1 ... is textfield /// now i understand ...
// color1 is in this form : color1 = #ff00ff
try this :
temp_color = color1.split("#")[1]
then ...
myColor.setRGB("0x"+temp_color)
I understand color1 is name of variable ...not instance name .... ?! am I wrong?
-
Yes Stoc, ur right color1 is a variable loaded in from colors.txt
it holds : color1=0x336699
this value needs to color the MC
why do I need this?
Well, I'm constructing a php site with a HTML and FLASH frontend.
I want to have one file with the color info which will be read in Flash, and in a CSS file (using php).
This way I can format both frontends with just one file of style-data...
I'll go try your latest suggestion
Lars
-
Thankz!
This piece of code works for me :
temp_color = color1.split("#")[1]
myColor = new Color(_root.my_square)
myColor.setRGB("0x"+temp_color)
I can now control my colors inside flash with plain old HEX
Respek 2 da Group
Lars
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
|