Ask a Question related to Macromedia Director Lingo, Design and Development.
-
Gary #1
Change text color at runtime
This must be a FAQ, but I can't find the answer anywhere. I can change
the color of a text member's sprite at design time using the properties
panel. Doing so changes only the sprite, not the color of the text
member itself.
How can I change the sprite's color in Lingo at runtime? I've tried
setting the sprite's color and forecolor properties, to no avail.
Gary Guest
-
change text color
Is there anyway in acrobat, to open a pdf of many pages and globally change the color of all the text? Is there anyway to do this in any program... -
Can you change the color of text with the Touchup Text tool?
I just want to say that your note helped me. I NEVER knew that I could use a right click to bring up properties when using the text touch-up tool!... -
How to change text color in 7 Pro?
I am creating a PDF with many links. In 5 I would make the linked text blue so people would know it was a link. In 7 I could not do that, so I loaded... -
Does anyone know how to change the color of a text box?
Does anyone know how to change the outline and fill of a text box in Flash? I only can change the font color that will be typed into the box. ... -
text color change in Flash MX
I'm trying to change the color of my text on a rollover but it only changes on the edge of the text. Once I am over the text link, the color change... -
Rob Dillon #2
Re: Change text color at runtime
Hi Gary,
For text set the member's color using rgb values
sprite(X)member.color = rgb(255,0,0)
this will change the text color to red
if you want to color only some part of the text, then specify the chunk
to be changed:
sprite(X)member.word[Y].color = rgb(0,255,0)
--
Rob
_______
Rob Dillon
Team Macromedia
[url]http://www.ddg-designs.com[/url]
412-243-9119
[url]http://www.macromedia.com/software/trial/[/url]
Rob Dillon Guest
-
Gary #3
Re: Change text color at runtime
#1: This still doesn't work.
#2: If I can change the color of the sprite (not the member) in the
property inspector, why can't I do so in Lingo?
Rob Dillon wrote:> Hi Gary,
>
> For text set the member's color using rgb values
>
> sprite(X)member.color = rgb(255,0,0)
>
> this will change the text color to red
>
> if you want to color only some part of the text, then specify the chunk
> to be changed:
>
> sprite(X)member.word[Y].color = rgb(0,255,0)
>Gary Guest
-
Loren Schwarz #4
Re: Change text color at runtime
sprite(whichSprite).foreColor = colorConstant
sprite(whichSprite).backColor = colorConstant
works for me. This changes the color(s) of a sprite at runtime. The
constants are exactly the ones which can be seen in the behavior inspector
when changing the properties at design time (e.g. 255 for black or 0 for
white). By the way, I've tried this with text members - don't know if it
works with field members, maybe you're using a field member instead of a
text member.
If this doesn't work in your project, someting else is wrong as for me it
always works.
Bye,
Loren Schwarz
Loren Schwarz Guest
-
Rob Dillon #5
Re: Change text color at runtime
You said that you wanted to change the color of a text member's sprite.
If this is a text member then that's the way that you change the text
color. You can also use the foreColor property of the member.
If the member is set to editable, and it's a text member, you can still
change the text color, if it's a field, then the color will remain
black.
If you want to change the color of the background of the sprite and
it's not set to editable, then you can set the backColor property of
the member. If the member is set to be editable, then the backColor
will remain white.
You can't set the color of a text or field sprite, you have to set the
member's property.
--
Rob
_______
Rob Dillon
Team Macromedia
[url]http://www.ddg-designs.com[/url]
412-243-9119
[url]http://www.macromedia.com/software/trial/[/url]
Rob Dillon Guest
-
JKLea webforumsuser@macromedia.com #6
Re: Change text color at runtime
I know I'm new to this, but here's my thoughts:
I'm not sure about sprite(x)member.color = .... I tried that and it didn't work - got a script error.
Here's what works for me...
member("x").color = rgb(x,x,x)
member("x").forecolor = paletteIndexColor
member("x").backcolor = rgb(x,x,x)
sprite(x).forecolor = rgb(x,x,x)
sprite(x).backcolor = rgb(x,x,x)
sprite(x).color = rgb(x,x,x)
My text sprites are usually set to "Not Copy", so the coloring convention is a little backwards and the sprite(x).(forecolor, backcolor, and color) functions don't seem to have any effect and if they do have an effect, it's opposite of what I tell it. So I use the member("x").color, backcolor, forecolor commands and those work for me. Albeit in reverse, but they work. Reverse meaning if I want white I use rgb(0,0,0) instead of rgb(255,255,255). Not sure why, but that's the way it's working for me.
Here is the script I'm referring to:
on mouseEnter me
sprite(7).cursor = 280
member("AutorunButton").color = rgb(58,40,20)
end
on mouseLeave me
sprite(7).cursor = 0
member("AutorunButton").color = rgb(0,0,0) --This shows white instead of black
end
on mouseUp me
put "" into member("FAQ-List")
member("AutorunButton").color = rgb(0,0,0) --This shows white instead of black
member("FAQ-List").forecolor = 164 --Palette index color 164
put member("autorun-text").text into member("FAQ-List")
end
Here's my interpretation - Changing the sprite color or member color is the same thing. One just refers to the placement in the score (spriteNum) and the other refers to the name you gave it in the cast list (member) - ie: member name. I'm not 100% about this, but so far I've had no trouble changing the colors of my text sprite's I use for links in my movie.
It always seems that everyone has different methods of doing the same thing with the same programming language. Whether it's Lingo, ActionScript, C++ or what... always a different method depending on who you talk to. My advice would be to take the suggestions the other gents and I have given and experiment with it. Just open up the message window (ctrl+m) and start typing the commands. Something is bound to work at one point or another.
Hope this helps,
JKLea
JKLea webforumsuser@macromedia.com Guest
-
Loren Schwarz #7
Re: Change text color at runtime
sprite(x)member.color can't work because there is a dot missing:
sprite(x).member.color. You are accessing the property "member" of the
object "sprite(x)", that's why the full-stop is needed in between.
The setting "not copy" per definition inverts any color. There is a page in
Director help which explains all color effects, including this one. This is
the reason for your rgb(0,0,0) resulting in white instead of black. You said
your sprites are usually set to "not copy" - why don't you set them back to
copy? :-) Handling would be easier...
Sprites can be seen as instances of cast members. That is: when you change
the color of a cast member, the color is changed in the "original" object,
changes can be seen in all of its instances (sprites). Changing a sprite's
color only changes the color of this one copy of the main object - leaving
the "original" thing untouched. Even more, when you load a different member
into the sprite you changed the color of, the newly loaded member will also
appear in the sprite's color.
Cheers
Loren Schwarz
Loren Schwarz Guest
-
kideg #8
Re: Change text color at runtime
Try this
sprite(me.spriteNum).setVariable("buttonText.textC olor" , "0x009933")kideg Guest



Reply With Quote

