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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text Background 1

Status
Not open for further replies.

TheSponge

Technical User
Jul 2, 2003
442
GB
Hi,

I have text that goes into a Text box on mouse rollovers,

But I cant seem to find a way to change the text box background? I tried to create a shape on a layer behind but no good as the textbox isnt transparent?

Any Ideas

I want it ti be black

Thanks
 
TextField.backgroundColor

Description


Property; the color of the text field background. Default is 0xFFFFFF (white). This property may be retrieved or set, even if there currently is no background but the color is only visible if the text field has a border.

my_textfield.border = true;
my_textfield.backgroundColor = "0xFF0000";

 
Thankyou,

I presume they are Hexidecimal colour codes?

 
I tried this but the colour didnt change, I made sure the text field had a border,

Does it matter if its a dynamic text field?

Thanks
 
In MX only, that the quotes be there or not, doesn't matter...
 
Im using MX, it makes no difference, still isnt working..

Im puzzled.....

Could I make the text box transparent and put a coloured rectangle behind it perhaps?

If so How :)
 
Are you using a component text area?

Wow JT that almost looked like you knew what you were doing!
 
You sure about your textfield's instance name and path?
Is it nested in some movie clip(s)?
 
The text box is a regular textbox drawn on the stage called 'mytext' there isn`t` a path as at the moment its just the root movie.

Cheers

 
Just reread the earlier posts - you don't need to set the 'border' property - it's the 'background' property you need to set:

Code:
myTextField.background = true;
myTextField.backgroundColor = 0xff0000;
 
I have also tried this, no luck...

Here is the code:


mysound = new sound();
mysound.attachsound("night");
text="Idle"
text.background=true;
text.backgroundColor="0xff0000";
 
I think you've set this up wrong - 'text' is a reserved word for a start, and to set a text box to show something you'd need something like myTextBox.text='idle'. Have you give the text box on the stage an instance name?
 
My above code works though? text is the var name on the stage,

Its the background I cant change. I havent given it an instance name, why do I need too?

Thankyou for your patience.

 
Yes otherwise you can't get to it and change any properties - try this on it's own, it may help:

Code:
this.createTextField('myTextField', 100, 100, 100, 100, 20);
myTextField.background = true;
myTextField.backgroundColor = 0xcccccc;
myTextField.text = 'testing';

To address a field already on the stage change it's instance name to myTextField and remove the first line of the code above.
 
Thankyou, Im sure its simple to all you experts, but I am still learning!!

This worked perfectly, and I understand why it now works...

Have a star..

James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top