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!

Resize Invisible Button

Status
Not open for further replies.
Dec 24, 2001
857
GB
For some reason when I try to resize an invisible button using actionscript, it doesn't work. I've tried these two methods:

Code:
_root.btn_invis.setSize(100,100);
Code:
_root.btn_invis._xscale = 100;
_root.btn_invis._yscale = 100;

but neither have any effect...is it actually possible to resize an invisible button this way?
 
You won't see the effect because it's invisible.

You won't see the effect because you're setting x/y scale to 100%, which is the same as the original size.

Joke aside, this works for me:

//[tt] x9 scaling
btn_invis._xscale = 300;
btn_invis._yscale = 300;
//[/tt]

Or you can use normal button and set _alpha to 0.

Kenneth Kawamoto
 
I'll give that a try...I should have known the scale properties worked on percentages...oops! I wonder why the setSize function didn't work...

I also like the idea of setting the alpha to 0...I might have to go with that one.

Thanks for your help.
 
Having tried it, I've just remembered why I needed to use the setSize function...

The invisible buttons will be appearing over text fields, but since the amount of text in the field differs on each one, I wanted to be able to get the width and height of the field and set the button to the same (so the button isn't twice the size of the text field).

The reason I can't just place the buttons over the text fields manually is because its all created dynamically in a FOR LOOP.

Also, since text fields won't allow an onRelease or onRollover function to be added (or at least it didnt work for me...), I tried using text areas which allow it. However I believe I had the same resizing problem because I was basing the resizing on the length of the text but because its not a font like courier new, the size of character is different so saying 'lenght * 3' or whatever won't work because 'A' takes up more space that 'i' etc etc...if you dont get what I mean, its not important...I'm just babbling!

This is a strange one because all I want to do it resize what is essentially a movie clip...even when entering values manually such as setSize(100,100) somewhere into the loop, it still doesn't work which is making me think the problem lies elsewhere...
 
You can create an empty movieclip and create a text field in it. You can then assign mouse actions to the movieclip. All this can be done dynamically.

(By the way "setsize" is not applicable to a button or to a movieclip.)

Kenneth Kawamoto
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top