Code Can't Keep Up With Mouse
Hi, I have Flash 8 Pro on Mac OS X Tiger 10.4I have a movie clip with buttons inside it, and the mc must respond to mouse over, at which point it tweens to a different position on the Y axis.I have a hitTest set onMouseMove but the menu breaks very, very easily - either by moving the mouse too quickly or by moving the mouse out of the stage area. It is crucial that the menu goes down whenever hitTest = false.I've seen people achieve similar effects and they work flawlessly, I just can't imagine how it's done. Can anyone help please?Attach CodeonMouseMove = function() {if(_xmouse < 22 || _xmouse > 755 || _ymouse < 9 || _ymouse > 207) {// another if loop to go here to check if menu is activeif(menu._y != 179) {new Tween(menu, "_y", Regular.easeOut, menu._y, 179, 0.75, true);}}}
Adobe > ActionScript 1 and 2
Posted on: 02/12/2007 03:00:27 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
- Help With Mouse Code..
- AS Code For A Mouse Event
- Mouse Speed Code?
- Key Code Asci Mouse
- Mouse Avoidance Code AS 1 To AS 2...
- AS3 Code For Mouse Event
- Key Code Asci Mouse
- OOP, Mouse Events And Code Management
- How Do You Code So That The User Can Draw With Their Mouse?
- Mouse Trail Code Problem
- The X Mouse Wont Constrain With The Following Code
- [F8] Can't Get This AS Mouse Follow Code To Work. Help Please?
- Scrolling With Mouse Movement Code
- Code Problem With A Mouse Trailer
- External Swf And Mouse Position Code
- Code Problem With A Mouse Trailer
- The X Mouse Wont Constrain With The Following Code
- How Do I Get A Code To Activate Only When Mouse Is In A Specific Area?
- HElP - Drop Mc Where Mouse Is Clicked - Check My Code
- Follow Mouse Code, Detail Problem
- I Need A Code So That When U Click Ur Mouse It Makes A Sound...?
- Execute Code When Mouse Focussed On Symbol
- Is There A Code For If The Mouse Isnt Over A Button To Go To A Frame
- Mouse Leaves Swf Too Fast - Code Breaks
- How Do I Code Mouse Curser To A Grabbing Cursor?
- When Mouse Btn. Clicked, Need Code To Dislay Some Info In Pop-up
- Is There Any On Mouse Code That Causes Animated Objects To Move
- Mouse Trail Code Help (Flash Player 7)
- Mouse Trail DRAG Breaks My Other Code With Loadmovies?
- Mouse Detect Doesn't Work, Please Check The Code
- Bullets Fire Out Of Players Butt? Need Mouse Control Code Help
- PLEASE HELP Easing Scrollbar Code Needed To Add Mouse Wheel Function Not Working?
- Movie Clip Mouse Speed Control Depending On Mouse Press
- OnPress Doesn't Work If The Mouse Button Is Pressed Again But The Mouse Is Not Moved.
- How Do I Create A Movieclip To Play If Mouse Is Unactive, And Stops When Mouse Moves?
- How Do I Create A Movieclip To Play If Mouse Is Unactive, And Stops When Mouse Moves?
- How Do I Create?: Scrolling Image Stops On Mouse Over-starts On Mouse Off
- Playing A Movie Clip On Mouse Over And Continue To Last Frame On Mouse Out
- Mouse Follow/stopfollow After Mouse Leaves Object (with Ease)
- Detect Mouse _x & _y Attach Specific Clip And Have It Follow Mouse
- [F8] Loading And Unloading External SWF Code Issues, Code Check Please
- Custom Mouse Cursor Conflict With Mouse Trail
- Mouse Direction Scroll With Mouse Over Image Enlargement...
- Mouse Over, MC Scales Up, Mouse Out, MC Returns To Original Size...
- Scroller That Moves According To Mouse Movement Not Mouse Location.
- Changing Mouse Cursor On Mouse Over/out Without Drag Movie?
- Mouse Hittest Too Slow? Mouse Passes Over Wall
- [F8] Follow The Mouse - Stop Mc At Location Of Mouse On Click
- Getting An Object To Point Towards Mouse - Rotation - Mouse Follower
Help With Mouse Code..
hello all! i had this problem buggin me all evenin... does anyone know how to create code that makes a movieclip repeled by the mouse? like this kind of movement.. -- http://www.kevlindev.com/samples/mou...mouseRepel.svg
any pointers would be great!
thanks
Mouse Speed Code?
Does someone have some code to track and maintain the mouse speed? I'd like to use an average speed and gross angle for something like a stroke over a period of time. I'm hoping someone can point me to something existing to save some time.
Mouse Avoidance Code AS 1 To AS 2...
Can anybody tell me why this code applied to a MC in Flash 8 does not work?
Code:
onClipEvent(load){
homeX = this._x
homeY = this._y
magnet = 5000
}
onClipEvent(enterFrame){
x0 = this._x
y0 = this._y
x1 = _root._xmouse
y1 = _root._ymouse
distancex = x1-x0
distancey = y1-y0
distance = Math.sqrt((distancex * distancex) + (distancey * distancey))
powerx = this._x - (distancex / distance) * magnet / distance
powery = this._y - (distancey / distance) * magnet / distance
forcex = (forcex + (homex - x0) / 2) / 1.66
forcey = (forcey + (homey - y0) / 2) / 1.66
this._x = powerx + forcex
this._y = powery + forcey
}
Best Regards,
TVB
AS3 Code For Mouse Event
Hi,
I had uploaded jpeg file onto the stage using File->Import.
Now, how to access the mouse-events using AS3.0?
i.e., when we click with mouse on the stage
it should display the x and y co-ordinates of the point being clicked.
These x and y coordinates must be displayed in text-boxes provided down on the same stage.
Please reply me
OOP, Mouse Events And Code Management
In Flash 5 I can organize my code nicely for the most part and structure it in an OOP manner like Im used to, but I run into road blocks when I have to deal with movie clips and mouse events.
Usually, in other programming environments, for like creating lets say, an asteroids style arcade game, I would create objects from classes that would control their own graphic and sound elements. If I have to worry about the graphics receiving mouse events in Flash, I seemed to be forced to turn this organization on its head with all my code in each graphic element (movie clip) because that is the only place I can receive events. This is a problem if I want the game element objects to shed their movie clip for another as they change in a game state, and if I want to keep my code more manageable in one place rather than copied into every movie clip.
Any suggestions? A structure that worked for you?
Thanks!
How Do You Code So That The User Can Draw With Their Mouse?
OK...here's what I need:
I want to code a game so that there are a series of objects and a series of matching words and I want the user to draw a line from any of the objects to any of the words. Only one pair of words/objects is correct and if the user matches them incorrectly, the line will not stay. If the user matches them correctly, the line stays and he gets to match the next pair. To see a similar (but not exact) example, please go to Disney's site at:
http://disney.go.com/disneychannel/p...p_letters.html
Thanks!
--Darcie
Mouse Trail Code Problem
ok, I've got this mouse trail embedded into a movieclip that is on the main stage. The mousetrail duplicates a movie clip as the mouse moves and makes a kind of scatter effect (found idea in the movies section )
code: onClipEvent(load) {
_root.title.mousetrail.mtClip._visible=0;
i = 1;}
onClipEvent(enterFrame) {
_root.title.mousetrail["mtClip"].duplicateMovieClip("clip" add i, (i-1));
xdis= (_root.title.mousetrail.mtClip._x - _root.title.mousetrail._xmouse);
ydis= (_root.title.mousetrail.mtClip._y - _root.title.mousetrail._ymouse);
_root.title.mousetrail.mtClip._x = _root.title.mousetrail.mtClip._x - xdis;
_root.title.mousetrail.mtClip._y = _root.title.mousetrail.mtClip._y - ydis;
_root.title.mousetrail["mtClip" add i]._x = _root.title.mousetrail["mtClip" add i]._x - xdis;
_root.title.mousetrail["mtClip" add i]._y = _root.title.mousetrail["mtClip" add i]._y - ydis;
_root.title.mousetrail["mtClip" add i]._xscale = xdis*5;
_root.title.mousetrail["mtClip" add i]._yscale = ydis*5;
//_root.title.mousetrail["mtCLip" add i]._rotation = random(1*100);
_root.title.mousetrail["mtClip" add i]._rotation = i;
i+=1;
}
to complete with motion i have this actionscript on the movieclip inside mtClip
code: onClipEvent(load) {
j = 1;
}
onClipEvent(enterFrame) {
this._x = j;
j *= 1.2;
}
now, I've got the mouse trail working fine, except for one factor - scaling it when it duplicates. It just doesn't scale my movieclip that's been duplicated. The lines i'm talking about are:
code: _root.title.mousetrail["mtClip" add i]._xscale = xdis*5;
_root.title.mousetrail["mtClip" add i]._yscale = ydis*5;
Do you guys see anything right offhand that would be a problem??
Thanks
-Jake
The X Mouse Wont Constrain With The Following Code
onClipEvent (load) {
_x = 20;
_y = 290;
div = 5;
}
onClipEvent (enterFrame) {
if (_root.xmouse<800 || _root.xmouse>20) {
endX = _root._xmouse;
_x += (endX-_x)/div;
}
}
What in the hell is wrong with that ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? lol
[F8] Can't Get This AS Mouse Follow Code To Work. Help Please?
Code:
onClipEvent (load) {
function startFollow() {
var follower = function () {
var local1 = {n: 150, e: 880, s: 540, w: 100};
var local3 = (_xmouse - local1.w) / (local1.e - local1.w);
var local2 = (_ymouse - local1.n) / (local1.s - local1.n);
local3 = numBounds(local3, 0, 1);
local2 = numBounds(local2, 0, 1);
var x = scrap_lp.sx - (scrap_lp._width - local1.e - local1.w) * local3;
var y = scrap_lp.sy - (scrap_lp._height - local1.s - local1.n) * local2;
animateRepeat(scrap_lp, "x", x, 8);
animateRepeat(scrap_lp, "y", y, 8);
};
FOLLOWID = run(follower);
}
}
This is the code which I have attached to a movie clip with an instance name of scrap_lp. Any clues why this isn't working as I'm expecting it to? This is the only AS I have so far in my file. Basically I'm just looking to do something like the following with images.
http://www.cherishsisters.com/
TIA!
Scrolling With Mouse Movement Code
Hello
I have this code I used once to give a mouse movement effect to an animation through stage (using stage width as parameter) and it was working perfectly.
Now I have to use this same illustration but flowing along a MC’s width, not all the stage, or it should define a specified width, different than the stage’s one.
I trying using a mask over the old mc covering and showing only 747px width I want it to show, but o course it does not work properly, not showing the entire illustration.
The mc I want to contain the illustration has 747px and the instance name “illustra”.
In the frame now I have this:
moveI = setInterval(moveF, 40);
function moveF() {
targetX = (1-mc1._width/Stage.width)*_xmouse;
mc1._x = .5*(mc1._x+targetX);
updateAfterEvent();
}
Thanks a lot any help!!!
Code Problem With A Mouse Trailer
hi,
I have inserted a code found on the web to create a mouse trailer. all works just fine until I inserted the code found in the fading grid effect. then the mouse trailing effect no longer works.
don't know if it is a depth problem or what? don't really know too much about as, trying to learn........
here is the code on frame 1:
Code:
Text = "art";
letters = Text.split("");
letterformat = new TextFormat();
letterformat.font = "Verdana";
letterformat.align = "center";
letterformat.size = "10";
spacing = 8;
speed = 3;
for (L=0; L<letters.length; L++) {
_root.createEmptyMovieClip(letters[L], L);
_root[letters[L]].createTextField(letters[L]+"t", L, L*spacing, 10, 20, 20);
with (_root[letters[L]][letters[L]+"t"]) {
text = letters[L];
setTextFormat(letterformat);
selectable = false;
}
if (L>0) {
_root[letters[L]].id = L;
_root[letters[L]].onEnterFrame = function() {
this._x += (_root[letters[this.id-1]]._x-this.lastX+5)/speed;
this._y += (_root[letters[this.id-1]]._y-this.lastY)/speed;
this.lastX = this._x;
this.lastY = this._y;
};
} else {
_root[letters[L]].onEnterFrame = function() {
this._x += (_root._xmouse-this.lastX+10)/speed;
this._y += (_root._ymouse-this.lastY)/speed;
this.lastX = this._x;
this.lastY = this._y;
};
}
}
then here is the code on frame 20 for the fade grid effect:
Code:
//Declare variables
xspacing = box._width;
yspacing = box._height;
depth = 0;
box._visible = 0;
azcount = 0;
smoothness = 900;
//Calculate positions and values
amH = Math.ceil(image._width/box._width);
amV = Math.ceil(image._height/box._height);
border._height = image._height+1;
border._width = image._width+1;
border._x = image._x-0.5;
border._y = image._y-0.5;
//Create grid
for (var k = 0; k<amV; k++) {
for (i=0; i<amH; i++) {
box.duplicateMovieClip("box"+depth, depth);
cur = this["box"+depth];
cur._x = image._x+(xspacing*i);
cur._y = image._y+(yspacing*k);
depth++;
}
}
//
//
// End of grid
//
//
function fadeOut(startboxnr, speed) {
fadeMC(startboxnr, speed);
}
function fadeMC(mcnr, speed) {
azcount++;
_root["box"+mcnr].onEnterFrame = function() {
_root["box"+mcnr]._alpha -= speed;
if (_root["box"+mcnr]._alpha<=smoothness) {
_root["box"+mcnr].onEnterFrame = null;
continueFade(_root["box"+mcnr], speed);
mcnr += 1;
fadeOut(mcnr, speed);
}
};
}
function continueFade(mc, speed) {
mc.onEnterFrame = function() {
mc._alpha -= speed;
if (mc._alpha<=0) {
delete mc.onEnterFrame;
}
};
}
fadeOut(0, 5);
Any help is greatly appreciated
thanks
External Swf And Mouse Position Code
I have my main movie that I load an external swf that is centered in the main movie. The external swf has an animation that goes outside of its 404x464 document size. IS there any other way NOT to show the image that goes outside the 404x464 document size other than using a mask?
Also with the same setup I am using a mouse position code that I only want to be active when you roll over the 404x464 area of the external swf. Is this possible?
Code Problem With A Mouse Trailer
hi,
I have inserted a code found on the web to create a mouse trailer. all works just fine until I inserted the code found in the fading grid effect. then the mouse trailing effect no longer works.
don't know if it is a depth problem or what? don't really know too much about as, trying to learn........
here is the code on frame 1:
Code:
Text = "art";
letters = Text.split("");
letterformat = new TextFormat();
letterformat.font = "Verdana";
letterformat.align = "center";
letterformat.size = "10";
spacing = 8;
speed = 3;
for (L=0; L<letters.length; L++) {
_root.createEmptyMovieClip(letters[L], L);
_root[letters[L]].createTextField(letters[L]+"t", L, L*spacing, 10, 20, 20);
with (_root[letters[L]][letters[L]+"t"]) {
text = letters[L];
setTextFormat(letterformat);
selectable = false;
}
if (L>0) {
_root[letters[L]].id = L;
_root[letters[L]].onEnterFrame = function() {
this._x += (_root[letters[this.id-1]]._x-this.lastX+5)/speed;
this._y += (_root[letters[this.id-1]]._y-this.lastY)/speed;
this.lastX = this._x;
this.lastY = this._y;
};
} else {
_root[letters[L]].onEnterFrame = function() {
this._x += (_root._xmouse-this.lastX+10)/speed;
this._y += (_root._ymouse-this.lastY)/speed;
this.lastX = this._x;
this.lastY = this._y;
};
}
}
then here is the code on frame 20 for the fade grid effect:
Code:
//Declare variables
xspacing = box._width;
yspacing = box._height;
depth = 0;
box._visible = 0;
azcount = 0;
smoothness = 900;
//Calculate positions and values
amH = Math.ceil(image._width/box._width);
amV = Math.ceil(image._height/box._height);
border._height = image._height+1;
border._width = image._width+1;
border._x = image._x-0.5;
border._y = image._y-0.5;
//Create grid
for (var k = 0; k<amV; k++) {
for (i=0; i<amH; i++) {
box.duplicateMovieClip("box"+depth, depth);
cur = this["box"+depth];
cur._x = image._x+(xspacing*i);
cur._y = image._y+(yspacing*k);
depth++;
}
}
//
//
// End of grid
//
//
function fadeOut(startboxnr, speed) {
fadeMC(startboxnr, speed);
}
function fadeMC(mcnr, speed) {
azcount++;
_root["box"+mcnr].onEnterFrame = function() {
_root["box"+mcnr]._alpha -= speed;
if (_root["box"+mcnr]._alpha<=smoothness) {
_root["box"+mcnr].onEnterFrame = null;
continueFade(_root["box"+mcnr], speed);
mcnr += 1;
fadeOut(mcnr, speed);
}
};
}
function continueFade(mc, speed) {
mc.onEnterFrame = function() {
mc._alpha -= speed;
if (mc._alpha<=0) {
delete mc.onEnterFrame;
}
};
}
fadeOut(0, 5);
Any help is greatly appreciated
thanks
The X Mouse Wont Constrain With The Following Code
onClipEvent (load) {
_x = 20;
_y = 290;
div = 5;
}
onClipEvent (enterFrame) {
endX = _root._xmouse;
_x += (endX-_x)/div;
}
I want to constrain the mc im moving with my x mouse to a certain Left and Right coordinate so it wont go pass those two points, how do i do such a thing ?
How Do I Get A Code To Activate Only When Mouse Is In A Specific Area?
This code is supposed to make a movie clip follow the mouse which it does. However, how do I get it to work only when the mouse is in a specified area instead of anywhere in the movie?
onClipEvent (enterFrame) {
//x movement
mx=_root._xmouse;
if (mx<_x) {
dx=_x-mx;
}
else {
dx=mx-_x;
}
moveSpeedx=dx/10;
if (mx<_x) {
_x=_x-moveSpeedx;
}
else {
_x=_x+moveSpeedx;
}
}
HElP - Drop Mc Where Mouse Is Clicked - Check My Code
Try to make an mc appear on screen when you mouse down. They are duplicated at the point where you clicked. This code seems to wrok for just 2, but it uses the master as it second drop...the var live seems to go up by 2 each press also...any ideas what i've done wrong or any examples of this..cheers stu..code below
onClipEvent (load) {
amount = 5;
}
onClipEvent (mouseDown) {
if (_root.live<=4) {
for (i=0; i<=amount; i++) {
duplicateMovieClip(health, "health"+i, i);
_root.live++;
_x = mouse._x;
_y = mouse._y;
}
}
}
Follow Mouse Code, Detail Problem
Hiya,
I'm doing this test for a site I'm making. I'm testing the following code:
Got an MC that needs to jump along the x-axis when you go over certain other objects. It al works fine, only problem is that when you test the movie, the object initially goes to x= 0 position. After that it does what it's supposed to. How can I avoid it from jumping to x=0 ?
Here's the code I'm using:
the code on the moving MC:
onClipEvent (enterFrame) {
Xstart = _root.slider._x;
Xdiff = Xpos-Xstart;
Xmove = Xdiff/6;
_root.slider._x = Xstart+Xmove;
updateAfterEvent();
}
the code on the MC that make the moving MC go to a certain position:
on (rollover) {
_root.slider.Xpos = 207.2;
}
Any help or ideas?
Execute Code When Mouse Focussed On Symbol
Hi
I would like to be able to execute some code when a user places their mouse over a specific symbol or movie clip.
I don't want it to look like an active link ie not a button - just the arrow pointer - does anyone have any ideas how you could achieve this?
Thanks a lot
Is There A Code For If The Mouse Isnt Over A Button To Go To A Frame
Ok I am not new to flash but however new to this site I have been reading through a lot of posts and haven't found any information on what I am looking for. I have a flash file which is on my server at http://garyjr.no-ip.com/Pba/dormroom.swf and I am having problems with my rollovers for the pictures they are all buttons but if you move the mouse off of them to quickly they stick and none of the other ones work I was wondering if anyone knew of a script that I could add to them that would double check the first one and keep them from sticking. I set up the roll overs to go to a separate frame for each on of them and on the frame they are on I have a simple On (rollout) command that then redirect to gotoandstop (1) follow but a click command for the pop-up windows when you click on the rollover.
Thanks in advance,
Flash Happy 990
Mouse Leaves Swf Too Fast - Code Breaks
Hey all, old problem in Flash that i've yet to find a great solution to...
PROBLEM: I have a playlist that slides over my video player when you mouse over the video screen. If you mouse away from the swf too fast the playlist doesn't slide away.. I've yet to find a method that always works.
So far I have a 20pixel margin around the video screen that when the mouse goes over the playlist hides.. I've looked into methods that allow for reading the mouse x/y when outside of the flash object which works very well, but it doesn't do much for me unless I can somehow read where on the page the swf loads (which i don't know as the site the swf is on is very modular and things can be moved around the page similar to Facebook)
This is a very common problem with Flash.. just wondering if anyone would like to share their approach to it.
Thaanks!
How Do I Code Mouse Curser To A Grabbing Cursor?
I want my mouse cursor to change into one of those grabbing hand cursor you would see when viewing PDF documents.
I don't want a pointing hand cursor, which could be achieved as below:
ActionScript Code:
_root.useHandCursor = true;
Could somebody teach me how to code a grabbing hand cursor please?
I believe this is a built-in in flash right? Coz I remembered many years back when I first learned Actionscrip, I used some 3 digit code to change the mouse cursor into various other cursors. But just can't recall how I did that...
Many thanks!
Mouse Trail Code Help (Flash Player 7)
Hello,
I really like the effect of this script here:
http://www.flashkit.com/movies/Effec...1692/index.php
However, being new to AS (and programming in general), I find the code difficult to understand (the lack of comments also doesn't help).
I want to get it to work in Flash Player 8 or 9 - but I've noticed that it only works in Flash Player 6. I checked the variable output in the debugger menu, and I've noticed a lot of NaNs in the variables. I guess it's due to the sheer number of on-the-spot declared variables used in the script.
Can anybody please modify it, or find me an alternative? I really like this effect. If someone could please go and convert it to Flash Player 8+ friendly code, and add in some comments, that would be great.
Thank you very much
Mouse Trail DRAG Breaks My Other Code With Loadmovies?
I can't believe what a hard time flash is giving me!!! All I did was use a drag effect and it broke my loadmovie's into blank movie clips. I have no idea why...All I know is when I take out the mouse-trailer effect...it works? I think it has something to do with targeting???? (well at least I think so)
http://www.janepark.com/flash/main.fla
http://www.janepark.com/flash/main.swf
If anyone can point me in the right direction, please let me know!
Thanks,
fitchic77
Mouse Detect Doesn't Work, Please Check The Code
Hi,
What is wrong with that code , it doesn't work
if (_root._xmouse > 390) {
_root.don.gotoAndPlay(6);
} else if (_root._xmouse < 390) {
_root.don.gotoAndPlay(2);
}
There is a mc, intance name "don", that I want to act depending on mouse position.
Thanks for your help
Bullets Fire Out Of Players Butt? Need Mouse Control Code Help
I'm making my first game. I'd like to use the mouse to move the player, not the keys, as coded below.
Can anybody help me change this code so that it will detect which way the mouse is moving, and turns the player left and right accordingly?
My next callenge will be to get the bullets to stop firing out of the players ass when turned to the left!
onEnterFrame = function () {
if (game_playing == true) {
if (Key.isDown(Key.LEFT)) {
dx = 10;
player._xscale = -Math.abs(player._xscale);
} else if (Key.isDown(Key.RIGHT)) {
dx = -10;
player._xscale = Math.abs(player._xscale);
} else {
dx = 10;
}
}
Thanks, Eileen
PLEASE HELP Easing Scrollbar Code Needed To Add Mouse Wheel Function Not Working?
Hi,
I really appreciate some help here is the code below for my scrollbar which works fine but I can't get the mouse wheel code to work (I've taken it out since) How to add a mouselistener and get it to work with my scrollbar? Apparently some simple code but when I put it in nothing works please help if you could add the code in my code that might work.
I think I need to add some code that listens to the mouse wheel? PLEASE HELP! I only know VERY basic action script.
HERE is the code:
//Scrollbar Control//
fscommand("allowscale", "false");
bar.useHandCursor = dragger.useHandCursor=false;
space = 0;
friction = 0.3;
speed = 4;
y = dragger._y;
top = main._y;
bottom = main._y+mask_mc._height-main._height-space;
dragger.onPress = function() {
drag = true;
this.startDrag(false, this._x, this._parent.y, this._x, this._parent.y+this._parent.bar._height-this._height);
dragger.scrollEase();
};
dragger.onMouseUp = function() {
this.stopDrag();
drag = false;
};
bar.onPress = function() {
drag = true;
if (this._parent._ymouse>this._y+this._height-this._parent.dragger._height) {
this._parent.dragger._y = this._parent._ymouse;
this._parent.dragger._y = this._y+this._height-this._parent.dragger._height;
} else {
this._parent.dragger._y = this._parent._ymouse;
}
dragger.scrollEase();
};
bar.onMouseUp = function() {
drag = false;
};
moveDragger = function (d) {
if ((dragger._y>=y+bar._height-dragger._height && d == 1) || (dragger._y<=y && d == -1)) {
clearInterval(myInterval);
} else {
dragger._y += d;
dragger.scrollEase();
updateAfterEvent();
}
};
up_btn.onPress = function() {
myInterval = setInterval(moveDragger, 18, -1);
};
down_btn.onPress = function() {
myInterval = setInterval(moveDragger, 18, 1);
};
up_btn.onMouseUp = down_btn.onMouseUp=function () {
clearInterval(myInterval);
};
MovieClip.prototype.scrollEase = function() {
this.onEnterFrame = function() {
if (Math.abs(dy) == 0 && drag == false) {
delete this.onEnterFrame;
}
r = (this._y-y)/(bar._height-this._height);
dy = Math.round((((top-(top-bottom)*r)-main._y)/speed)*friction);
main._y += dy;
};
};
Movie Clip Mouse Speed Control Depending On Mouse Press
Hi,
Please help me !
As iam developing a small ball game in flash, where i need to control the speed of the ball (i.e, to increase or decrease the speed of ball)when clicked on a button depending on mouse press .
I have done similar on key press but iam not able to do the same for mouse pressed.
Please help me out
Your help will be appreciated.
Thanks & Regards
Zabi
OnPress Doesn't Work If The Mouse Button Is Pressed Again But The Mouse Is Not Moved.
I have a very simple piece of code but it has one very annoying bug. When I press the button a second time, the code doesn't work. The only way to get the code to work is by moving the mouse a tiny bit, or moving the mouse off the button and back on.
Does anyone know a way to make a button that can be clicked many times without moving the mouse?
Code:
randommultiquiz.onPress = randommultiquizOnPress;
function randommultiquizOnPress() {
_root.attachMovie("connect", "newconnect", 200);
newconnect._x = 0;
newconnect._y = 0;
newconnect._xscale = 100;
newconnect._yscale = 100;
}
How Do I Create A Movieclip To Play If Mouse Is Unactive, And Stops When Mouse Moves?
I am in the process of creting a world map navigation for a global ite portal.
In the map a user can hover over different continents to zoom in on specific countries then click on that country's to goto its specific website.
However I think the world map looks a little un-user friendly so was looking at playing a quick tutorial movie (a mouse cursor, moving over a continent and highlighting it) when the mouse is not being moved, then stops when the user moves the mouse.
This feature a little reminisant of when sonic the hedgehog used to tap his foot if you didnt use your joypad for a while.
I would also like to start the movie (after he preloader ive used) with the tutorial playing, so the user can understand the way it works straight away.
I am a novice at action scripting, so all help would be appreciated!
Thanks
M
How Do I Create A Movieclip To Play If Mouse Is Unactive, And Stops When Mouse Moves?
I am in the process of creting a world map navigation for a global ite portal.
In the map a user can hover over different continents to zoom in on specific countries then click on that country's to goto its specific website.
However I think the world map looks a little un-user friendly so was looking at playing a quick tutorial movie (a mouse cursor, moving over a continent and highlighting it) when the mouse is not being moved, then stops when the user moves the mouse.
This feature a little reminisant of when sonic the hedgehog used to tap his foot if you didnt use your joypad for a while.
I would also like to start the movie (after he preloader ive used) with the tutorial playing, so the user can understand the way it works straight away.
I am a novice at action scripting, so all help would be appreciated!
Thanks
M
How Do I Create?: Scrolling Image Stops On Mouse Over-starts On Mouse Off
Im trying to create this animation:
I have an long rectangular image (with more images going across it) scrolling FROM the right side of the screen to the left (very slowly). similar to a ticker.
I want the scrolling to stop when the viewer mouses over the menu strip. If they press on the image that they have just moused over, I have a movie clip I want to play for that image (a few images pop up, one bigger than the other). When the viewer mouses off, the movie clip disappears, and the menu continues scrolling to the left, from the right.
Greatly appreciated!!
Playing A Movie Clip On Mouse Over And Continue To Last Frame On Mouse Out
Hi All,
I have a movie clip on the timeline which is an animated mouseover button
Basically what I need to do is for the movie to be stopped at frame one when there is no mouse over and loop continuosly when I do have mouse over then on mouse out i want it to finish it's frames playing from where ever it was at when the mouse was moved out to the last frame and then display frame one so it is stopped again ready for a new mouse over.
Something I have found difficult to work out is that whilst it is doing the "out" play to to last frame, if you put the mouse back over again, it starts from frame 1 so looks like it jumps so i need the mouse over to also read what frame it is currently playing so that it can continue its endless loop from that frame to avoid it jumping about.
I hope that makes sense, it's really difficult to describe in words.
Here's the movie clip's action as it is now.
on (rollOver)
{
this.gotoAndPlay("over");
}
on (releaseOutside, rollOut)
{
this.gotoAndPlay("out");
}
ok so in the movie's timeline itself, the label "over" is a frame containing another movieclip which is basically a continous 30 frame loop and my movie timeline is stop();
so, on (rollOut) it plays at label "out"
I have placed a copy of the movie loop at the "out" frame which plays the movie slower at the end to make it a nice wind down stop
what I thought to do in action script is to read the current frame that the movie loop is at and make so the "out" position movie starts its playing frame from that frame number until it reaches the end frame where it jumps back to frame one of the timeline with the first stopped frame.
I've seen a command something like this below used to get the current frame number and take it away from the total to continue playing from that point, that's not totally right for what I am doing but it shows me the sort of thing i need to write but i don't know how to write an actionscript to read the current frame from the movie1 whcih is playing and start playing movie2 at "out" from that frame number?
on (rollOut) {gotoandPlay(_totalframes - _currentframe); }
maybe there is an easier way to get this to work, i've seen lots of similar examples on the web but nothing that specifically plays a lopp and then continues to the end on mouse out. it sounds simple but I've tried all weekend to do it without success?
Can anyone help me please?
Thanks,
Terrence.
Mouse Follow/stopfollow After Mouse Leaves Object (with Ease)
well, i think the title covers me entirely, i would like some help with a script.
The problem is, i have a scene with objects that at first they are static, when the mouse comes in and makes a move-over the scene and some objects,i have assigned multiple collision to the objects, i want when the mouse moves over a object, the object to follow the mouse,while colliding to all other objects and after a while i would like as the mouse moves away, the following to stop and the objects to return to its original spot with ease.
I know that this is a big one, but i would like some help if i could get
Detect Mouse _x & _y Attach Specific Clip And Have It Follow Mouse
I'm trying to make a clip that will have another clip attached (eventually it'll be a mask) when you roll over it. I want the mouse positon to be determined on rollover and a different clip (with different registration point) to be attached depending on which quadrant you rollover first. IE- you rollover the lower left quadrant of the mc first so an mc with an upper right registration point is attached and follows the mouse.
basically I want it to look like you're pulling a mask from out of nowhere onto the main mc from whatever corner you start on... (make sense?)
i'm trying to reconstruct what you see here (http://www.mullerphoto.com/)
this is the first baby step!
anyhow, here's my AS and i'll attach the .fla any help is great! I have the actionscript dictionary and am not afraid to use it, I just need help with the mechanics of how to actually do this (i.e.- which methods, properties, etc. to utilize) thanks!
Code:
leftfunction = function(){
if (patch._ymouse <= 100){
llowerfunction;
}else{
//this function starts the maskclip coming in from the upper left with a lower right reg point
_root.patch.attachMovie("lowerright", "lrclip", 1);
lrclip._x = _root.patch._xmouse;
lrclip._y = _root.patch._ymouse;
}
}
llowerfunction = function(){
//this function starts the maskclip coming in from the lower left with an upper right reg point
patch.attachMovie("upperright", "urclip", 1);
urclip._x = patch._xmouse;
urclip._y = patch._ymouse;
}
rightfunction = function(){
if (patch._ymouse <= 100){
rlowerfunction;
}else{
//this function starts the maskclip coming in from the upper right with a lower left reg point
patch.attachMovie("lowerleft", "llclip", 1);
llclip._x = patch._xmouse;
llclip._y = patch._ymouse;
}
}
rlowerfunction = function(){
//this function starts the maskclip coming in from the lower right with an upper left reg point
patch.attachMovie("upperleft", "ulclip", 1);
ulclip._x = patch._xmouse;
ulclip._y = patch._ymouse;
}
_root.patch.onRollOver = function() {
if (patch._xmouse <= 150){
leftfunction;
}else{
rightfunction;
}}
[F8] Loading And Unloading External SWF Code Issues, Code Check Please
Okay, I'm still clumsy with AS and I'm having problems loading and unloading external SWFs. I have SWFs created by others in Captivate that need to be controlled by a main menu. I created the menu and buttons and have been trying to code it so that with the button click, the appropriate external SWF loads in an empty movie clip, plays, and then closes at the final frame and returns to the menu. So far, I can get it to load, but then I'm stuck as I'm not sure what I'm missing as far as it reading the frame numbers.
Here's the code I've written. I can't seem to get my idea for the onEnterFrame function checking the frames to work.
What am I missing? Can anyone offer any suggestions or guidance? Thanks!
Code:
this.createEmptyMovieClip("clip1", 1);
myfirst_btn.onRelease = function() {
clip1.loadMovie("externalswf1.swf");
}
mysecond_btn.onRelease = function() {
clip1.loadMovie("externalswf2.swf");
}
mythird_btn.onRelease = function() {
clip1.loadMovie("externalswf3.swf");
}
clip1.onEnterFrame = function() {
if (clip1._currentframe == clip1._totalframes) {
// remove move clip1 and return to menu
clip1.removeMovieClip();
}
}
Custom Mouse Cursor Conflict With Mouse Trail
When I put mouse trails and custom mouse cursor script in the same scene the mouse trails work but the cursor does not change to the custom cursor. If I use the custom mouse cursor script in a seperate scene, on its own, it works fine. I think that the two scripts are conflicting.
Mouse trail script:
onClipEvent (enterFrame) {
//x movement
mx=_root._xmouse;
if (mx<_x) {
dx=_x-mx;
}
else {
dx=mx-_x;
}
moveSpeedx=dx/10;
if (mx<_x) {
_x=_x-moveSpeedx;
}
else {
_x=_x+moveSpeedx;
}
//y movement
my=_root._ymouse;
if (my<_y) {
dy=_y-my;
}
else {
dy=my-_y;
}
moveSpeedy=dy/10;
if (my<_y) {
_y=_y-moveSpeedy;
}
else {
_y=_y+moveSpeedy;
}
}
Custom mouse cursor script:
Layer 1(functions):
stop();
/* update the cursor coords */
function updateCursor() {
_root.cursor._x = _xmouse;
_root.cursor._y = _ymouse;
updateAfterEvent();
}
Layer 2(on event handlers):
onClipEvent(load) {
Mouse.hide();
this.swapDepths(100);
}
onClipEvent(mouseMove) {
_root.updateCursor();
}
Please help!
Mouse Direction Scroll With Mouse Over Image Enlargement...
Hi all..
Haven't had much luck finding a tutorial to help me do this one so any help locating it would be good.. I'm trying to design an image gallery where the images scroll left to right depending on mouse movement. Once a mouse is over an image it enlarges then returns to normal shape with mouse off.
any help appreciated..
cheers!
Scroller That Moves According To Mouse Movement Not Mouse Location.
I am trying to recreate the effect seen here:
Express Top Ten
alright here's the request:
I have found many scroller tutes most of which use buttons to control them. What I need or think I need is a tute or file to refer to, that uses a mouseover effect to move the movieclip with respect to how much the mouse has moved and still uses easing.
I have found files that make the movieclip move according to the mouse position on the stage, but i need it to move in according to how far it just moved.
feel free to email me with any questions.
thanks in advance,
chris
email me
Changing Mouse Cursor On Mouse Over/out Without Drag Movie?
Hello,
I have a movie clip/button that activates some actions but I don't want the mouse pointer show the link icon (hand) and instead show the normal arrow icon. Is this possible with a fast mouse.smth actionscript or is a complex startdrag/stopdrag of movieclips the only way out? Thanks in advance.
Mouse Hittest Too Slow? Mouse Passes Over Wall
Hi everyone,
I'm having a problem with a new game i'm working on.
I have the following code to attach a movieclip to the mouse:
Code:
startDrag(_root.dot, true)
Mouse.hide();
Ok, and i have a wall movieclip with the following:
Code:
if (_root.dot.hitTest(_root.wall)){
trace("hit!")
}
This works fine, as long as you move the mouse slowly -- if you zip it over the wall, it seems that the hittest doesnt have time to register the hit? Or that the "_root.ball" doesnt actually go over the wall, it just is transported to the new mouse location? (im not sure )
Any infomation on how to make the hittest 100% detect the mouse over the wall would be great.
Many thanks.
Regards.
[F8] Follow The Mouse - Stop Mc At Location Of Mouse On Click
I have an mc that follows the mouse a certain distance on the x in both directions and then eases to a stop when the mouse gets a certain distance.
What I need to do is to have the mc stop on button click at the x position it is at on click. Then, when another button is clicked the animation continues from it's stopped location to the new mouse location. All with easing of course.
Here is the code for the mouse tracking:
Code:
onClipEvent (load) {
speed = 3;
}
onClipEvent (load) {
stageWidth = 700;
imageWidth = 615;
}
onClipEvent (enterFrame) {
destx = (stageWidth-imageWidth)*(_root._xmouse/stageWidth)
_x += (destx-_x )/speed;
}
Any help would be greatly appreciated.
Getting An Object To Point Towards Mouse - Rotation - Mouse Follower
Hi guys, I'm kinda getting lost in AS3 and was hoping if someone here can help out.
Picture an arrow in the middle hanging from the top and at the bottom two buttons, Left and Right. When the user enters the frame with mouse, I want the arrow to point towards the mouse maybe with some ease if necessary. Obviously the user will either choose Left or Right so it will look like the arrow is pointing to the button. But I want the arrow object to follow the mouse in realtime and thats why i want to get it to follow the mouse and rotate accordingy, rather than making an animation such as play this when mouse is on button Left (OnRollOver).
So I'm looking for a good script to do that . Any help is appreciated.
|