Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Moving The Mouse Position



Hi all,

is there a way to move the mouse cursor programatically?
Any idea?

thanks



ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0
Posted on: 05-22-2008, 02:08 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Moving An Mc According To Mouse Position....
but with a kind of elastic feel to it. like on http://www.centeroftheworld.com

how do i do this?

Moving MC According To _x Mouse Position
I'm creating a strip of 6 characters horizontally - 3 will fit on the screen at any one time, with the option to flick the mose left or right to scroll and see the rest , upon which case the clip flings itself in either direction, with easing, until its right or left most boundary is flush with the equivalent on the stage.

Here's what I have thus far;

SW = Stage.width/2;
MS = _root._xmouse;
MP = (MS-SW);
AC = (MS-MP)/5;
char_mc._x = (char_mc._x+AC);

With AC being accelleration (or the reverse), and char_mc the one that should be moving to its farthest ends if the cursor is there...

Thing is, the AC variable isn't changing, so the clip just flys to the right (or left, depending on how the other 2 vars are arranged).

Any help much appreciated.

Box Moving Due To Mouse Position
Ok I have placed a box on the stage and named it "box_mc" and have written some code to make it move opposite of the mouse...but when I start to move the mouse the other way, when it hits the threshold in the code it speeds up real quick. Do you mind telling me the error in the code...also can you let me know what I should put in the "else" portion of the code to have the box stop.

Here is my code.

_root.onEnterFrame = function () {
mouseX = (_root._xmouse/955*100)
if (mouseX>80) {
_root.box_mc.xSlideTo(box_mc._x-500, 0.4, "easeinoutexpo");
} else if (mouseX<20) {
_root.box_mc.xSlideTo(box_mc._x+500, 0.4, "easeinoutexpo");
} else {
;
}
}

Thanks for the help in advance.
Jo

Moving MC With X (coordenate) Of Mouse Position
Please, help me for this!

How I make to move an object in accordance with coordinate x of mouse (In ActionScript)??

Tks
Dudu

[F8] Moving Horizon To Mouse Position
Can anyone help me??

I love Flash, but cannot get my head around actionscript, I've been on a course, tried hundreds of tutorials but I'm a creative, not a programmer.

I'm trying to create a city scape which is divided into 3 sections; front, middle and back. I want the front and middle to move left and right slightly depending on the position of the mouse.

I've found several bits of actionscript which I've tried to adjust to suit my needs, the example swf (attached) uses the following bit of code on frame 01

Code:
mouse_x = _xmouse;
setProperty(this.cityFront_mc, _x, mouse_x+((getProperty(this.cityFront_mc, _x)-mouse_x)/1.9));
setProperty(this.cityMidFront_mc, _x, mouse_x+((getProperty(this.cityMidFront_mc, _x)-mouse_x)/1.5));
setProperty(this.cityMidBack_mc, _x, mouse_x+((getProperty(this.cityMidBack_mc, _x)-mouse_x)/1.2));
'cityFront_mc', 'cityMidFront_mc', and 'cityMidBack_mc' being the mc's to build up the city.

with

Code:
gotoAndPlay(1);
on the second frame.


My problems:
1. Getting the mc's to stop (or only move slightly) so that the edge of each 'piece of city' is not visable.
2. Getting the mc's to move at one pace (ie; without the easing effect achived in the attached swf).

Can anyone point me in the direction of a tutorial which may solve at least one of these problems. Number 1 ideally, I can live with number 2 for now.

Any sugeestions or a prod in the right direction would be greatly appreciated!

J-Woo

[F8] Moving MC To Mouse Position On Click
Hi there.. am really struggling with this.

i have an arrow that swivels to always point to mouse position. On mouseDown.. i need that arrow to quickly move to the point where the mouse clicked.. and then back to it's original position.

The arrow has this code on it:


Quote:




