Moving Mc Towards The Move Slowly Towards The Mouse
Hiya newbie here
I just want to know how to move a movieclip towards the mouse slowly.
i have used this code to get the mc to the mouse, but i am stuck on how i make it move slowly towards it.
please help
thanks
onClipEvent(enterFrame){
this._x = _root._xmouse;
this._y = _root._ymouse;
}
KirupaForum > Flash > Flash 8 (and earlier) > Flash MX
Posted on: 02-22-2005, 09:29 AM
View Complete Forum Thread with Replies
Sponsored Links:
Resize MC On Mouse Move Without The MC Moving
Hey there.
I am trying to make an MC resize when the user clicks on it and drags the mouse up and down. But the MC shouldn't be moving, it should only get smaller/bigger.
Any ideas ?
(I have recently used this code, but that enables the MC to be dragged up and down
code: function drag() {
kasse1Pan.kasse1.startDrag(false, -400, -150, 400, 150);
kasse1Pan.kasse1.onEnterFrame = function() {
pan = 0.25*this._x;
vol = (this._y + 150)/300*100;
kasse1Sound.setPan(pan);
kasse1Sound.setVolume(vol);
kasse1Pan.kasse1._xscale = vol+54
kasse1Pan.kasse1._yscale = vol+54
};
}
function drop() {
kasse1Pan.kasse1.stopDrag();
}
kasse1Pan.kasse1.onPress = drag;
kasse1Pan.kasse1.onRelease = drop;
kasse1Pan.kasse1.onReleaseOutside = drop;
View Replies !
View Related
Movieclip Move When Mouse Is Moving?
how do I make a movieclip object move towards the mouse, but only when the mouse is moving, not move by itself when the mouse is static?
say when the mouse is at the mc's 0,0 axis, and moves away from the mc, the mc moves in the other direction to a certain point, but stops when the mouse stops moving?
View Replies !
View Related
Mouse Move, Moving Movie Frames?
Hi all, I have a movieclip that is 100 frames long. Id like to make it that when you move the mouse over it, moving the mouse left moves the MC ahead frames, and moving the mouse right makes the MC run back frames.
Any help is greatly appreciated.
Thank You
View Replies !
View Related
[F8] Moving An MC In The Opposite Direction Of Mouse Move
Hi,
Does anybody know how to make a Movie Clip go in the opposite direction that the mouse goes in on a ratio? (e.g. when you move your mouse right the movie Clip slightly left)
Here is a pretty good example of what I am looking for.
I've tried
code:
Xcenter = 275;
Ycenter = 200;
_root.onEnterFrame = function(){
_root.bg_mc._x = Xcenter - _root.xmouse;
_root.bg_mc._y = Ycenter - _root.ymouse;
}
But it did'nt work at all, could somebody please help me?
I'd be grateful for any help
View Replies !
View Related
I Can't Pick My Mouse Over Image And Move It Without Moving The Whole Button
ok i have these buttons, that as you mouse over one button a description appears that is in a different spot. Now I did this once and for the life of me I can't figure out how i did it. Now I can't seem to move the second part of my mouse over text and even though I keep attempting to pick a place on my time line, it won't let me only move that object. What am I doing wrong?
Here's a sample of what I have - my client just sent me new japanese text to put in these spots. Hopefully you can help me out
http://www.zoulo.com/japan.html
kaaren001@aol.com
View Replies !
View Related
Slowly Moving Smoothly - Moving Photos And Pixel Smoothing
So, I'm slowly....very slowly moving a small thumbnail across my stage. The problem is that when the pic moves over a pixel it looks choppy, I want it to look smooth. The border of it looks especially choppy, it's distracting from the site.
Is there a pixel-smoothing option for the stage? or some equivalent?
Does my question even make sense?
Please help.
Thanks
View Replies !
View Related
OnMouseOver MovieClip Move Slowly
Hello,
I am trying to create a slideshow and when the user hovers (rolls over) a down arror, the slideshow gradually moves up or down.
I've attached the file, does any one know I can get the slideshow of images to move slowley?
Cheers, Rob
View Replies !
View Related
How To Make The Object Move Back Down Slowly?
ok you know when on a button it may "move up" or somthing and then you get off the button and it pops righ back into place.. how do u make it move slowly and fluently back to the posision.. liek if the is a block and then you but the mouse over it and it moves slowly taller then you take it off of the button and it slowly moves back to the orignal state? what code do i need for this...?
View Replies !
View Related
How To Make An Object Move Slowly Then Stop ;_;
Hello,
This is my first time to post here.. and am new to Flash ^_^;;
ummm.. i want to make an object that moves horizentally in a movie clip..but I dont know how to make it move slowly then gradually stop..! I tryed playing around with the ActionScript ..but no luck ;_; plz help..
Thanks Alot..
OniHime
View Replies !
View Related
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;
View Replies !
View Related
Moving A Movieclip Slowly
I have a movieclip in my flash movie that is set to drag on a mouse press. When it is released it snaps back to the specified
x and y coordinates. I want the movement to be slow and not to fast. Is this possible?
Code:
shania.onPress = function() {
shania.startDrag();
};
shania.onRelease = function() {
stopDrag();
shania.swapDepths(0);
shania._x = 434.1;
shania._y = 224.6;
shania._alpha=20;
};
View Replies !
View Related
Slowly Moving Mc Is Jerky
I am trying to move an image slowly across the stage but it looks jerky when it is slow. For testing I also replaced the image with a simple square shape and it still looked jumpy. The animation looks like it is jumping one pixel at a time.
During testing I alway put the frame rate at 30fps although I dont think this matters except when I tried it using the onEnterFrame.
I have tried using the tween class and set interval as well as onEnterFrame to move it and it looks OK fast but no matter what I do as soon as I slow it down it looks jumpy or jerky.
The effect I am looking for is to slowly move the image and then fade into another slowly moving image.
Here is a sample of a couple of the ways I have tried.
***********************************
this.attachMovie("img1", "imgOne", this.getNextHighestDepth());
imgOne.cacheAsBitmap= true;
imgOne._x= 0;
imgOne._y= 0;
import mx.transitions.Tween;
import mx.transitions.easing.*;
function movePic() {
var tw:Tween = new Tween(imgOne, "_x", None.easeNone, 0, -92, 10, true);
var tw2:Tween = new Tween(imgOne, "_y", None.easeNone, 0, -57, 10, true);
updateAfterEvent();
}
movePic();
***********************************
this.attachMovie("img1", "imgOne", this.getNextHighestDepth());
imgOne.cacheAsBitmap= true;
imgOne._x= 0;
imgOne._y= 0;
var nTimes:Number;
var nInterval:Number = setInterval( movePic, 100 );
function movePic():Void {
imgOne._x++
imgOne._y++
updateAfterEvent();
nTimes++;
if(nTimes > 100){
clearInterval(nInterval);
}
}
***********************************
Thank you
Greg
View Replies !
View Related
AS3 Movieclip Moving Slowly
I have a game where the FPS are calculated on an On Enter Frame event...
and I have another event that listens for key presses (other for mouse events... but all are disabled...)
And I have game tiles loaded onto a movieclip in the following order...
Flex2Canvas.rawChildren.addChild(map);
map.addChild(thetilecliphere); <- that part is looped alot...at the start to generate the tiles
And then I go and press the down button, and move 'map'... and the game FPS drops from 40 to 10... so i moved the canvas, and it still droped... but nothing moved (strange), and then i went child by child moving them, and it moved again, but still the 10fps...
I tried cacheAsBitmap... and nothing... I would post the code, but with all the stuff inbetween it... it's like 700 lines long.... i'm giving a general over view... Is the problem based on the fact that I'm using the flex canvas to work off of?? Is there any way I can do my own 'canvas' like mc... that falls under the canvas, and before all the GUI? I tried adding children to the canvas and it didn't work.
View Replies !
View Related
Exteranal Swfs Moving Very Slowly
In Flash 5 i'm loading external swfs into empty movie clips..The problem is that the animations inside them are playing very slowly.. Increasing the frame rate doesn't do anything, and if i shorten the tweens, it just makes things more choppy and sloppy looking, rather than smooth....
View Replies !
View Related
Slowly Moving Mc Is Jerky Or Jumpy
I am trying to move an image slowly across the stage but it looks jerky when it is slow. For testing I also replaced the image with a simple square shape and it still looked jumpy. The animation looks like it is jumping one pixel at a time.
During testing I alway put the frame rate at 30fps although I dont think this matters except when I tried it using the onEnterFrame.
I have tried using the tween class and set interval as well as onEnterFrame to move it and it looks OK fast but no matter what I do as soon as I slow it down it looks jumpy or jerky.
The effect I am looking for is to slowly move the image and then fade into another slowly moving image.
Here is a sample of a couple of the ways I have tried.
code:
this.attachMovie("img1", "imgOne", this.getNextHighestDepth());
imgOne.cacheAsBitmap= true;
imgOne._x= 0;
imgOne._y= 0;
import mx.transitions.Tween;
import mx.transitions.easing.*;
function movePic() {
var tw:Tween = new Tween(imgOne, "_x", None.easeNone, 0, -92, 10, true);
var tw2:Tween = new Tween(imgOne, "_y", None.easeNone, 0, -57, 10, true);
updateAfterEvent();
}
movePic();
code:
this.attachMovie("img1", "imgOne", this.getNextHighestDepth());
imgOne.cacheAsBitmap= true;
imgOne._x= 0;
imgOne._y= 0;
var nTimes:Number;
var nInterval:Number = setInterval( movePic, 100 );
function movePic():Void {
imgOne._x++
imgOne._y++
updateAfterEvent();
nTimes++;
if(nTimes > 100){
clearInterval(nInterval);
}
}
Thank you
Greg
View Replies !
View Related
Script For Cartoonified Animation (Move Head Back Slowly)
Hi People,
Iv'e done most of this little animation but i came to a problem. When i move away from the targeted area with the cursor the head just moves quickly back to the default area. BUT what i want it to do is when the cursor is out of the targeted area i need the head to move back to its original space slowly. If this is possible? Any help i would be highly grateful!
As seen in the attachment.
Thanks for all your help!
Carl Taylor
View Replies !
View Related
Script For Cartoonified Animation (Move Head Back Slowly)
Hi People,
Iv'e done most of this little animation but i came to a problem. When i move away from the targeted area with the cursor the head just moves quickly back to the default area. BUT what i want it to do is when the cursor is out of the targeted area i need the head to move back to its original space slowly. If this is possible? I'd be highly grateful for any help!
As seen in the attachment.
Thanks for all your help!
Carl Taylor
View Replies !
View Related
Moving A Picture Slowly, But Smoothly... Ideas?
I have a .gif placed in a MC that I am using as a background for my flash movie.
I wanted the background to have a scrolling effect, so I added the following script to it's instance:
onClipEvent (load) {
_x = -100;
}
onClipEvent (enterFrame) {
_x += .5;
if (_x == -2) {
_x = -100;
}
}
This makes it so that the picture starts at -100, scrolls right until it reaches -2, then jumps back. Giving it a continuous scrolling look.
Anyway, I think it is a little too fast, so when I tried to slow it down some by changing the _x += .5; statement to _x += .25;, It does slow down, but it gets really jumpy-looking.
Is there any way for me to slow this down and have it still retain it's smoothness?
(I'm using Flash MX and this movie is at 30fps.)
Go here to see what it looks like now when it is set to .5
Thanks!
Lee
View Replies !
View Related
Carousel - Slowly Stops Moving On Boundaries
Hi,
I want the carousel to stop moving slowly when you get over the boundaries.
In the code below the carousel stops immediatly (speed 0):
Code:
this.onMouseMove = function() {
if (this._ymouse<20 || this._ymouse>150 || this._xmouse<20 || this._xmouse>780) {
speed = 0;
} else {
speed = (this._xmouse-centerX)/4000;
}
};
Thanks in advanced,
Bye Mario :)
View Replies !
View Related
Trigonometry - Rotate Slowly To The Mouse
ive got this problem, i know how to check the angle between my object and the mouse, but i dont know how to make it rotate slowly to it...
i tried this codes:
ActionScript Code:
//first method:onClipEvent (enterFrame) { this._rotation = (Math.atan2(_root._ymouse-this._y, _root._xmouse-this._x))*180/Math.PI;}//(this one doesnt have slow movement, it was just to know my code was working to detect the mouse angle)
ActionScript Code:
//second method:onClipEvent (enterFrame) { this.targetRotation = (Math.atan2(_root._ymouse-this._y, _root._xmouse-this._x))*180/Math.PI; if (this.targetRotation-this._rotation>6) { this._rotation += 6; } else if (this.targetRotation-this._rotation<-6) { this._rotation -= 6; }}
ActionScript Code:
//third method:onClipEvent (enterFrame) { this.targetRotation = (Math.atan2(_root._ymouse-this._y, _root._xmouse-this._x))*180/Math.PI; if ((this.targetRotation<0 ? this.targetRotation+360 : this.targetRotation)-this._rotation>6) { this._rotation += 6; } else if ((this.targetRotation<0 ? this.targetRotation+360 : this.targetRotation)-this._rotation<-6) { this._rotation -= 6; }}
ActionScript Code:
//fourth method:onClipEvent (load) { this.rot = this._rotation+360;}onClipEvent (enterFrame) { this.targetRotation = (Math.atan2(_root._ymouse-this._y, _root._xmouse-this._x))*180/Math.PI; if (this.targetRotation+360-this.rot>6) { this.rot += 6; } else if (this.targetRotation+360-this.rot<-6) { this.rot -= 6; } this._rotation = this.rot;}
none of them worked
can somebody help me??
View Replies !
View Related
Move Movieclip Vertically On Mouse Move
Hi, i wondered if anyone would be able to help me.
I want to create the same effect as what is used on the URL below
http://www.jobescalator.com/vacancie...ctive_map.html (scroll over the map)
I want a horizontal bar to move up and down the page as and when my mouse moves.
Can anyone help?
Thanks
View Replies !
View Related
How To Move An Object Slowly And Smoothly From Location 1 To Location 2?
Hi,
I am new to ActionScript. I wish to use ActionScript to move an object slowly and smoothly from location 1 to location 2.
I learned that I can use the following to move an object to location 2 (x2, y2):
mThisObject.x = x2;
mThisObject.y = y2;
However the object just "swift" from location 1 to location 2, not moving slowly and smoothly from location 1 to location 2.
Could some experts here provide a guideline for me?
Thanks and best regards
Alex
View Replies !
View Related
Flash Component Loads Slowly Or Renders Slowly
Hi,
Does anyone have a problem with flash 8 components loading very slowly. I have a mainmovie page that loads other .swf files into a movieclip. The sub movie has got flash 8 components, basically, 4 buttons, 4 datefields, one combo box, one menu bar and one datagrid. When i load the sub movie into the mainmovie, the components flashes for a second and then shows the components. I use a moviecliploader as well to hide the loaded movie and only after it's loaded then show the loaded movie, still the components flash.
Any ideas as i have been trying to solve this for about 5 hours now. Any help much appreciated.
Thanks
View Replies !
View Related
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)
View Replies !
View Related
Swarm To Mouse W/ Elasticity And Move Randomly W/ No Mouse
I started another thread where i had gotten help and combined the snow tutorial and the programatic mask tutorial to create particles that reveal an in-focus image over a blurred one. I just need help making the particles swarm around the mouse when it is present and have the particles just float around when not.
Presently the random motion is just fine and looks like this (i just inverted the this._x and this._y so that they would go with the mouse direction not away from):
ActionScript Code:
onClipEvent (enterFrame) { // horizontal movement rad += (k/180)*Math.PI; xmovement = _root._xmouse; this._x -= (Math.cos(rad)+(xmovement-(width/2))/50)*-1; // vertical movement ymovement = _root._ymouse; this._y -= (Math.cos(rad)+(ymovement-(width/2))/50)*-1;}
"width" and "height" are variables that refer to the size of the movie.
All the mouse trail FLAs i could find just sort of stuck in the corner if you moused off the flash movie. I would like to make it so the particles return back to their little merry random paths after you have moused off the movie.
Any tips or examples you could point me to would be great. Thanks!
View Replies !
View Related
Swarm To Mouse W/ Elasticity And Move Randomly W/ No Mouse
I started another thread where i had gotten help and combined the snow tutorial and the programatic mask tutorial to create particles that reveal an in-focus image over a blurred one. I just need help making the particles swarm around the mouse when it is present and have the particles just float around when not.
Presently the random motion is just fine and looks like this (i just inverted the this._x and this._y so that they would go with the mouse direction not away from):
ActionScript Code:
onClipEvent (enterFrame) { // horizontal movement rad += (k/180)*Math.PI; xmovement = _root._xmouse; this._x -= (Math.cos(rad)+(xmovement-(width/2))/50)*-1; // vertical movement ymovement = _root._ymouse; this._y -= (Math.cos(rad)+(ymovement-(width/2))/50)*-1;}
"width" and "height" are variables that refer to the size of the movie.
All the mouse trail FLAs i could find just sort of stuck in the corner if you moused off the flash movie. I would like to make it so the particles return back to their little merry random paths after you have moused off the movie.
Any tips or examples you could point me to would be great. Thanks!
View Replies !
View Related
[F8] How To Move 3 Graphics By Only Moving One
I have an unusal request.......
I want to animate an arm but by only moving 1 part. How I plan to achieve this is to create the arm out of 3 parts :
1) The upper arm
2) fore arm
3) hand.
But I want to animate the whole arm based solely on moving the hand.
By moving the hand in any direction, the rest of the arm will follow as if it was real. Ie, I want the upper arm to move from a fixed (solid) point (ie the shoulder rotation point).
The forearm will obviously have to move in 2 directions, 1) to follow the hand pivot point and 2) to pivot at the elbow and move the upper arm around it's shoulder pivot point.
I suppose it's best explained in the attached jpg file.
Any way of doing this ?
View Replies !
View Related
Moving Move Clip
I have an image viewer that displays different pics and moves them within a small window.
The problem is they start moving fast and then to slow towards the end.
Can anyone help me control the speed and distance they move.
I attached a sample, I'm working with Flash 6
View Replies !
View Related
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
View Replies !
View Related
Move Registration Point Of Mc W/o Moving Mc?
Hi,
Does anyone know if it's possible to move the registration point of a mc to a different location on that clip without having to move the mc at all? I've been having to move the mc around to line it up as I'd like with the point, but this makes for difficulties and annoyances if the mc needs to remain in the same location.
TIA,
aaroneousmonk
View Replies !
View Related
Testing For Mouse Down AND Mouse Move
I'm having some issues with MX and event handlers. Here's what I've got currently:
Code:
hitState.onMouseDown = function() {
hitState.onRelease = function() {
// user has single-clicked - set flag
click = true;
}
if (click==true) {
// this should cancel function
return;
}
hitState.onMouseMove = function() {
// do this only when mouse is down and moving
}
};
Essentially, I need a certain action to take place when the user clicks-and-drags. But not if the user ONLY single-clicks.
So I have the onRelease function set a flag. This flag, in the next statement, calls 'return'. My understanding is, this should stop the current (onMouseDown) function and not execute any more code, but it doesn't seem to work.
I need to either figure out why the 'return' statement isn't working, or find a way to test if the mouse has been pressed AND if the mouse is moving.
Any help?
Quasi
View Replies !
View Related
Help Making Char.'s Feet Move Whil Moving
i have a character that i've made move around the screen using the arrow keys. but There's one more thing i want to do with it. I want to make it so that when i press either up or down that the feet move, i've already got the animation. but what would the code be to get the second frame of a Movie clip to animate when on of those keys are pressed. and then return to the first frame when the button is released.
I have tried coding it myself, but it's crap
Frame 1 - Label "Stand"
stop();
if (Key.isToggled(Key.UP)) {
gotoAndPlay("Stand");
}
if (Key.isToggled(Key.UP)){
gotoAndPlay("Stand");
}
Frame 2 - Labeled "Walk"
stop();
if (Key.isToggled(Key.UP)) {
gotoAndPlay("Stand");
}
if (Key.isToggled(Key.UP)){
gotoAndPlay("Stand");
}
Any help?
View Replies !
View Related
Move On Mouse-move
peepz i have this script on a movieclip:
Code:
onClipEvent (load) {
_y = 20;
speed = 1;
}
onClipEvent (enterFrame) {
if(_y <= 0 or _y >= 297){
_y += 0
}else{
endY = 320-_root._ymouse;
_y += (endY-_y)/speed;
}
}
my problem is that if the movieclip is on 0 it stops and if i move the mouse it will not start moving again :?
please help?
View Replies !
View Related
Move MC On Mouse Move
Hi all . How to move this MCnavigation on mouse move. For example if I move my mouse to the right the MC Navigation text moves to the left and mouse to the left it moves to the right.
Example file: http://lex.zeelex.com/navigation.html
Is there any components can help me move it.
View Replies !
View Related
Question About Boundaries And Moving To Next Scene If The Character Move To The Door
Hi,
Sorry to trouble you guys again, thanks for the great advice some of you have given me. Well i am facing some queries, hope you guys can help me out.
First
I have written codes for boundaries/walls that it should let the moving character stay in the space in it, but after some tries, it still fails.
My character code:
onClipEvent (load) {
moveSpeed = 3;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
this._x += moveSpeed;
} else if (Key.isDown(Key.UP)) {
this._y -= moveSpeed;
} else if (Key.isDown(Key.DOWN)) {
this._y += moveSpeed;
} else if (Key.isDown(Key.LEFT)) {
this._x -= moveSpeed;
}
}
My walls/boundaries code:
Wall 1:
onClipEvent (enterFrame)
{ if (this.hitTest(_root.Wall))
{ _x = _x+10;
}
}
Wall 2:
onClipEvent (enterFrame)
{ if (this.hitTest(_root.Wall2))
{ _y = _y+10;
}
}
Wall 3:
onClipEvent (enterFrame)
{ if (this.hitTest(_root.Wall3))
{ _y = _y-10;
}
}
Wall 4:
onClipEvent (enterFrame)
{ if (this.hitTest(_root.Wall4))
{ _y = _y-10;
}
}
Done. As for after a few tries, my character will move out of the walls and cannot stay in the visable area. Am i on the right track?
Second
I want to make my character move from scene to scene. I started by creating a door and follow a game tutorial help and try to use it. I also create another door and set the codes as taught so that the character would appear on the second position. but when i reach the door on the first scene, it does not change the scene. Can i ask how should i do or what codes i should set so that when my character step on the door/portal, it will switch the player to the next screen/map.
Third
Can i create a button and set a diameter/radius around it(e.g a telephone booth set as a button function) and when the character in the story move to the diameter of the button, it will be able to select the function if let say we press an enter key in the moblie device. (e.g when the character move to the detect space of the telephone booth, it is able to use the next scene i set for the telephone booth).
Thank you for answering my queries and spending your time reading, your help will be very useful. hope to hear from you guys as soon as possible. Thank you once again
Regrads,
-=FYProject=-
View Replies !
View Related
On Mouse Move
I have attached the 'onmousemove' event handler onto a movie clip (I want the movie to goto the next scene if the mouse is moved). However it does not seem to work...do I have to work out the mouse coordinates first or something? If anyone could provide me with the script I would be very greatful!
Many Thanks
Elliot
View Replies !
View Related
On Mouse Move
I have attached the 'onmousemove' event handler onto a movie clip (I want the movie to goto the next scene if the mouse is moved). However it does not seem to work...do I have to work out the mouse coordinates first or something? If anyone could provide me with the script I would be very greatful!
Many Thanks
Elliot
View Replies !
View Related
|