Hover Caption Tutorial Help (resizing background square)

Hello,

Thanks in advance for the help.

I’ve completed the Hover Caption tutorial at http://www.kirupa.com/developer/mx/captions.htm successfully. What I’d like to do in addition, is to resize the caption box to match the caption text’s length.

I’ve tried giving the background box a name (box) and turning it into a button and then doing:

_root.caption.box._width = _root.caption.help.length * 8;

But the box never aligns with the text properly after that. I’m totally new to flash and don’t know what methods to call in order to get the bottom corner of the text and bottom corner of the box and align them properly. Any help appreciated greatly.

Kind regards.
Alex

try this:
[AS]
myLength = _root.caption.help.length*8; //8 or whatever u want
setProperty(_root.caption.box,_width,myLength);
[/AS]

e.s.x.s :wink:

Hi, I’ve tried that route through different methods. Here is the result:

The first image shows the object and how the text field (called help) and the background orange box (called box) are positioned.

Adding your code to the tutorial button actionscript items that are placed in the mouseovers for the four buttons shown, the results are properly sized boxes in incorrect locations. I would like for the text to be inside the box, not overlapping as shown.

Thanks for the response.
Alex

ok… change the code to this one:
[AS]
myLength= _root.caption.help.length*8;
myWidth= _root.caption.help._width;
myX = _root.caption.help._x;
setProperty(_root.caption.box,_x,myX+(myWidth/2));
setProperty(_root.caption.box,_width,myLength);
[/AS]

e.s.x.s

It seems to move the box, but the result is even more offset than previous.

I’ve posted a stripped fla (to reduce size) here:

file posted here

I’ll send $15 Paypal if anyone can help me sort this out. I’m sure it’s a one liner somewhere.

Thanks in advance.
Alex

i have made it for u;)
but i can’t upload here:( give me your mail and i’ll send u the file…:slight_smile:

e.s.x.s