onClipEvent (enterFrame) {
mouse_x = int(_root.mouse._x-this._x);
mouse_y = int(_root.mouse._y-this._y);
if (mouse_x>0 && mouse_y>0) {
quad = Number(4);
}
if (mouse_x<0 && mouse_y>0) {
quad = Number(1);
}
if (mouse_x<0 && mouse_y<0) {
quad = Number(2);
}
if (mouse_x>0 && mouse_y<0) {
quad = Number(3);
}
abs_x = Math.abs(mouse_x);
abs_y = Math.abs(mouse_y);
tg = abs_y/abs_x;
_root.maths = Math.atan(tg)*Number(180)/Math.PI;
if (quad == 1) { angle = number(90) - number(_root.maths) }
if (quad == 2) { angle = number(90) + number(_root.maths) }
if (quad == 3) { angle = number(270) - number(_root.maths) }
if (quad == 4) { angle = number(270) + number(_root.maths) }
setProperty (_this, _rotation, angle);
}





- and im using a startDrag on an MC called 'mouse'.


I've modified a mouse-trailing code to move my MC to the mouse position on click.. but then of course it just follows the mouse:


Quote:




onClipEvent (mouseDown) {
_root.MC.onEnterFrame = function(){
this._x += (_xmouse - this._x)/_root.easing;
this._y += (_ymouse - this._y)/_root.easing;
}
}





Am pretty pushed for time so any help would be awesome..

Thanks a lot.

Moving ACTUAL Mouse Position
hi.

Is there any way in flash in which i can control the position of the mouse?
i need to be able to reset the mouse to a predefined position, but when i do _xmouse=value nothing happens and if i am using mouse._hide and have a movieclip instead of the mouse and do mc._x=value the movie clip goes to my position but as soon as i move the mouse it goes back to the previous position... i need a way to control the ACTUAL "ms windows" position of the mouse ... maybe with Javascript?

hope you can help!
thanks as always

Moving MC According To Horiz. Mouse Position
I'm creating a strip of 6 characters horizontally - 3 will fit on the screen at any one time, with the option to flick the mose left or right to scroll and see the rest .

I'm after a tute that covers moving the mouse left and right, and shifting a movie clip in the opposite direction (only along the x axis), with easing, and depending how far from the center of the screen the cursor is.

Anyone able to point me in the direction of a few? It seems to be used heavily in thumbnail based flash galleries.

Cheers

Moving An Object Relative To Mouse Position
I'm very new to actionscript, please help!!


I'm trying to get an object to move very slightly towards the mouse pointer as you move near it. To be honest I don't know where to start. Any help - much appreciated.

Moving Background Based On Mouse Position
hi...true newb here. could someone please tell me or atleast point me to a tutorial on how to achieve the effect where when you move your mouse to the right or left the background moves to the right or left? for a perfect example of what im looking for check out http://www.teamsleep.com thanks a lot in advance for anyone who can help.

Moving A Clip In Function Of Mouse Position
Hi!
I'd like to make a clip move (over time, slowly) in the direction of the mouse's position.
IMO, this includes refreshing two things :
a) the vector that is applied to the clip's position
b) the clip position
a has to be refreshed every times the mouse moves
b has to be refreshed every frame
I have found listeners like onMouseMove, but it is useful only for point a. To make the clip move even when the cursor is immobile, everytime in fact (point b), I need to execute a code every frame.
Is there such a listener, that is executed every frame ? Any advice ?

[F8] Buttons Moving Depending On The Mouse Position?
Hey there, the other day I saw a page that had this floating buttons than move slightly away from the mouse when you got near them and when you hover over one of them the others moved further away and then they returned to their original position when you moved the mouse away. Hope I made my self clear hahaha….. Anyway I was wondering if anyone knows how to do this or of some kind of tutorial that explains it and thanks for reading this post.

Animation Moving Depending On Mouse Position
is there a way to make an animation move in a move clip depending on how close the mouse is?

so for example...
for every 10 pixels the mouse moves towards the centre of the mc the animation within it moves forward 1 frame and likewise for ever 10 pixels away it moves back 1 frame ?

sorry if this is obvious and in tutorials somewhere - i just cant find it

Moving Through Frames Depending On Mouse Position
i'm trying to make a menu, but i can't type the code

i'm trying to make it so that my flash movie goes backward and forward in frames, depending on the mouse position. Kind of like here: http://www.kirupa.com/developer/mx/infinite.htm

but instead of moving the graphic i want it to scroll through the frames ..

please help me!

Moving Through Frames Depending On Mouse Position
i'm trying to make a menu, but i can't type the code

i'm trying to make it so that my flash movie goes backward and forward in frames, depending on the mouse position. Kind of like here: http://www.kirupa.com/developer/mx/infinite.htm

but instead of moving the graphic i want it to scroll through the frames ..

please help me!

Moving Vertical Bar Which Holds Moving Thumbnail Images When Mouse Is Over
Hi!

im not completely new to Flash MX - have utilised all basic animation tween/morphing /buttons
and very simple action script- movie controls - stop , back ,forward etc

however i need a moving bar feature, e.g. a moving news reel or a vertical bar which holds a number of images i.e.10 and
when the mouse is over - i want it to move downwards and when is not over the feature i want it to stop moving
(or even instaed of the feature to automatically scroll images i could also use a button to press to move through the images)

then: the thumbnail images from the moving feature i need to be selectable which then produces a larger version of the image on
another section of the page.

i dont no if i put this thread in the right forum!

if any one knows of any tutorials or has any suggestions to help implement this feature

i would appreaciate any help!
- dont really know where to start with it!
thanks

(i have looked at the flash kit tutorials but havent found what im looking for
dont even no if this is more of an animation or action script questions)

Mouse X Position To Control Movie Position?
Hi, my understanding of actionscript is very basic and I'd like some help with writing a very simple script. Basically the x position of the mouse should control the play position of a movie. Do I need something like an event handler (I'm not sure exactly what these do, but I've seen similar scripts that seem to use them).

Mouse. Hide, Mouse.show-on New Position
On button release i hide mouse because mc start to play
and on the end of that mc i show mouse agin.

Plese tell me how to move mouse in new position on screen with mouse.show() function

tenx,
m.

Moving Mouse Image Moving
hi everybody. i'm using flash professional 8 and i want to create something like this: http://www.kenzoparfums.com/FR/home/home_FR.html when moving the mouse on the stage the hole stage moves. how do i do that? thank you

Moving Across A Photo While Moving Mouse
Do you know how to do this?
As seen on 'http://www.pivotdesign.ca/'
main page.

Moving _x Position Of Browser
hey all

Im trying to make an effect like one on andy foulds old site, i have done all the bounce ball and bounds for the effect but when the ball hits the left or right walls, i want the pop up window to move 5 pixels to the left or right.

i have somethin like this

getURL("JavaScript:moveWindow(5)");

