Dynamically created hover captions

Okay, this worked in a simple file where it was the only thing on the stage (see this thread). Now I am implementing it in a much more complex scenario and the movie clip in question is quite buried so bear with me:

This is in my main timeline:


Movieclip.prototype.hover = function(sometxt) {
	this.onRollOver = function() {
		_root.m = 1;
		mainMap.map.pan.box.createTextField("caption", 1, mainMap.map.pan.box.test._x+2, mainMap.map.pan.box.test._y+2, 110, 30);
		mainMap.map.pan.box.caption.type = "dynamic";
		mainMap.map.pan.box.caption.multiline = true;
		mainMap.map.pan.box.caption.wordWrap = true;
		mainMap.map.pan.box.caption.size = 10;
		mainMap.map.pan.box.caption.text = sometxt;
		mainMap.map.pan.box.caption.autoSize = "left";
		mainMap.map.pan.box.test.resize();
		trace(mainMap.map.pan.box.caption.text)
	};
	this.onRollOut = function() {
		_root.m = 0;
		mainMap.map.pan.box.caption.text = " ";
	};
};
mainMap.map.pan.mapElements.ktn.hover("text for a caption");

The resize() function is just some simplified code from the resizing slideshow. Now this works as in when the ktn MC is rolled over the box appears where the mouse is and resizes to fit the text. When I do a trace on sometxt it reports back the correct text but the text itself doesn’t show. The box is a light blue and the default for createTextField is black so that shouldn’t be a problem.

I’m sure it is something simple and obvious that I am missing so if anyone sees it could you please point it out to me?

Thanks!! :hr:

well, either embed the fonts or keep the over caption outside of the mask and use localtoglobal/globaltolocal to handle positioning

Not sure I understand how that works. Does that mean capture the local coordinates of the MC I want the caption to appear on (the dot on the map). Then translate that to global coordinates of the stage and have the whole caption/textbox thing at the maintimeline?

basically, yeah. when you have a position inside a movieclip, its based on the coordinates of that movieclip itself. put a ball mc in a box mc at location (10,10) and move that box around on the main tiemline all you want and that ball will still be at (10, 10). What localtoglobal will do is translate that 10,10 to a global (_root based) coordinate as though the ball were moving in _root following the box. This means you can have your hover caption outside of your map completely, but still keep track of the coordinates it should have inside it and translate them to that outside.

Sweet! I’ll give it a shot - thanks for the explanation and for rescuing this thread. :wink:

:hr:

So here’s what is really frustrating. I put the whole hover caption box movie clip at the root level to begin this process and it works. I didn’t have to use localtoglobal at all! What’s up with that? Here I was mentally preparing myself for some major brain staggering alerations of my brilliant actionscript (cough) and I didn’t have to do a dang thing except unbury my movie clip, bring it to the surface for some light and air, and change all those wicked long paths you see above to reference the clip now at the main timeline.

:sigh: + :trout: = :hangover:

ARGH! :pirate3:

lol, you’ve been too long in that tower;)

scotty(-:

:wink: No kidding! Send me a horse will ya? :stuck_out_tongue:

…if your hover captions are following the mouse, then you wouldnt need the localtoglobal stuff… which looking back and actually reading, I see you mentioned :trout:

Your wish is my command=)

scotty(-:

Excellent. Except it needs a super big brain that says “actionscript dictionary”! :stuck_out_tongue:

@Sen - heh, well I guess it’s always good to learn something new right? Now I just need to incorporate it all into xml . . . :sen: