View Full Version : problem!!!
ebuprams
March 19th, 2002, 11:37 PM
hi there
i have a image which i want to move from left to right and vice-versa once there is a mouse over on it i dont want to do it using the tweening method i want to do it using action script and i know that we have to u use the mouse _xscale and _yscale properties but i am jus not to sure as to how shuld i achieve that
pls help me
thanx in advance
Ebu,
upuaut8
March 20th, 2002, 12:41 AM
do you want to move it, or scale it? There would be a difference in the code.
also.. is the object that you want to move a movie clip?
ebuprams
March 20th, 2002, 01:14 AM
i want to move the object and the object is a movie clip
thanx
Ebu
upuaut8
March 20th, 2002, 01:47 AM
I've got my sig working that way.
I can't figure the code at the moment. I'll have to get back to you once I can access that file on my comp at home.
ebuprams
March 20th, 2002, 01:49 AM
thanx a lot upuaut8 for u r time
and i am sure that u will be able to help me out of this
Thanx
Ebu
thoriphes
March 20th, 2002, 02:52 PM
*cracks his knuckles*
here's some code for ya:
onClipEvent(load) {
this.onMouseOver = function() {
xScr = 550;//change this to your movie width;
yScr = 400;//change this to your movie height;
_x = _root._xmouse > _x ? _root._xmouse-_width/2: _root._xmouse+_width/2; //all one line
_y = _root._ymouse > _y ? _root._ymouse-_height/2;
_root._ymouse+_height/2; //all one line
_x %= xScr;
_y %= yScr;
}
}
now this here function tests the mouse to see if it's ontop of the image. well actually, with this function (which should work) you won't be able to touch the image at all.
i hope this is what you want. note: this image isn't bound to anything, meaning it can move wherever the hell it wants when you try rolling over it. when you try and move it outside the movie dimensions, it appears on the opposite side of the screen, so that it isn't lost forever.
ebuprams
March 20th, 2002, 11:31 PM
thanx thoriphes
it works gr8 thanx a lot for ur time
Ebu
upuaut8
March 21st, 2002, 12:19 AM
My thanks also friend for answering the question for me. I'm trying to decypher a PERL script for a paying job and it's consuming me. :)
thoriphes
March 21st, 2002, 11:14 PM
actually, i my code was a bit off. there's one line you should fix, if you hadn't already:
this.onMouseOver should be this.onRollOver
and there's a semicolon where there should be a colon (:)
ilyaslamasse
March 22nd, 2002, 04:53 AM
That this.onRollOver feature is very disconcerting, I must say... Why didn't we stick to the old on (rollOver) ?? Does it bring anything ??
Oh, and Thoriphes, nice code ! I like those blabla ? a : b ; stuff cos I can never use them right :D
pom 0]
upuaut8
March 22nd, 2002, 05:57 AM
looks like mouse events have become methods like everything else.
upuaut8
March 22nd, 2002, 06:55 AM
oh I see.. what he's doing is MAKING onRollOver into a function by declaring it as such.
<~slapping self in forhead
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.