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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help on a Simple Action Script Prob with Rollovering 1

Status
Not open for further replies.

Whippsy

IS-IT--Management
Jun 24, 2002
17
0
0
AU
I'm making a portfolio page where when you rollover the image of a website pic & it enlarges on to the 'stage'. Thats all n' done but how would i go about having some text appear (a description about the page) under it, what i'm thinking is having a text box thing there and some action script that will make certain text appear there when u hover over that website's smaller-version pic.

Any Ideas? :)
 
Add a dynamic textfield under the image and give it the instance name 'myTextField' or whatever.

In the same rollOver script that you already have add in a line like this:

myTextField.text="caption for image"

and in the rollOut script reset it like this:

myTextField.text=""
 
wow didn't know it was that easy, thanks ill try that.
 
umm nothing is happening, are you sure its that?
 
Positive. Try this:


It's done with this code and a dynamic text box called 'myTextField':

Code:
clip.onRollOver = function() {
	this._xscale = this._yscale=110;
	myTextField.text = "this is the caption for the rollover";
};
clip.onRollOut = function() {
	this._xscale = this._yscale=100;
	myTextField.text = "";
};
 
hmmm i dont think i'mv using a roller, this code is on the small pic
--
onClipEvent (load) {
var speed = 4;
var origX = _x;
var origY = _y;
var origWidth = _width;
var origHeight = _height;
var fooX = origX;
var fooY = origY;
var fooWidth = origWidth;
var fooHeight = origHeight;
}
onClipEvent (enterFrame) {
if (hitTest(_root._xmouse, _root._ymouse)) {
_root.foo = this;
fooX = _parent.block._x;
fooY = _parent.block._y;
fooWidth = _parent.block._width;
fooHeight = _parent.block._height;
} else {
if (_root.foo != this) {
fooX = origX;
fooY = origY;
fooWidth = origWidth;
fooHeight = origHeight;
}
}
_x += (fooX-_x)/speed;
_y += (fooY-_y)/speed;
_width += (fooWidth-_width)/speed;
_height += (fooHeight-_height)/speed;
}
--
 
You just have to stick the text calls into the if/else statement you already have, make sure you get the path to the textfield instance right and it will work fine.
 
my text box is called mybox and its still not doing it. am i doing everything right?

onClipEvent (load) {
var speed = 4;
var origX = _x;
var origY = _y;
var origWidth = _width;
var origHeight = _height;
var fooX = origX;
var fooY = origY;
var fooWidth = origWidth;
var fooHeight = origHeight;
}
onClipEvent (enterFrame) {
if (hitTest(_root._xmouse, _root._ymouse)) {
_root.foo = this;
mybox.text = "thissss"
fooX = _parent.block._x;
fooY = _parent.block._y;
fooWidth = _parent.block._width;
fooHeight = _parent.block._height;
} else {
if (_root.foo != this) {
mybox.text = "thissss"
fooX = origX;
fooY = origY;
fooWidth = origWidth;
fooHeight = origHeight;
}
}
_x += (fooX-_x)/speed;
_y += (fooY-_y)/speed;
_width += (fooWidth-_width)/speed;
_height += (fooHeight-_height)/speed;
}

--thanks
 
You may have the path to the textbox wrong - try_root.mybox or _parent.mybox for a start, or else the textbox is set to HTML formatting, or the font may need to be embedded or you've put the name 'mybox' in the 'variable' space rather than 'instance'.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top