Hi, I’m currently working my way through making a a hover/caption swf for a website and one i’ve come across a couple of problems:
-
Firstly all the dynamic text for the captions is extracted from an xml file - how would I write in the xml a new line feed? I’ve tried putting both ‘\r’ and ’
’ in the xml but flash just writes these out as if they are text. -
How could I change the height of the movie clip depending on the length of the text (or even betterthe number of line feeds)? Changing the caption movie clips height stretches the text.
This is the code (only slightly changed from the Kirupa caption tutorial):
captionFN = function (showCaption, captionText, bName) {
if (showCaption) {
_root.createEmptyMovieClip("hoverCaption", this.getNextHighestDepth());
mc_caption.txt_desc.text = captionText;
mc_caption._width = 150;
mc_caption._alpha = 85;
//mc_caption._height = ??;
if ((bName._width+bName._x+mc_caption._width)>Stage.width) {
xo = -0-mc_caption._width;
yo = -50;
}
else {
xo = -0;
yo = -50;
}
hoverCaption.onEnterFrame = function() {
mc_caption._x = _root._xmouse+xo;
mc_caption._y = _root._ymouse+yo;
mc_caption._visible = true;
};
}
else {
delete hoverCaption.onEnterFrame;
mc_caption._visible = false;
}
};
and a screenshot of an idea of what I’m trying to do and the problems I’m having:
Cheers to anyone who can help.
stibos