[MX04] How Do I Make A Mouse Like This?
http://www.addictinggames.com/orange.html follow that link, there is a game with a really cool mouse does anyone know some script to make that mouse? i really dont know where to start it is probably something with _xscale and _yscale plz help
FlashKit > Flash Help > Flash ActionScript
Posted on: 06-29-2007, 08:56 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
[MX04] How To Make Something Like This?
i want to make something like that animation with people on this site:
http://www.bigbrother.rtl.hr/
i don't want to be the same, but just some tutorial how to make something similiar. thanks
[MX04] Snap To Mouse
hi,
sorry this is a simple thing to do but i just cant remember. How do i go about snapping a movie clip to the mouse so it can be dragged?
cheers
[MX04] Get Mouse Speed
is there script to get the x speed and y speed of the mouse? or of a movie clip. say there is an mc that you drag, and i want to get the speed its moving like in: http://www.thegamehomepage.com/play/spank-the-monkey/
[MX04] [CS3] Mouse Follower
Does anyone know or can anyone tell me why the butterfly in the top corner doesnt follow the mosue? www.testdrive-site.co.uk/mm
But it does in this?
www.testdrive-site.co.uk/mm/follower.html
Attatched is source code,
cheers.
[MX04] Make A Scrolling Box
Lets say i have a movie clip that is 300X300
i want to put it into something like a box with diminsions 200x300 (L*W).
Now i want to be able to not see the whole movie clip at once. I would have to scroll in this case up and down to see it.
[MX04] How To Make Graphics Fly In From Far Away
I would like to have some graphics appear one at a time as if they came from a distance (depth or 3D I guess you'd say) then dissapear. I'm sure its simple but I'm just not able to figure it out. Thanks for your help from a new newbie.
[MX04] Gah, Can't Make This Work.
I'm developing a simple game project in which the character can enter doors and move through rooms. I was hoping to do this by having a hit-test on the door and also having the player hit the space bar, making the game move to a different frame. Now, I thought this would be easy, but I was wrong :P... I'm very new at actionscript, so I'm not sure if there is a much easier way to program this. This is what I have so far, and it is by far doing the incorrect results:
On the player..
Code:
onClipEvent (load) {
_root.right=true
_root.left=true
}
onClipEvent (enterFrame) {
f_r_mc.gotoAndStop(1);
f_l_mc.gotoAndStop(1);
if (Key.isDown (Key.RIGHT)) {
f_l_mc.gotoAndStop(2);
_x+=5
}
if (Key.isDown (Key.LEFT)) {
f_r_mc.gotoAndStop(2);
_x-=5
}
}
This works fine.
On my main entrance door:
Code:
onClipEvent (enterFrame) {
if ((hitTest(_root.player_mc))
and(Key.isDown(Key.SPACE))==true)
set (Enter_Door_1,1);
else ((hitTest(_root.player_mc))
and(Key.isDown(Key.SPACE))==false)
set (Enter_Door_1,0);
}
And then on my action frame:
Code:
set(Enter_Door_1,0);
if (Enter_Door_1==1)
gotoAndStop(2);
else (Enter_Door_1==0)
stop();
I'm pretty sure a lot of the things I did were unnecessary and there definitely has to be an easier way to do this, especially since this does not work. Like I said earlier, I'm very new at flash actionscript so forgive me if I seem to lack 'Programmer common-sense', hehe.
Right now its not producing any errors, but it is not moving to frame two when the character is touching the door and the space bar is being pressed.
[MX04] How Do I Make Snow Go UP Not Down?
What in this code should I change?
onClipEvent (load) {
//variables
width = 300;
height = 83;
//random x,y, and alpha
this._xscale = this._yscale=50+Math.random()*100;
this._alpha = 20+Math.random()*50;
//random x and y for flakes
this._x = -width+Math.random()*(3*width);
this._y = -10+Math.random()*height;
//speed and trigonometric value
i = 1+Math.random()*2;
k = -Math.PI+Math.random()*Math.PI;
rad = 0;
}
onClipEvent (enterFrame) {
// horizontal movement
rad += (k/180)*Math.PI;
xmovement = _root._xmouse;
this._x -= Math.cos(rad)+(xmovement-(width/2))/50;
// vertical movement
this._y += i;
// remove clips when they misbehave (overstep boundaries)
if (this._x>(width+50)) {
this._x = -45;
this._y = Math.random()*height*2;
}
if (this._x<-50) {
this._x = width+45;
this._y = Math.random()*height*2;
}
if (this._y>=height) {
this._y = -50;
this._x = -width+Math.random()*(3*width);
}
}
[mx04] Using HitTest/getbounds With Mouse?
Thank you for taking the time to read this. I have sucssefully used the StartDrag function with all of it's parameters and the onRelease outside in a previous game. The current game that I am writing has a square in the dead center (mcInternalBoundary) and a border on the outside called(mcExternalBoundary). The idea is that the player cannot leave the area in between. I can currently do that using the arrow keys the way that the tutorials have it set-up and it works.
The issue that I am having is that none of the tutorials that I have studied have explained how to do this with a mouse.
We would like for the movement of mcPlayer to be controlled by the mouse.
my current code is :
code: function PlayerMovement():Void {
mcPlayer.onEnterFrame = function() {
MovementSpeed = 2;
MyBounce = 2;
if (Key.isDown(Key.RIGHT)) {
this._x += MovementSpeed;
}
if (Key.isDown(Key.LEFT)) {
this._x -= MovementSpeed;
}
if (Key.isDown(Key.UP)) {
this._y -= MovementSpeed;
}
if (Key.isDown(Key.DOWN)) {
this._y += MovementSpeed;
}
if (mcPlayer._x<300 && mcPlayer.hitTest(mcInternalBoundary)) {
mcPlayer._x -= MyBounce;
}
if (mcPlayer._x>500 && mcPlayer.hitTest(mcInternalBoundary)) {
mcPlayer._x += MyBounce;
}
if (mcPlayer._y<300 && mcPlayer.hitTest(mcInternalBoundary)) {
mcPlayer._y -= MyBounce;
}
if (mcPlayer._y>500 && mcPlayer.hitTest(mcInternalBoundary)) {
mcPlayer._y += MyBounce;
}
if (mcPlayer._x<100 && mcPlayer.hitTest(mcExternalBoundary)) {
mcPlayer._x += MyBounce;
}
if (mcPlayer._x>700 && mcPlayer.hitTest(mcExternalBoundary)) {
mcPlayer._x -= MyBounce;
}
if (mcPlayer._y<100 && mcPlayer.hitTest(mcExternalBoundary)) {
mcPlayer._y += MyBounce;
}
if (mcPlayer._y>700 && mcPlayer.hitTest(mcExternalBoundary)) {
mcPlayer._y -= MyBounce;
}
};
}
If there is a tutorial or a forum listing that I missed (although I've been searching since Monday morning), would you be so nice as to tell me where it is, or if it's an easy explination explain it.
Thank you for your time and effort in this endevor.
[MX04] Control MC With Mouse Instead Of Keys..
Hey, started trying something brand new to me again... this time I am moving the "character" with the mouse instead of the keyboard.
Since I have never done this before, and never even looked at how to do it, I was surprised to find it only took me 2 attempts to get the mouse to move the MC!!
so far in the "scripts" layer I have this:
Code:
stop();
startDrag("dragon", true);
setProperty("dragon", _x, 500 / 2);
setProperty("dragon", _y, 500 / 2);
Mouse.hide();
Then, of course I have my "chracter" with instance name of "dragon"
I was wondering though, how would I go about preventing the MC from flying off the stage and not allowing it to go over half way UP.
the stage is 500 X 500, and I want the appearance of bottom to top (not left to right) so in essence the "dragon" would be able to move all the way left and all the way right, all the way to the bottom, but only 1/3 or 1/2 the way up...
I have tried a few things that seemed logical, but did nothing. I tried searching here, but we all know how that goes, LOL
Ideas?
~MoN
[MX04] Drop Down On Mouse Co-ordinate
Hi I having been searching tirelessly for a script that creates a drop down or pop up menu that will activate based on the mouses proximity.
I had originally created a rollover menu with an invisible roll out button so that it would pop back up but this is abit messy and doesnt function as smoothly as an actionscripted method.
Basically when the mouse is close to the menu it should fall down and when it moves away a certain distance is should move back up.
Thanks.
[MX04] Hit Test, Or Mouse Position?
I need to be able to record how the mouse moves while the button is pressed. I imagine this as a grid of 9 boxes, and I'd like to record each instance where the mouse passes through the center of a box.
For example, if the mouse goes through the grid in this order 1,2,3,5,7,8,9, the user has drawn a Z.
The easiest way to do it would be to trigger my script on mouseover of each box in the grid, but Flash won't register mouseovers while the button is down.
So I'm wondering what the best approach will be. Either I can set up a boatload of if statements and keep checking mouse position to see which if any of my hit areas it's over, or I can assign a movieclip to follow the mouse around and do a hit test on my hot areas.
Anyone have any suggestions, or examples of similar projects?
Thanks a bunch.
[MX04] Detect Is Mouse Is Over Movieclip
Hi there,
You might think that this is a stupid question, since everyone who knows a little bit of actionscripting, knows that this can be achieved with onRollOver ... But that's not exactly what I'm looking for.
I have a small tooltip which follows the mouse and asks the user to click in order to close a picture. The tooltip follows the mouse using startDrag("tooltip", true);
But I'd like to remove the tooltip once the user moves the mousepointer outside the picture.
Though, when you use onRollOver, the mousepointer changes into a finger. This is not what I'm looking for since the picture than functions and looks like a button.
So is there any way to detect if a mousepointer is over a movieclip, without changing the cursor?
[MX04] Detect Is Mouse Is Over Movieclip
Hi there,
You might think that this is a stupid question, since everyone who knows a little bit of actionscripting, knows that this can be achieved with onRollOver ... But that's not exactly what I'm looking for.
I have a small tooltip which follows the mouse and asks the user to click in order to close a picture. The tooltip follows the mouse using startDrag("tooltip", true);
But I'd like to remove the tooltip once the user moves the mousepointer outside the picture.
Though, when you use onRollOver, the mousepointer changes into a finger. This is not what I'm looking for since the picture than functions and looks like a button.
So is there any way to detect if a mousepointer is over a movieclip, without changing the cursor?
[MX04] I Want Things To Avoid My Mouse Pointer
i am after replicating this effect:
http://www.manchester235.com/flash.html
the circles around the 3d box move when moused over and return on mouse off, but the direction they move in is dependant upon the direction the mouse hits it.
as a relatively basic action scripter, can anyone point me to an example .fla of this method or help me in any other way?
thanks!
How To Make A File Downloadable? [MX04]
I've made a screensaver and I would like to post it on my flash site so it is possible to download it, I've tried with this script but it doesn't work:
on (release) {
getURL("http://www.mysite.com/screen/screensaver.exe", "_blank");
}
any idea?
Panchoskywalker.
[MX04] Make Black Fade In/out
Hello!
I was wondering if there is a way to make a black square fade in when you press a button on the keyboard (like b), then fade out when you press a different button (like v). I would want to be able to add this actionscript to different slides so that I can just press b and v whenever I want so I can black out the screen then get everything back
Thanks
[MX04] Doesn't Make Sense
I'm making a program to draw a line on a graph from the equation in the form y=mx+b.
I get two different results when I change the following line of code in my program and I can't figure out why.
Code:
yinter = b;
This gives an output of this http://img243.imageshack.us/img243/9648/badag4.jpg
I don't think this is what a graph of the line y=3x+1 should look like
However when I change Only the code above to
Code:
yinter = -b*-1;
It graphs the line correctly
http://img243.imageshack.us/img243/1069/goodgi6.jpg
If anyone could shed some light on this I'd really appreciate it
here's the full code for this:
Code:
//set initial values
SW = Stage.width;
SH = Stage.height;
//vars for the graph
Pixels = 20;
//change this value to change the size of the graph
ticks = 10;
//origin of the plane
Xorigin = (ticks*pixels);
Yorigin = (ticks*pixels)+(SH-((ticks*2)*25));
//size of grid ticks
hash = ticks*pixels;
//drawing the graph//
//////////////////////
lineStyle(1, 0x000000, 100);
moveTo(Xorigin-ticks*pixels, Yorigin);
lineTo(Xorigin+ticks*pixels, Yorigin);
////
moveTo(Xorigin, Yorigin-ticks*pixels);
lineTo(Xorigin, Yorigin+ticks*pixels);
/////
//draw y-axis hash marks
lineStyle(1, 0x0000FF, 20);
for (var c = -ticks; c<=+ticks; c++) {
moveTo(Xorigin-hash, Yorigin-c*pixels);
lineTo(Xorigin+hash, Yorigin-c*pixels);
}
//draw x-axis hash marks
lineStyle(1, 0x0000FF, 20);
for (var c = -ticks; c<=+ticks; c++) {
moveTo(Xorigin-c*pixels, Yorigin-hash);
lineTo(Xorigin-c*pixels, Yorigin+hash);
}
//drawing a line in the form y=mx+b
function onDraw() {
slope = rise/run;
yinter = -b*-1;
trace("slope: "+slope+" b: "+yinter);
//finding starting point on the fictional grid of 10 by 10
//finding first point
for (var c = -ticks; c<=+ticks; c += .01) {
var y = (slope*c)+yinter;
if (y>=-ticks and y<=ticks) {
trace("X1:"+c+" Y1:"+y);
x1 = c;
y1 = y;
break;
}
}
/////////////////////
//finding second point
////////////////////
for (var c = ticks; c>=-ticks; c -= .01) {
var y = (slope*c)+yinter;
if (y>=-ticks and y<=ticks) {
trace("X2:"+c+" Y2:"+y);
x2 = c;
y2 = y;
break;
}
}
//actually drawing the line
lineStyle(2, 0xFF0000, 100);
moveTo(Xorigin+(x1*pixels), Yorigin-(y1*pixels));
lineTo(Xorigin+(x2*pixels), Yorigin-(y2*pixels));
}
Here's the .fla with line 37 in the code layer in the form of
yinter = -b*-1;
http://www.megaupload.com/?d=W1ES3SHJ
Thanks for your time
[MX04] How Do I Make Moving Buttons?
I'm new to flash and I managed to animate moving shapes in independant movie loops on my stage...if I'm explaining it correctly. I want to make each shape a clickable link to my next scene but I can't figure out how to do that? I've been trying at this for a long time now and I'm getting nowhere...
[MX04] Playing A Sound When The Mouse Moves Fast?
Hi! The flash site I'm working on has an underwater theme, and I think it would be neat to have it make sort of "whoosh" sound when the mouse moves fast, like the sound that comes from moving your hand through water, and I was wondering if there was a way for actionscript to know when the mouse moves quickly. It's not comepletely neccessary, just something that would be cool and add to the underwater feel of the thing.
Thanks!
[MX04] Make An Email Button In A Movieclip
Hi
I've looked and tried several different things but can't seem to make a button in a movieclip that onRelease opens a new email with the email address already in the "to" section.
I have been able to make this work if the button is on the main timeline - just not when in a movie clip - even though the button appears to recognise the "over" and "down" states.
the code I put on the main timeline that works fine is
nameOfButton_btn.onRelease = function(){
getURL("mailto:firstname.lastname@email.com");
}
I thought perhaps something as below
movieClipInstance.nameOfButton_btn.onRelease = function(){
getURL("mailto:firstname.lastname@email.com");
}
but this didn't seem to work.
I tried putting this in both the main timeline and the movieclip timeline...but NOPE!
this is to be used on invites that will be emailed out. - the reciever can click on the "Click here to RSVP" button
Can anyone help?
Many thanks!
[MX04] How Can I Edit This To Make It Slide Quicker?
Hi, I'm using the following flash file from a tutorial here on FlashKit. However, after applying it to my situation, the "slide" is extremely slow. Is there any way I can bump up the speed? Thanks a lot.
http://www.flashkit.com/movies/Inter...1759/index.php
[MX04] Trying To Make Animated GIF From Movie Clip
I have a Flash movie with a movie clip that I'm wanting to turn into an animated GIF so I can use it on a regular HTML page. I put the movie clip in a separate movie, changed my publish settings to include the gif format, then on the gif tab, I set playback to be "animated" and "loop continuously". When I publish, it spits out a gif, but without the animation. Any ideas what I might be doing wrong? I also tried just exporting the movie clip as a GIF but I get the same result. There's no action script on the movie clip -- it just loops continuously.
The fla file is here. I have it set to publish in windowless transparent mode because I only want the note to appear, not the background.
[MX04] MAke Dynamic Text Box Count To 100
Ok I pretty much of a newb at action script although i do know the basics.
I have been trying for hours to get this:
I want to make a dynamic text box to count from 0 to 100
i want it to count faster than seconds but slower that milliseconds.
I am going to convert the dynamic text box & actions into a symbol
I just need the actions part.
The dyanamic text box is a symbol, has an instance name of Count_txt
Count_txt is linkaged for action script
Its IDentifier name is count
In the action script, when it reaches 100 i just want it to stop right there
I hoped i specified it well enough. I have been trying for hours to get it. If someone could please post the actionscript (2.0) for me that would be awsome! I will praise you forever...kinda.
If you could explain how you did it then That would be even better! but you dont have to go through the trouble if you dont want to.
[MX04] How To Make A Button Remembers If It Has Been Pressed?
Hi there,
First of all I'm new to actionscript and I am building a slideshow with each slide on the individual keyframe on the main timeline. I need to have a button and load and unload external movieclip (for captions). How do I make the command that is carried over the whole presentation, and does not revert to the original state on the next slide (i.e. once the user turns off the caption, it knows not to load the caption for the next frame.)
Here's the code I used to toggle the caption button.
Code:
switch_mc.onRelease = function() {
if (switch_mc._currentframe == 10) {
switch_mc.gotoAndStop("on");
loadMovieNum ("caption"+_root._currentframe+".swf", 1 );
} else {
switch_mc.gotoAndStop("off");
unloadMovieNum (1);
}
}
Would really appreciate any advice. Thanks!
[MX04] How Do I Make Text Boxes Longer?
Whenever I increase the dimensions of the text box, it makes the box bigger, but it also stretches the text as if it were an image.
I would like to have the same size text, but just have more room to type.
It's a pretty ridiculous question because I know it's going be super easy, but I'm only on my second day here..
[MX04] Combining Strings And Variables To Make Names
How do I combine a string with a variable to call the name of an object?
For example, say that I am attaching a blocks to the root time line every time the mouse is clicked. I will name the clip like this:
Code:
attachMovie("blockID", "block" + i, i)
i = i + 1;
Now say that I want to control the X Position of the block, how do I do that?
["block" + i - 1]._x doesnt work.
[MX04] How To Make Player Walk On Ruged Platforms
I need help on making a charecter walk on a like rocky platforms or hills.
i already know how to make an object walk on flat platforms
SEE
player.gravity = 0;
platforms = 2;
player.xmove = 0;
xinc = 2;
xmax = 25;
onEnterFrame = function () {
for (i=1; i<=platforms; i++) {
if (i == 1) {
player.hits = 0;
}
if (player.hitTest(_root['ground'+i]) && player.gravity>=0) {
player.hits++;
player._y = _root['ground'+i]._y;
}
}
if (player.hits>0) {
if (Key.isDown(Key.UP)) {
player.gravity = -10;
} else {
player.gravity = 0;
}
} else {
player.gravity++;
}
player._y += player.gravity;
if (Key.isDown(Key.LEFT) && player.xmove>-xmax) {
player.xmove -= xinc;
player._xscale = 100;
} else if (Key.isDown(Key.RIGHT) && player.xmove<xmax) {
player.xmove += xinc;
player._xscale = -100;
} else {
player.xmove *= 0.9;
}
player._x += player.xmove;
};
please please help thank you.
[MX04] Figure Out How To Make This Code Work In My Flash 7 Files.
//this is a code to ensure flash is only played on my server as a security measure. I would like to use it but I am not able to really implement this for my flash. Would like a consultant.
PHP Code:
sStolen = function(ourDomainName){ var protocol, urlString, part1, part2, part3, part4, domain; //Get the current url urlString = _root._url; protocol = urlString.substr(0, urlString.indexOf(":")); //if we are on the internet.. do the check if (protocol == "http") { /*get everything between the "://" and the next "/"*/ part1=urlString.indexOf("://")+3; part2=urlString.indexOf("/", part1); domain=urlString.substring(part1,part2); //throw away any prefixes of "." part3=domain.lastIndexOf(".")-1; part4=domain.lastIndexOf(".", part3)+1; domain=domain.substring(part4, domain.length); //Do the right thing! if(domain != ourDomainName){ return(true); }//End if }//End if}//End function//Do a check for theives..send them to your pageif (isStolen("yourDomain.com")) { getUrl("****off.htm"); return;} else { delete(isStolen);}//End if
Hide Mouse, But How Make Your Own ?
Several times you see sites and ads where the windows cursor is replaced by an other cursor.
but how ?
I know that at the first frame you should put this code:
Mouse.hide ();
but that only makes it disappear, how do i put the cursor i want ?
thx for reading and keep flashing !
How To Make A MC Follow The Mouse?
What I mean is, how can I make those eyes that look at your mouse anywere you move it.
Can someone please tell me what actions to use?
thanks
HOW Make A MC Follow Mouse ?
Hi, how can you make a movieclip follow your mouse with a little bit delay, like an elastic rubber ...
please help...
Make A Mc Follow The Mouse...?
Alright...I have a navigation menu that can be minimized into a little box. I'd like to make it so that when minimized, the the menuBox will slowly follow the mouse around the screen rather than remaining in a fixed location. How can I do this?
I tried to do a little action scripting myself but it just wasn't working...I'm not that adept with it yet. Does anyone have a way to do this? Maybe some sample script?
Thanks! I know this might be a tough one...
Clint
How To Make An Effect While Mouse Over
I created an image as a button, and i want it to blur out when i mouse over it. however in the "over" state column theres only 1 frame where I can edit it , and therefore i cant add a motion tween. how would i accomplish this? thanks.
How To Make Something Follow The Mouse
in part of a website i have drawn a sphere and shaded it, and i was wondering if enyone could help me make the shading on the shpere move as if the mouse was the source of light.
Make Mc Appear Only When Mouse Is Over Certain Line
hi all....
I am currently doing a physics report (in flash, strange yes, but o well...)
At the moment i am expalining something that involves two sin graphs out of phase by 120 degrees.
So i have two empy moveclips that will dynamically create the movieclip. (using the lineto(); method).
I also have a movie clip (instance name of hor_phase) that i have already made to have an x and y value of the mouse.
I want it so that when the mouse is over (near it as well would be preferable if possible) then the movieclip will be visible. (the movieclip is just a line with a label saying 120 degrees, so that if one end is one one graph, the other end will be on the same spot on the other graph, to show the two graphs are 120 degrees out of phase.
The only problem is i have no idea how to do this, so if someone could help me, that would be fantastic... (also, the report is due very soon, and as much as i hate rushing people, i am in a sense of urgency here ).
thnx for help...
(what i have is attached)
F8 - Make Mouse Hit Object
I have my custom cursor in flash, but dont want it to interact with a simple movieclip in my scene. Its just the shape of a heart.
Can i have it so that the cursor wont go through this object in my scene?
thanks!
Make My Mouse Chaser Better
Here is my own first try to make a mouse chaser. It looks horrible, but it does chase the mouse. :P
i would like to know the experts idea on how to
1. properly code this
2. make the chaserObject not bounce around when it reaches the mouse
3. also make it ease out, when it gets closer to the mouse.
Looking forward to your wisdom.
Code:
speed = 5;
object.onEnterFrame = function() {
targetX = _root._xmouse;
currentX = getProperty("object", _x);
if (currentX<targetX) {
object._x += speed;
}
if (currentX>targetX) {
object._x -= speed;
}
box.text = "targetx: "+targetX+" currentX: "+currentX+" mouseX:"+_root._xmouse;
targety = _root._ymouse;
currenty = getProperty("object", _y);
if (currenty<targety) {
object._y += speed;
}
if (currenty>targety) {
object._y -= speed;
}
box2.text = "targety: "+targety+" currenty: "+currenty+" mousey:"+_root._ymouse;
};
How Was This Make This Mouse Follow?
I am trying to build this effect on http://www.marvyndt.com/v2/ in his port. The mouse changes into a custom curser then moves back where the mouse is?
any ideas??
Thanks
|