added into the bounds if loop. it clicks but it dont move (

Any ideas what im doing wrong?

Sorry if this is the wrong place to post this but in a way its actionscript!

Thanks alot all

Moving Cursor To Last Position ...
Is there a way to move the cursor(inserting point) to the end of the existing string in a input field.
I add automaticly some validating string in the beginning of the box.

Regards

Slowly Moving MCs ._x Position
hello,
I have a MC (line2) and when i click on different buttons, its x position changes.. the code below is what i am using... simple stuff so far.. how can i make it so that the line slowly moves to the new position, rather than just be there


Code:
_root.line2._x = 300;

Moving Mc To Position At Set Speed
Hi, Im making a menu and I want a line to move under a button when you roll over it, and then go back to its original position when you roll off,

I have the code to make it go to the position, and I can make that go back im sure, but I dont know how to stop it going there instantly.

on(rollOver){
line._x = button._x;
line._y = button._y;
}

how do i set the move speed?

Moving An X Position On MouseOver
Hey there,

I'm still fairly new to AS3.0 coming from 2

I'm making an image gallery, and for the thumbnail section, i need a slider, which was fine to do with 2.0

What I'm having trouble with is when I mouseOver an arrow, I need the x position to move

In 2.0, on the movieclips of the arrows I had the following

This would be for the right arrow, so the slider would move left


ActionScript Code:
on (rollOver) {
    this.gotoAndPlay("over");
    this.onEnterFrame = function(){
        if(this._parent.slider._x < 495){
            this._parent.slider._x = this._parent.slider._x+10;
        }
    }

}
on (rollOut) {
    this.gotoAndPlay("out");
    delete this.onEnterFrame;
}

Now I'm completely lost on where to go from here to convert it to 3.0...

I can't see it being a huge amount of coding, if I could just put it with the rest of the code rather than on the movieclip, then even better

Don't need any easing or anything...just simply to move it

Any help or suggestions on where to look would be great...I'm at work and don't want to keep looking...I don't even know why I'm always getting stuck on web projects haha

Mc Not Moving To Correct Position
Hi,
this is sort of a continuation of an earlier thread (that included lots of different things). I was helped by Icio to have a background mc follow the size of the stage, Thanks! but when trying to move another mc to a different place it doesn't go where it "should" but much too much to the right.
I have made the script always related to center stage but it doesn't work.
Code:
ActionScript Code:
var setStageW = 780;var setStageH = 580;function onResize() {    bgMc._x = setStageW/2-Stage.width/2;    bgMc._y = setStageH/2-Stage.height/2;    bgMc._width = Stage.width;    bgMc._height = Stage.height;}Stage.addListener(this);onResize();aboutMenu.onRelease = function() {    _root.aboutLine.newx = Stage.width/2;    trace(_root.aboutLine._x);    _root.aboutLine.newy = (Stage.height/2)-230;};
and here is the code that I have on the mc:
ActionScript Code:
onClipEvent (load) {    newx = this._x;    x = 390;    newy = this._y;    y = 290;}onClipEvent (enterFrame) {    y+= ((newy-y)/3);    this._y = y;    x += ((newx-x)/3);    this._x = x;}
I have attached the file too.
What is it I am doing wrong?

Moving _x Position W/easing?
I have a gallery with a menu that is a row of
thumbnails (horizontal--right to left). And a button
on each side of the tumbnail menu---and of course when
you click on the right button the menu scrolls to the
right and vise-versa for the left button. The code I
have on the buttons is pretty basic:

right_btn.onRelease = function(){
menu_01._x -= 20;
}

I'm trying to set-up the menu so that when you click on one on the buttons
the menu slides over so many pixels and eases out. And I also need the
buttons to know when the menu mc has reached its end(say the menu is only 400
pixels wide). I've tried a few different things with no luck.

Any idea's or direction to a tutorial???

I would really any help.

thanks,
hutch

Moving MovieClip Position(setproperty)?
I need to move a movie clips position using the setproperty action. I have the addressing done but don't know what numbers to put in the action.
Example:
on (release) {
_root.mc1.mcblue.setProperty ("", _y, "");
}

Mcblue is the movie clip that I want to move, but I dont know what numbers need to go in the "" marks. I want the button to make the clip move down.

Also I need to use set property to rezize a movie clip larger and smaller. Would I use y and x scale or width and height? and how would these be set?

Change Position Value Without Moving Object. HOW?
Hi..

I'ma newbie and was watching a tutorial on creating a scrollbar. In the example he had some content to scroll thru a masked window that would be control by a drag scroll bar.

Just before he began with the scripting those 2 objects, one at a time, in the properties panel.. he did something off screen (sounded like he was hotkeying).. but while he was doing it, he said... "OK, before I start scripting I'm going to 'force' the y value to equal zero for both objects." He said it was easier for scripting.

How did he force the y value to say 0 in the properties and info panel WITHOUT the object changing position on the stage??

thanks,
frank

Moving To Position In Dynamic Text.
Hello all,

I am working with a block of dynamic text that is being loaded from an external text file. Imagine it looks like this:

Image 1:
Some text here.

Image 2:
Some text here.

Image 3:
Some text here.

You get the idea. This text is in a scrolling text box. What I'd like to happen is when the function gotoImage2() is executed, the text scrolls the down to Image 2 so that it is at the top of the text box. Make sense?

Seems like a variable needs to be embedded in the text file, but I have no idea how to do the rest.

I also can't get any of my custom scollers to work. They all embed the text in a masked mc. Is this the only way to scroll dynamic text? Any good pointers to smooth text scroller tutorials would be appreciated.

I'm using Studio 8.

Scrollbar Moving The Position Of An Image
I have a horizontal scrollbar. I want this scrollbar to move a movie clip left and right on the screen.

I cannot figure out what I am doing. In one example I'm looking at, it has the script on the button of the slider:

onClipEvent(mouseMove){
_root.vPosition = _root.SliderMC.ButtonSliderMC._y * 5 / 6;
}

I can't figure out the math for my scrollbar. How do I find the fraction that is in this part of the script? The numbers are not matching up for me. I also can't get my slider to go left to right. It keeps going down. And my image that is suppose to be scrolling the with slider is not even moving.

Can anyone please help? I've spent my whole week working this out. I'd really appreciate it. If you know of any step by step tutorials, that would help too. Thanks.

maria-

Moving Scoll Position In ListBox
I want to be able to move the list names of the listbox up and down can this be done through actionscript

or is there any way to bring the selected item to the top

Urgent, Please Help Moving X Position In This Code
Hi people!

I have this script, that zooms and fades the movieclip but i also need to shift the position slightly from the start state to the end state.

For example var startX = 60 var endX = 70 so when the zoom start it starts at x = 60 and slowly moves as it zooms out to x = 70.

Can anybody help please?

Moving Local X Position With Momentum
Last edited by iamkyle : 2003-01-04 at 08:38.
























Ok here's the deal. I need to be able to move a movie clip 300 pixels each time you hit a button. But i also want that movie clip to have momentum so it slows down as it comes closer to it's destination. here's what i got so far.

//heres the button code

on (release) {
x = _rood.grid._x-300;
_root.controller.gotoAndPlay(2);
}

// here's the controller code
// frame 1
stop ();

//frame 2
startx = _root.grid._x;
dif = x-startx;
_root.grid._x = startx+(dif/5);

//frame 3
gotoAndPlay(2);

that only moves it once, 300 pixels to the left.
i need it to be able to move 300 more to the left each time you hit the button
plus i have 3 other arrows so if you click another it needs to move either up, over, or down 300 px from where it is.

If anyone can PLEASE help , that would be GREAT. Thanks in advance

Kyle

Moving A Symbol From Random X Position Across Screen.
I am trying to create a rain type effect, but i don't know how to using actionscript. I want the rain symbol to start at a random location above the stage, and then fall at an angle to the bottom. I also want the rain symbol to start to fall at different times. If you can help me with this i would greatly apreciate it.

Moving Movie Clip To Target Position
targetx = ???

xdiff = targetx - (movieclip._x)

movieclip._x = movieclip._x + (xdiff/2)

im using this script to move a movie clip to a target x position when a button is clicked. (the xdiff is for decleration btw)
this works fine, except when the target x is a negative number, then it goes haywire.
how to solve this anyone?

Animate Moving Object To Fixed Position
in flash 5 i would like to do the following.

a circle is moving around within a fixed area.

as soon as the mouse comes within a certain distance of the
circle the circle should move to a fixed position (say x=50, y=200).

no hassle to make the circle move around. no hassle to detect where
the mouse is in relation to the circle. but how can i make the circle
to take the shortest possible way to its fixed position, taking into
consideration that the circle is moving around. sure you could tell
the circle to take the position of x=50 y=200 as soon as the mouse
comes within a certain distance of the circle, but i actually want to
see the circel move to that position. can anyone lead me to the right track of thinking.

again, i would really like to do this in flash5, but in the unlikely event that this can only be done in flash mx, please let me know.

thanks

hansie

Moving Object: Return To Base Position First
Hello,

I have the following problem: i want to move an object (graphic/movieclip/whatever) to different positions by the use of several buttons. The problem is however that I dont know how to do this..hehe..is there some code to let the object first return to the start position, and after this to the position it is assigned to? Or is it also possible that, through actionscript, the object directly "tweens" towards the designated position?

Hope someone can help me with this.

Stopping A Movie Clip From Moving At Specific X Position
I have created a simple movie where I am moving a movie clip using buttons with action script. I have everything moving the way I want it to but I am looking for some code to set a limit to how far it will move in order for it to stop within the masked area.

Right now my code looks like this...

moveLeft.onRollOver = function() {
rocket.onEnterFrame = function() {
this._x -= 8;
};
};
moveLeft.onRollOut = function() {
delete rocket.onEnterFrame;
};
moveRight.onRollOver = function() {
rocket.onEnterFrame = function() {
this._x += 8;
};
};
moveRight.onRollOut = function() {
delete rocket.onEnterFrame;
};


Any help would be much appreciated

Drag And Drop - Moviclip Moving Back To Old Position
Hi Guys

I am learning to do a drag and drop, basically say I got A movieclip called 'clipdrag'. the current position of the movie clip is _x=65, _y=51.

and the clipdrag movieclip is droped at say _x=200, _y=300.
Bascally what i need to know is how i got about bring the clip back to its orangial position, i want to use a timer so that the user can see the clip moving back slowly.

please can anyone help
thanks
orange

Drag And Drop - Moviclip Moving Back To Old Position
Hi Guys

I am learning to do a drag and drop, basically say I got A movieclip called 'clipdrag'. the current position of the movie clip is _x=65, _y=51.

and the clipdrag movieclip is droped at say _x=200, _y=300.
Bascally what i need to know is how i got about bring the clip back to its orangial position, i want to use a timer so that the user can see the clip moving back slowly.

please can anyone help
thanks
orange

Moving X/y Position Of An Entire Group Of Layers/keyframes/tweens
i have a flash movie that's 518x82. the movie now needs to be 760x480. the original section (the 518x82) needs to now be in a different position (when i enlarge the document size, the old portion defaults to the upper left corner)- i have to move the entire movie to new coordinates w/in the larger document.

how do i do that without having to move each individual image at each keyframe within each layer (that would take about 3 days)?

i've tried inserting a .swf into a new document - same problem. i've attempted to use action scripting (this._totalFrames...blah blah) but it's not working (no surprise there - i'm a designer, not a programmer).

