OnClipEvent( MouseMove)
How do I determine when the mouse has stopped moving?
I have this navigation see and what I would like to happen is that if the mouse has stopped moving for x amt of time to highlight the button for the page that the user is currently viewing. I am sure I can do the rest I just don't know how to detect that the mouse has stopped moving. I tried doing a search but I had no luck.
Any ideas?
Thanks very much.
FlashKit > Flash Help > Flash ActionScript
Posted on: 03-14-2002, 09:14 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
OnClipEvent (mouseMove)
Hope someone can help, I'm using the onClipEvent (mouseMove)command to track the movement of the mouse so that my movie clip can rotate itself towards the mouse pointer.
I'm not sure if I'm missing something though but it seems that I can only use this command in the actions of the clip instance and not frame actions of the movie clip symbol itself (so I can drag on loads of them).
Is there another chunk of code I can use to get round this?
My code is as follows and works fine other than me having to paste it into every instance of the clip and change the variable names.
Cheers
onClipEvent (mouseMove) {
xpos = _parent._xmouse;
ypos = _parent._ymouse;
xclip = _root.pointer._x;
yclip = _root.pointer._y;
ydiff = ypos - yclip;
xdiff = xpos - xclip;
_parent.result = (Math.atan2(ydiff, xdiff)*(180/Math.PI));
_parent.x = xdiff;
_parent.y = ydiff;
_root.pointer._rotation = _parent.result + 90;
}
OnClipEvent(mouseMove ... Over A Certain Area
i have an mc on frame one, on the main stage
i want the mc to play when the mouse rolls over it
something like:
onClipEvent (mouseMove) {
this.play();
}
how can i specify the x and y coordinates in that code? and ho wdo i get the x and y coordinates from the stage?
thanks to anyone who can help
Onclipevent(mousemove) Problems
Im running Flash 5.
The problem is the onclipevent(mousemove) isn't being activated when I move the mouse on the clip. I have basically created a clip placed it in the bottom layer and am trying to update a dynamic text field with the x value of the mouse.
This is the code i use:
onClipEvent (mouseMove) {
xval = _xmouse;
}
Is there something I'm missing? Known problems?
Onclipevent Mousemove Jumpy
I'm trying to get a MC to move when I move my mouse, my code is:
onClipEvent (mouseMove)
{
_x=(_xmouse);
}
It works, only it's real jumpy. How can I get a smooth scroll?
Any Way To Stop Or Pause An OnClipEvent(mouseMove)?
Hi,
Is ther any way to stop or pause an onClipEvent(mouseMove)?
I need to turn it off and on again later. Is there alternate syntax I should be using? I tried to make a function within it and that didn't work. THanks in advance.
HELP HitTest Doesn't Work When OnClipEvent(load) But OnClipEvent(enterFrame)?
Somehow it works for my embedded xml links (coz of using hitTesting) but some of the actions don't run.
Is there anyway to resolve this ?? Coz I want to have clickable xml links embedded within flash. Along with other effects that run at the same time.
I realised that I can only use onClipEvent(enterFrame) instead of onClipevent(load) to trigger the actions. But why is this so???
Hope I'm making sense here...
PS: I tried using only on(rollOver) and on(rollOut), simple button to trigger all the actions and they did. But I can't use buttons as there are xml links embedded within.
ActionScript Code:
onClipEvent(enterFrame){
if (this.hitTest(_root._xmouse, _root._ymouse, true)){
_root.button01_mc.gotoAndStop("over");
_root.image01bg.setMask(_root.blindOpen02);
_root.blindOpen01.gotoAndPlay(1);
_root.image01bg.tween("_x",10,0.75,"easeOutExpo");
_root.lines_mc.alphaTo(100,0.25,"easeOutExpo");
}else{
_root.button01_mc.gotoAndStop("up");
_root.image01bg.setMask(_root.blindClose01);
_root.blindClose01.gotoAndPlay(1);
_root.image01bg.tween("_x",760,0.75,"easeOutExpo");
_root.lines_mc.alphaTo(0,0.25,"easeOutExpo");
}
OnClipEvent(keyUp) And OnClipEvent(keyDown): Misbe
Hi,
We are trying to trap the keypresses in an input text box, which is placed inside a Movie Clip, using the onClipEvent(keyUp) and onClipEvent(keyDown) events.
We have also disabled the tabEnabled properties for the button, movieclip, and textFields.
The problem:
The Flash player 7 is unable to detect the onClipEvent(keyUp) event when the Tab key is pressed. The movieClip has the focus since the type is Input Text. Interestingly, the problem only occurs in Flash player 7 (OCX version). The same code (written in Flash MX) works absolutely fine in Flash player 6 (both stand alone and OCX) and the Flash 7 stand-alone version.
What could be going here? Is this a Flash player issue? Has Macromedia changed the event behaviors or are we missing something here! What surprises us is the fact that the Flash 7 stand-alone and OCX player behavior is different!
We would be delighted to have any solution/fix that doesn’t require us to modify/recompile the code.
All suggestions are welcome!
Regards,
Varun
A Little Help With MouseMove
onClipEvent (mouseMove) {
this._alpha = this._alpha + .5;
}
now I want to tell the clip to fade when I stop moving the mouse.... how do I do it. Sorry, I'm just learning, still new. Any help will be much apprieciated. Thanks
MouseMove
I am trying to get a movieclip to follow the mouse on which direction it plays, the movieclip plays from right to left normally and loops twice it plays the last half over and over
code:
onClipEvent (mouseMove) {
myMouseX1 = _xmouse;
myMouseY1 = _ymouse;
if (myMouseX1 > myMouseX2 and myMouseY1> 100 and myMouseY2 <0) {
onClipEvent (mouseMove) {
myMouseX1 = _xmouse;
myMouseY1 = _ymouse;
if (myMouseX1 > myMouseX2 and myMouseY1> 100 and myMouseY2 <0) {
_root.globescroll.nextFrame();
}
if (myMouseX1 < myMouseX2 and myMouseY1>100 and myMouseY2 <0) {
_root.globescroll.prevFrame();
}
if ( myMouseY1<100 or myMouseY1>0) {
play();
}
myMouseX2 = _xmouse;
myMouseY2 = _ymouse;
}_root.globescroll.nextFrame();
}
if (myMouseX1 < myMouseX2 and myMouseY1>100 and myMouseY2 <0) {
_root.globescroll.prevFrame();
}
if ( myMouseY1<100 or myMouseY1>0) {
play();
}
myMouseX2 = _xmouse;
myMouseY2 = _ymouse;
}
i cant see any problems with the code
myMouseY figures reference the _ymouse from _root which is the top left hand corner which is normal for flash although, the movieclip with the instance globescroll is 100pixels high, so it should play while the _ymouse is between 0 and 100
Help On Mousemove
I have a question about making a movie clip follow the mouse.
I have this code:
Quote:
onClipEvent (mouseMove) {
_x=_root._xmouse;
_y=_root._ymouse;
updateAfterEvent();
Mouse.hide();
}
However, the clip isn't centered on the mouse. What do I need to do to get it lined up?
My second question is that I want to constrain it to a box (the movie clip is a pair of eyeballs and I basically want the eyes to follow the mouse, but not leave the sockets) and I'm wondering the best way to approach this? Should I put some if then statements that don't allow the x and y to go above a certain amount?
Thanks in advance.
(mouseMove) Help
HI.
i have put this code on an mc that i want to follow the cursor on a menu
onClipEvent (mouseMove){
this._y=_root._ymouse;
updateAfterEvent();
}
trouble is, i want the mc that follows the mouse to slowly follow with more of a flow. at the moment its too immediate.
is there any way i can slow it down, to flow with some kind of delay ?
please see the attached .fla
thanks
OnClipEvent(load) And OnClipEvent(enterFrame)
Hi all,
I'm using the code contains onClipEvent(load) and onClipEvent(enterFrame) and duplicateMovieClip() to make the snowing effect in the 2 first movie-clips but then, i cannot stop them in the next movie-clips. (All of my movie-clips in 1 scene only.)
Please help!
OnClipEvent(load) And OnClipEvent(enterFrame)
Hi all,
I'm using the code contains onClipEvent(load) and onClipEvent(enterFrame) and duplicateMovieClip() to make the snowing effect in the 2 first movie-clips but then, i cannot stop them in the next movie-clips. (All of my movie-clips in 1 scene only.)
Please help!
MouseMove Event Ignored
Hi all,
I've got a little problem. I want some action to occur only when the mouse moves. This is the code on the clip:
----------------------
onClipEvent(enterFrame){
play_clip = Math.floor(Math.random() * 65) + 1;
}
onClipEvent (mouseMove){
if (_root["mc" + play_clip].selected == 0){
_root["mc" + play_clip].gotoAndPlay(2);
}
updateAfterEvent();
}
--------------------
I worked fine but yesterday suddenly the the play_clips started to play frame 2 even when there is no mouse movement.
Does anybody know why this happens and what I can do to stop the clips from going to the second frame all by themselves?
You can test what I described here:
http://home.wanadoo.nl/d.roberts/stuff/spion.html
Because it might have something to do with my mouse generating movement that I can't controle (a lose cable or something ?)
Thanks very much for any help.
Regards, Danielle.
MC Moves On MouseMove ?
Ok what im trying to do is:
I got a movieClip on the stage and i want it to scroll left if mouse moves to the right and scroll up if mouse moves down. also scroll right if mouse moves to the left, and scroll down if mouse moves up.
If any one knows a good tutorial please tell me where i can find it!!! thankyou.
MouseMove / MouseUnmove?
is there a way to get something different like mouseMove?
i need to detect mouseStability. and not MouseMove ,, is there a way?
On MouseMove Problem
I have two scenes. The first one has a wait script on it. After it waits for a specified time it goes to the second scene which is a simple animation (to be replaced in the future with a movie file) and a clear movie clip on top which has the following script to it:
onClipEvent (mouseMove) {
gotoAndPlay("Scene 1", 1);
}
But it never detects mouse movement. Any ideas? Must be simple but I can't get it. I have attached the .fla if anyone is feeling extra helpful.
BIG Thank You!
Trouble With MouseMove
I am building a kind of interactive kiosk presentation that will just be sitting on a computer at a conference. When it initially starts I put an onMouseMove so that it sits at frame one until someone moves the mouse, but as soon as it starts it detects that as mouse movement. I'm not sure if I'm putting the code in the wrong place. I've tried it on the mc that is in frame one, and I've also tried puting it on frame one.
code:
_root.onMouseMove = function(){
_root.gotoAndPlay("logoFadeOut");
}
Thanks
MouseMove AttachMovie
ok i'm trying to attach a movie clip at runtime so it does something like this, www.blink182.com. the top when you move the mouse it attaches a ink splatter, how would i go about this because the duplicate movieClip doesn't work for that goal at all...any info at all will help i'm a quick learner
Ease On Mousemove?
peepz,
i've got this script to move a arrow in the direction of the mouse with a delay, but i want to have some easing on it:
Code:
onClipEvent (load) {
delay = 80;
xtarget = new Array (7)
ytarget = new Array (7)
xtarget.push(_x)
ytarget.push(_y)
}
onClipEvent (mouseMove) {
xtarget[xtarget.length] = _x
ytarget[ytarget.length] = _y
x=xtarget.shift()
y=ytarget.shift()
_rotation=(Math.atan2(y-_y,x-_x)/Math.PI)*180
x = this._x
y = this._y
_x=((this._parent._xmouse-x)/delay)+x
_y=((this._parent._ymouse-y)/delay)+y
}
can somebody tweak it up so it eases out ?
On(mouseMove)umWha?
Hiya,
it would be majorly cool if someone out there could tell me the script for a certain thing -
if the user doesn't move his move for 10 seconds, Id like this and this to happen...
like (and forgive my script jokery)
on(mouseDoesntMovefor10Seconds){
_root.holder.bla.gotoAndPlay("gogogo");
}
[F8] Need Immediate Help: MouseMove Or HitArea(?)
Hi! I'm having MAJOR difficulties getting my pullout tabs to work correctly. Mainly (now) on the "roll back in" animation. Here's what I want it to do:
When the user click the "learn more" tab it will pull out, this tab is a movie clip which houses another movie clip which has three buttons inside of it. Currently I'm using a button on the exposed tab area (when it's pulled in) to do the pullout animation (and display the buttons inside the clip(s)). So I'm using "on(press)...etc" in the pullouts movie.
My problem is that I can't get on(rollOut, dragOut) to work on frame 25 of the clip(when it's stopped so the user can click the buttons) to pull it back in because then the buttons become inactive. I've tried looking up different methods and found references to using the onClipEvent using a defined hitArea but could NOT get this to work correctly, and I don't understand the whole "mouseMove" idea.
I need to get this figured out ASAP!!!
...and I really can't recode it so i have to find a way for this to work without recoding everything else. Any ideas?
(if you'd like to see the file please email me at stellagifford@gmail.com)
I'LL BE GRATEFUL FOR ANY HELP AT ALL!
MouseMove Problem...
I've revamped some code I found on the web to look like this:
onClipEvent (mouseMove) {
x=this._xmouse;
y=this._ymouse*-1;
angle = Math.atan(y/x)/(Math.PI/180);
if(x<0){angle+=180}
if(x>=0&&y<0){angle+=359}
framenumber = Math.round(angle)
gotonumber = angle+1
this.arrow._rotation=framenumber*-1;
updateAfterEvent();}
This determines the mouse angle, and rotates an arrow around a "donut" that I created. This 'donut' is going to act as a 360 degree navigational tool. Therefore, I only want it to function while directly over the movie clip. No matter the size of my movie clip, it operates while on any portion of the stage.
Question: Can I limit the mouse detection operation of this movie clip to occur only when the mouse is within the limits of the actual movie clip?
Thank you in advance!!!
[CS3] MouseMove Problem...HELP
Hello,
I have a panning movieclip (Main_mc) that reacts on MouseMove.
Inside Main_mc is a movie clip with a button (btn_A).
I want Main_mc to move when I rollover btn_A (it already works)
but since my mouse is still over Main_mc, when I roll-over btn_A, Main-mc will move to a specific location but right after it will shift because the
on MouseMove panning script on the main timeline interferes.
????
is there a way that I can disable the panning script on the main timeline as I rollover btn_A (which is inside Main_mc) and then enable on rollOut.
please help it's almost there but not quite
[MX6.0] Mousemove Listener Etc
Hi. I need some code that does not handle movieclips dynamically despite being good coding praxis. I am a rookie at actionscript 2 and my mission is to make a product simulation. I need to do the following:
After a mousepushdown on mcA I want the currentframe in mcB to be changed depending of the mouseposition.
I am thinking something like the following would work but it does not!
//This is put in mc A:
onClipEvent (mouseDown)
{
var onMouseMoveListener:Object = new Object();
//for
onMouseMoveListener.onMouseMove = function()
{
if (this._ymouse > 20)
{
_root.mcB.gotoAndStop (_root.mcB.currentframe + 1);
}
else (this._ymouse < 20)
{
_root.mcB.gotoAndStop(_root.mcB.currentframe - 1);
}
updateAfterEvent();
}
//I need something this to be done over and over again until I release the mousebutton. //Therefore I tried to ad something like this:
intervalID = setinterval(onMouseMoveListener.onMouseMove, infinity);
}
In mcB I put this code:
onClipEvent (mouseMove)
{
this.addListener(onMouseMove);
}
Any tips? A would very much appreciate any comments. I am new to actionscripting. I am using Macromedia Flash MX 6.0.
Ease On Mousemove?
peepz,
i've got this script to move a arrow in the direction of the mouse with a delay, but i want to have some easing on it:
ActionScript Code:
onClipEvent (load) {
delay = 80;
xtarget = new Array (7)
ytarget = new Array (7)
xtarget.push(_x)
ytarget.push(_y)
}
onClipEvent (mouseMove) {
xtarget[xtarget.length] = _x
ytarget[ytarget.length] = _y
x=xtarget.shift()
y=ytarget.shift()
_rotation=(Math.atan2(y-_y,x-_x)/Math.PI)*180
x = this._x
y = this._y
_x=((this._parent._xmouse-x)/delay)+x
_y=((this._parent._ymouse-y)/delay)+y
}
can somebody tweak it up so it eases out ?
Opposite Of MouseMove
Is there any way of determing whether a mouse isn't moving, something like the opposite of mouseMove?
MouseMove/ MouseStop?
Hi,
i just want the play head to go to the next frame when the mouse stops.
Did somebody know how i could do this?
...i don´t found an opposite to mouseMove in the As-libery...
Please help me!
greets, ohara.
MouseMove Navigation Bar - Can´t Stop It
hi,
i´ve got a dynamic navigation menu that moves depending
on the xy-mouse position. i use the event-handler (Mouse
MOVE). if the mouse is not over the
swf-file, the movement doesn´t stop. but it should stand still, when the mouse is outside the film.
PLEASE HELP !!
ciao
gordo
MouseMove Arghhhh Hihi
onClipEvent(mouseMove){
this._currentframe = _root._xmouse;
}
How do i get this clip to work, I want the MC to move when I move the the mouse.........anyone =) knows
Control Movieclip By Mousemove
Does anybody how to do it?
I've seen it on this page:
http://www.janvision.com/yulia/eng.htm
When you move right or left with the mouse over the movieclip, the animation goes forward or backward frames.
Null A Mousemove Function
hi guys,, i have a pencil drawing api
my intention are KILL THE DRAWING API WHEN I HIT SPACE BAR
ON CLIP EVENT
PHP Code:
on (press) {
_root.window_mc.container_mc.clip3.container.gotoAndStop(7);
Mouse.hide();
this.startDrag(1);
_root.window_mc.container_mc.clip3.container.cap.gotoAndStop(40);
}
//HERE I WANT TO KILL THE MOUSEMOVE FUCTION HERE
on (keyPress "<Space>") {
// DOESNT WORK this.onMouseMove = null;
Mouse.show();
this.stopDrag();
}
DRAWING API
PHP Code:
_root.window_mc.container_mc.clip3.container.pencil_mc.swapDepths(2);
// 1. SETTING THINGS
_root.window_mc.container_mc.clip3.container.createEmptyMovieClip("line",1);
// 2. EVENTS IN _ROOT:
_root.window_mc.container_mc.clip3.container.pencil_mc.onMouseDown = function(){
//this.quitar = null;
line.curveTo(_xmouse,_ymouse);
line.moveTo(_xmouse,_ymouse);
line.lineStyle(4,0xAE001A,90);
this.onMouseMove = function(){
line.lineTo(_xmouse,_ymouse);
updateAfterEvent();
}
}
_root.window_mc.container_mc.clip3.container.pencil_mc.onMouseUp = function(){
this.onMouseMove = null;
}
// 3. BUTTON "ERASE":
// --------------------
buttonErase.onPress = function(){
_root.window_mc.container_mc.clip3.container.line.clear();
}
stop();
THANKS FOR ANY SUGGESTION OR HELP
Droptarget MouseUp MouseMove
Hi there.
After searching the forums, I still cant find an answer to this problem...
I have a drag and drop activity. I click my desired shape, and then use MouseMove to 'drag' the duplicated shape around.
Now, on MousUp, I want to check the droptarget of that clip that is following the mouse - alas, no joy.
I have a function called fCheckDropped(forWho). In there I have:
ActionScript Code:
this.myTarg = eval(forWho._droptarget)
I obviously pass the name of the clip that is dragging to that function.
That seems to work when I use press and release to move the clip, but not when using MouseMove and MouseUp. Does _droptarget only register when onRelease has been invoked?
How can I get the droptarget - without using hitTest?
Any help would be appreciated (I have a feeling I am going to have to loop and hitTest... )
How Can I Disable Mousemove Function
my code is
Code:
_root.onMouseMove = function() {
if(_root._xmouse <= 275){
globe.playBack();
}
if(_root._xmouse >= 650){
globe.playForward();
}
/*if (_root._xmouse>=276 && _root._xmouse <=649){
trace (_xmouse);
}*/
}
if _root._xmouse>=276 && _root._xmouse <=649
i want to disable onMouseMove function ( mouse is not playBack(); and playForward();. back to be normal mouse)
How can i do??
thanks
Using Mousemove To Start Animation
Hello flash masters,
I'm just a newbie here, so please be gentle.
I have a menu that slides out when the user moves the mouse to the left of the stage. Since the menu itself has to be active (to initiate the slide) and the menu items within the menu have to be active, I have the problem of a movieClip ontop of a movie clip while trying to use an (on) event for both.
So I now have a mousemove function to start the slide animation of the menu, thus leaving me free to put (on) events on the menu items. Here it is:
onMouseMove = function () {
x_pos = this._xmouse;
y_pos = this._ymouse;
if (x_pos >= 0 && x_pos <= 200 && y_pos >= 0 && y_pos <= 768) {
mcNavBar.slideTo(90, null, 1, Strong.easeIn);
mcNavBar.mcNavBarArrowStrip.alphaTo(0, 1, Strong.easeIn);
mcNavBar.NavHLine1.slideTo(-70, null, 1, Strong.easeIn);
mcNavBar.NavHLine2.slideTo(-70, null, 1, Strong.easeIn);
mcNavBar.NavHLine3.slideTo(-70, null, 1, Strong.easeIn);
mcNavBar.NavHLine4.slideTo(-70, null, 1, Strong.easeIn);
NavG1.slideTo(23, null, 1, Strong.easeIn);
NavG2.slideTo(23, null, 1, Strong.easeIn);
NavG3.slideTo(23, null, 1, Strong.easeIn);
NavG4.slideTo(23, null, 1, Strong.easeIn);
}
else{
mcNavBar.slideTo(-70, null, 1, Strong.easeIn);
mcNavBar.mcNavBarArrowStrip.alphaTo(100, 1, Strong.easeIn);
mcNavBar.NavHLine1.slideTo(120, null, 1, Strong.easeIn);
mcNavBar.NavHLine2.slideTo(120, null, 1, Strong.easeIn);
mcNavBar.NavHLine3.slideTo(120, null, 1, Strong.easeIn);
mcNavBar.NavHLine4.slideTo(120, null, 1, Strong.easeIn);
NavG1.slideTo(-137, null, 1, Strong.easeIn);
NavG2.slideTo(-137, null, 1, Strong.easeIn);
NavG3.slideTo(-137, null, 1, Strong.easeIn);
NavG4.slideTo(-137, null, 1, Strong.easeIn);
}
};
The problem lies in the mouseMove function. It all animates fine, but if I continue to move the mouse after activating the menu, it causes the animation to lag. It only works smoothly if I move the mouse into the active area and then don't move it any further until the animation is complete.
So my real question is: How can I make the mouse call the mousemove function only once so that the animation will not be interupted everytime the position of the mouse is being calculated.
I hope this makes sense
MouseMove Event Problem
I’m trying to make an image gallery using AS3. I have two MovieClip objects: the first with a rectangle and the second with the thumbnails. The first MovieClip is rising a MouseMove Event that makes the thumbnails’ MovieClip slide left and right.
The problem is: when the mouse moves over a thumbnail, the MouseMove Event stops rising.
Is there any way of making the event “pass through” the thumbnail?
Here is my swf file that demonstrates my problem.
Thaks
X Y Scaling Buttons In A MC On MouseMove
How would you go about making Buttons in side a MC size oposit the MC
Example
MC sizes when i move my mouse whic means the buttons get all distorted. (Move mouse on _xmouse scale _xscale and move _ymouse scals _yscale, how MC sizes )
This is the code for the Buttons to get resized.
if (_root.MC > 100){
BX = _root.MC_xscale - 100;
BX2 = Math.abs (BX - 100);
Button._xscale = BX2;
}else if (_root.MC < 100){
BXX = _root.MC._yscale + 100;
BXX2 = (BXX + 100);
Button._xscale = BXX2;
}else if (_root.MC = 100);
Button._xscale = 100;
}
The same goes for _yscale.
Trying to keep The origonal size of the buttons.
Thanks
MadWilson
MovieClip Triggered By MouseMove
I have a menu that I have been working on that is inside a movieClip. I want to trigger the menu to open when the mouse is in the far left hand part of the stage. The code that I have for this so far is:
leftX = 0;
topY = 0;
widthX = 10;
heightY = 600;
_root.onMouseMove = function()
{
if (this._xmouse >= leftX && this._xmouse < leftX+widthX &&
this._ymouse >= topY && this._ymouse < topY+heightY)
trace(_root.menu._currentframe);
if (_root.menu._currentframe == 30) {
stop();
}
else
{
if ( ! rolledOver ) {
menu.gotoAndPlay("open");
}
}
}
The code was working fine before I put in the trace function, but I would really like to have this so that if the menu is already open it won't go and play again.
What is happening now is if the mouse is moved just a little the code exicutes, and plays the menu MC.
Can anyone figure out a remedy for this problem?
Moving Background With Mousemove
Hi, I have a movie of 700*400.
I have a background image of 900*600.
I'm looking a way to move the background image attending the position of the mouse.
I want the background image moves to the LEFT when i move the mouse to RIGHT.
I want the background image moves UP when i move the mouse DOWN.
I'd also like the speed of the movement equal to the mouse movement speed...
And the most important thing is that the background has limits. It has not to go outside of the movie.
The effect I'd like to obtain is exlporing hide parts of image moving the mouse over the MC.
Please help me with a script (I'm trying to learn)
Item Movement On Mousemove....
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
Function On MouseDown Or MouseMove
Okay,
First off, thanks to all you guys. You have all been great help over the days.
Question:
Can I make it so that a function runs if the mouse is down or the mouse moves. I dont know why I cannot figure this out. Once again, thanks!
Cheers.
Here is the code for reference.
Code:
onMouseDown = function () {
stopMyTimer();
unloadMovieNum(99);
alert_txt.htmlText = "";
clearInterval(wait);
count = 0;
count++;
trace(time);
}
Detect MouseMove After 2 Seconds
I want to detect my users mouse 2 seconds after they've clicked on a button.
How do i delay an onMouseMove event so that it will only perform an action 2 seconds after a button has been pressed?
something like this (in all caps)?
watchmouse = new Object();
watchmouse.onMouseMove = function() {
trace (_ymouse)
if (THE MOUSE MOVES 2 SECONDS AFTER A BUTTON IS PRESSED) {
delete this.onEnterFrame;
}else {
Mouse.show();
test.onEnterFrame = function() {
if (this._alpha >= 99) {
delete this.onEnterFrame;
} else {
this._alpha += 5;
}
}
}
}
Mouse.addListener(watchMouse);
Dynamic Mc - Scrolling Based On Mousemove
I am trying to achieve a scroll effect with mouseevent . I am dynamically attaching 4 mc clips (image1,2,3,4) from the library using attachMovie and I duplicate another movie clip.
ActionScript:-------------------------
numImages = 4;
width = 200;
for (i=1; i<=numImages; i++) {
name = 'm'+i;
_root.holder.attachMovie("image"+i, name, i);
_root.holder[name]._x = i*200;
}
holder.duplicateMovieClip(image2,50);
_root.image2._y= _root.holder._y;
--------------------------------------------------------
I add this code on the mc holder which holds the 4 images scrolling
ActionScript:--------------------------------------------
onClipEvent(load){
centerPoint = 200;
switchDistance = (_width - (centerPoint*2))/2;
//trace(switchDistance);
_root.image2._y = _y;
}
onClipEvent(enterFrame){
movieBounds = this.getBounds(_root);
if( _root._xmouse <=movieBounds.xMax && _root._xmouse >=movieBounds.xMin && _root._ymouse <= movieBounds.yMax && _root._ymouse >= movieBounds.yMin)
{
//speed factor = 40
_x += (centerPoint - _root._xmouse)/100;
if (_x < -switchDistance) {
_x += _width;
}
if ((_x - _width) > -switchDistance) {
_x -= _width;
}
_root.image2._x = _x - _width;
}
}
------------------------------------------------------
I am not sure whether this method is right... also how do I test whether the duplicatemovieclip is working or not..
advacned thnx!!
One MouseMove Clip Event Or Multiple?
if i have a mouseMove clip event in a movie should i use it for everything or can i use a few? is it bad programming or inefficient to use more than one?
thanks!
MouseDown, MouseMove Event Listener
Having trouble understanding AS3 event listener model. My use case is to zoom an image by clicking on it and dragging mouse up or down, aka iPhone's "pinching", but with one finger.
Here's my code that identifies the x reference of my mouse position once i click and start dragging. I have no idea how to remove the event listener since i used an inner function. Why did i use an inner function? I could not get a hold of img reference from inside mouseMove(e) function. e.target would not yield Image but results in FlexLoader object. Does this description make sense to anybody?
Code:
private function zoom(img:Image):void{
img.addEventListener(MouseEvent.MOUSE_MOVE,
function(e:MouseEvent):void{
debug.label = new String(img.mouseX);
}
);
debug.label = new String(img.mouseX);
}
<mx:Image id="img1" source="http://localhost/getImage/id={imageId}"
mouseDown="zoom(img1)"/>
On MouseMove Question. Simple Stuff?
okay.. so i have a movieclip that i want to play (fade in). when the mouse is moving. That part works fine. Hoever, when the mouse STOPS moving I want the movieclip to play backwards and fade out.
Basically I just need to know how to tell my movieclip that the mouse is NOT moving.
any ideas? Keep in mind i'm fairly novice and if this is going to involve a "listener" I have no idea what that is.
thanks.
MouseMove Restrictions For Background Image
Hello,
I'm attempting to create a website with a background image that pans when the mouse moves around. The image is enclosed by a border to hide where the image ends. I have worked a script that links the image to the mouse movement but have been unable to stop the movement continuing past the edges of the image. This means that the user can move the mouse to an extreme so that the edge and past is shown in the visible area. Here is the script for the mouse action so far:
var midX = 520;
var midY = 350;
var scaleX = -0.2;
var scaleY = -0.2;
onMouseMove = function(){
bg_mc._x = midX + (_xmouse-midX)*scaleX;
bg_mc._y = midY + (_ymouse-midY)*scaleY;
}
I would be very grateful if anyone can guide me to the actions needed to stop the mouseMove action from continuing to move the image when it reaches it's edge. Also, the registration point is currently in the immediate centre of the image.
Thank you.
|