autoSize

I’m using autoSize for my text box, this is working fine.

What I’m trying to do is “autoSize” the background of the text box so no matter how long or short the text box is the background will resize with the text box.

thanks
Vu

you will have to count how many characters there are

know how wide the text box is, wroughly how many characters per line

then tell an MC to change size to fit the text…

I have code myself, however I’d rather watch you sweat

as apparantly you learn by working it out yourself

just do:


background._width = textbox._width;

I’m still an amateur in AS so I wouldn’t know where to begin.

How about I get some “KEY” actionscript words so I know where to start.

The characters are going to very depending on what information is provided. Should I estimate the maximum amount?

Thanks
vu

you dont need to estimate how many characters are in the text box. Just set the width of the background equal to the width of the text box.

[quote=mrwicked;2344371]just do:
ActionScript Code:
[LEFT][COLOR=#0000FF]background[/COLOR].[COLOR=#0000FF]_width[/COLOR] = textbox.[COLOR=#0000FF]_width[/COLOR];
[/LEFT]

[/quote]
Thanks mrwicked i’ll try it now

info.autoSize = true;
info.wordWrap = true; 
textbox._visible = false;

textbox._width = info._width;

Didn’t work, do I need to write a function?

works fine for me

I got it working, didn’t relise it was working because I had made the textbg the same size as the text box.
Thanks mrwicked

I have problem though;
Is there a way to make the text box background size perfectly to the size of the width no matter how long or short the text box is?

I understand that I need to set the width of the text box to determine the length before it wraps but when I do this the text box background will be that length no matter how short the information in the text box is.

If you look at the attachments you see what I mean.
text01.fla is fine if I have a lot of text but text02.fla wouldn’t work if I only have a few characters.

thanks Again
Vu

well taking this line out seemed to fix it i think:

info.wordWrap = true;

But then the all the information is just on the one line.