there's go to be a better way? please help!

thanks!!!

Position Of Mouse = Position Of MC
How would I tell a movie clip to move along with the mouse without dragging. Also how would I define the area to which the movie clip can move?

Mouse Position ?
Here is my problem ..... i want 2 lines to follow my mouse ... like a X and Y line, but am not sure how to do this . i would like somthing like this
http://www.yigal-azrouel.com/

If anybody could please help me it would be greatly apreacted . If posible could i get some code??? to use as an example .
thanks.

Mouse Position?
Where I dit it wrong?
I want to get dynamicly y position of mouse in text box.

on the first frame I typed:

" var y = 0; "


and on movie action I typed:

"
onClipEvent (mouseMove) {

y = _root._ymouse;

updateAfterEvent();
} "

Thank you in advance

Mouse Position
How can i read the current mouse position on the x and y axis and output this to the screen?

Thanks

Position Of Mouse
is there a function that gives the position of the mouse? I've tried it with a drag movieclip and then reading the x and y coordinates .. .it works but there can only be one movieclip that can be dragged at a time .. so i tried a while (thrue) construction but it didnt work to so any suggestion?

Mouse Position
Hello,

I am trying to detect on the main timeline when the mouse is within a box or certain coordinates. Then once it is within these coordinates the movie will go to frame 2. Then once it is outside these coordinates then it will go back to frame 1. Is this possible.

If it helps an example of the coordinates of the box are

Top Left x=75 , y=23
Bottom Left x=75 , y=70
Bottom Right x=150 , y=70
Top Right x=150 , y=23

I hope this makes since.


This is what I put on the first frame of the main timeline. Nothing happened at all.

if (_ymouse >= 23 && _ymouse <=70 && _xmouse >=75 && _xmouse <=150) {
gotoAndPlay ("Scene 1", 2);
}

Thanks for any help!

Mouse Position. How?
Hi all,

Hope someone can help with this one.

Im trying to get the mouse cursor to change it's position on the screen when a button is clicked.

So when u click the button, the mouse jumps to the top corner of the screen.

any ideas?

Copyright © 2005-08 www.BigResource.com, All rights reserved