PDA

View Full Version : hover caption within movie canvas



felipegm
May 9th, 2004, 02:38 PM
I followed the hover caption tutorial (http://www.kirupa.com/developer/mx/captions2.htm) but sometimes the hover caption goes out of the movie.

How to make it stay inside the movie and a certain distance of the mouse?

eki
May 10th, 2004, 09:12 AM
You need to rethink the way you're doing it:

I would 'drag' the the caption by making its x and y the xmouse and ymouse
in an enterframe:


onClipEvent (enterFrame) {
if (_root.x==1) {
if(this._x+this.width < _root.stageWidth){ //_root.stageWidth being the width of the stage
this._x = _root._xmouse;
} else {
this._x = _root._xmouse-this.width;
}
this._y = _root._ymouse; // you may want to do the same with the y. i'm too lazy
this._alpha = 50;
} else {
this._alpha = 0;
}
}

felipegm
May 10th, 2004, 09:57 AM
thanks for your replay, but the hover is still going out of sight when the button is near the edge of the movie...
The hover is a little large, like 200x200, and somethimes goes out of the canvas... how to control it in a way that it doesnīt goe out?

felipegm
May 10th, 2004, 09:58 AM
thanks for your replay, but the hover is still going out of sight when the button is near the edge of the movie...
The hover is a little large, like 200x200, and somethimes goes out of the canvas... how to control it in a way that it doesnīt goe out? or maybe I made something wrong with your code?

felipegm
May 10th, 2004, 10:27 AM
Donīt know what Iīm doing wrong.
Could you please take a look at my fla?
thanks

eki
May 10th, 2004, 03:02 PM
Hi,
there you have

MattyG
June 30th, 2004, 10:50 AM
I've been trying to accomplish this same thing with no luck... by the way I did download the file from 'eki' and it doesn't really accomplish the goal either. Anybody else figure this out? Surely someone has done this the right way...

Thanks!

jerez_z
June 30th, 2004, 07:54 PM
you could always do a boundary test:



if(clip.getBounds(_root).xMin < 0) {
clip._x = 0+(clip._width/2)
} else if(clip.getBounds(_root).xMax > Stage.width) {
clip._x = Stage.width-(clip._width/2);
}
if(clip.getBounds(_root).yMin < 0) {
clip._y = 0+(clip._height/2)
} else if(clip.getBounds(_root).yMax > Stage.height) {
clip._y = Stage.height-(clip._height/2);
}
//NOTE: you may have to replace Stage.width/Stage.height with the width and height of your movie (respectively)


Hope that helps. :D

MattyG
July 1st, 2004, 09:45 AM
I'll give that a try... Thanks for the help!

jerez_z
July 1st, 2004, 01:01 PM
no problem