PDA

View Full Version : item movement on mousemove....


somdow
05-07-2007, 05:18 PM
sry it may sound confusing but i dont exactly know what to call this....but i want a certain item (or 2) to move when the mouse moves the opp direction


example

http://www.rollups.com.au/

hit "join later" then once it goes in....this is more or less what i want to create...the movement of the stage items when the mouse moves

any ideas

PS, sorry if this is in the wrong place

Dazzer
05-08-2007, 01:04 AM
You will probably have a mask that will track the movement of the mouse (MouseEvent.MOUSE_MOVE). Then this mask will move the objects around depending on the location of the mouse


mask.addEventListener(MouseEvent.MOUSE_MOVE, MouseMoved,false,0, true);
function MouseMoved(e:MouseEvent):void
{
trace(e.localx);
trace(e.localy);
}

somdow
05-08-2007, 02:17 AM
You will probably have a mask that will track the movement of the mouse (MouseEvent.MOUSE_MOVE). Then this mask will move the objects around depending on the location of the mouse


mask.addEventListener(MouseEvent.MOUSE_MOVE, MouseMoved,false,0, true);
function MouseMoved(e:MouseEvent):void
{
trace(e.localx);
trace(e.localy);
}



sry but, im not getting it, like, whats the first step to this? say i have all the items i want on the stage, what do i do next...

also if you dont feel like explaining this....got any tutorials i could check out or a sample??? i just dont get it :jail: lol thanks

somdow
05-09-2007, 12:44 PM
sry but, im not getting it, like, whats the first step to this? say i have all the items i want on the stage, what do i do next...

also if you dont feel like explaining this....got any tutorials i could check out or a sample??? i just dont get it :jail: lol thanks

does anyone know what this effect is even called? id google it to learn more but dont what im exactly looking for

Dazzer
05-09-2007, 08:55 PM
the first step is adding an Event Listener to watch for any mouse movement. You pass it a function as a parameter, and when the event triggers it will call the function passing it details of where the mouse is, what it did, whether it was clicked or what not.

somdow
05-11-2007, 09:44 AM
the first step is adding an Event Listener to watch for any mouse movement. You pass it a function as a parameter, and when the event triggers it will call the function passing it details of where the mouse is, what it did, whether it was clicked or what not.ok lemme ask u this....is there a tutorial anywhere around here? i get/ understand what your saying but have no way/idea of how to go about it. not too good on this actionscript ishh.

Dazzer
05-11-2007, 12:53 PM
- looks for senocular -

Unfortunately, AS3 is rather new. So finding a tutorial would be a little hard.
Senocular writes the tutorials, so he will be able to help you

Senocular = :pope:

senocular
05-11-2007, 01:05 PM
You may find tutorials for AS2, but not AS3.

Though the concepts would be the same, there would be a lot of differences in syntax and commands used. Also, for global mouse movement detection in AS3, you need to listen to stage (since non-stage mouse movement occurs only when the mouse is over that object).
stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoved);
Then, in the mouseMoved function you would move all your movie clips based on the position of the mouse. The general forumal behind that is
x = stage.stageWidth - mouseX;
where x would be the x location of the object, stage.stageWidth is the width of your vieable area (using stage.stageWidth does this for the whole SWF, you might want to use a different area), and mouseX is the mouse location within the coordinate space where the target object exists. Quick example:
var mover:Sprite = new Sprite();
mover.y = 100;
mover.graphics.beginFill(0);
mover.graphics.drawCircle(0, 0, 30);
addChild(mover);

stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoved);
function mouseMoved(event:MouseEvent):void {
mover.x = stage.stageWidth - mouseX;
}

somdow
05-11-2007, 01:15 PM
shoot if i can get it in AS1 even better lol

hit me up lol