Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Chaning text colors programattically, etc. 1

Status
Not open for further replies.

RiverGuy

Programmer
Jul 18, 2002
5,011
US
Hello All. This is pretty much the first day I've attempted to use Flash. I'm using version 5 I believe. I was wondering if I could get a couple of tips.

My first question is: how do you reference an object in ActionScript? For example, when a button is pressed, a want a text area on my screen to change colors. From what I can gather, a text area really has no name? I can see it referenced by the default string it contains in the ActionScript MovieExplorer tab.

Also, I am doing fine setting the string value of my text areas dynamically with variables, BUT.......the font color seems to have no "variable box" to assign to it.

So I'm guessing this must be accomplished somehow via ActionScript.

I guess my bottom line is, I am wondering if you can access properties of all objects in this as you can do in programming languages?

Thanks


Second question: I tried to set up a text area as a button. I assigned it a symbol and button behavior, but I cannot get a little hand over it, and the FSCommand I assigned to it does not fire when I do click it. Any ideas?
 
In Flash 5 you can set the text color of the textfield in the Character panel. If you want to use different colors, you'll have to set the the HTML box and use html tags. But that will only work if your text is dynamic, set in the Text Options panel.

Your button might be working, but when you use text only, you really have to go precisely over the characters themselves, for the cursor to change to the pointing finger.
Draw a filled rectangle to cover the whole text area, and insert it in the "hit" state when in the button's edit mode.

As for the fscommand, which one are you trying out exactly? Regards,

oldman3.gif
 
Thanks. The HTML worked good.

I don't understand quite what you mean about filled rectangle. I tried precisely to go over the characters and couldn't get it.

I couldn't find a way to make an opaque fill. I figured if I could do that, and put it over the top of my text, then I could click on it.

As far as the fscommand, on the press event for the text, I told it send an fscommand that I named. The command doesn't do anything....I was checking to see if it fired is all. It didn't.

Thanks a lot for your help so far.
 
If you go into the button's edit mode, (by the way did you check your button's behavior in the Library?), add a layer. Over the up state, insert a keyframe, and using the rectangle tool (with the border disabled), draw a rectangle covering the text area. Next copy that frame (CTRL->ALT->C), and on the bottom layer insert a keyframe in the "hit" state, if there isn't one, and copy your rectangle with CRTL->ALT->V. Delete the added layer.
Your button should not react if you mouse over this new hit area.

To check it out, you can use a trace action, as so:

on(release){
trace ("Button pressed!");
} Regards,

oldman3.gif
 
I think I figured out some of it anyways. I tried putting a big rectangle in the hit section as you advised. My text buttons are on the 2nd layer from the bottom. So what it would do, is only let me click on the parts outside of the text....because the button seems to be on the bottom layer. It says Layer 1 when I open the symbol editing...
 
Hey....I just needed to turn "selectable" off. That solved it....Cool!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top