PDA

View Full Version : [FMX] circles when you move the mouse



Deftones19391
January 5th, 2003, 11:57 AM
i want to know how to get that effect that ive seen on
www.monitorpop.com

it looks coool

Jubba
January 5th, 2003, 01:01 PM
I'm just gonna shove you in the right direction and then you can do a search of the forums to find out what you need to do.

You want to duplicate a movie clip every time the mouse moves. And you want to give the duplicated movie clip the same X and Y coordinates as the mouse.

The expanding circles are just a motion tween with an alpha reduction that are contained in the movie clip.

check out the function duplicateMovieClip() and put the code into a onMouseMove command.


EDIT::::....

And here's a tutorial for Flash 4 and 5 that might help a little. Its a different method than what I told you, but it gets the job done too...

http://www.kirupa.com/developer/flash5/poolofsquares.asp

pom
January 5th, 2003, 01:05 PM
It's the usual trailer technique:
You create a movie clip with a motion tween of a circle that grows bigger and bigger. In the frame after the last frame of the tween, put the code
this.removeMovieClip();Now all you have to do is attach that clip onMouseMove. To do that, give the clip a linkage name in your library, for instance circle, and this code in the first frame of your movie:
i=0;
this.onEnterFrame=function(){
mc=this.attachMovie("circle","c"+i,i);
mc._x=_xmouse;
mc._y=_ymouse;
i++;
}pom C:-)

//Edit: You're too fast, Jubby...

MZA
January 6th, 2003, 11:02 AM
im a noob at AS but i got stuck on this thread and tried to get that little onMouseMove to work and i got both Jubbas and ilyaslamasses ways to work. (yay! =) )
Only thing i would like to point out to the guy who started this thread, if he is as new as me, is that ilyaslamasse wrote:


i=0;
this.onEnterFrame=function(){
mc=this.attachMovie("circle","c"+i,i);
mc._x=_xmouse;
mc._y=_ymouse;
i++;
}

and i think it should be:


i=0;
this.onMouseMove=function(){
mc=this.attachMovie("circle","c"+i,i);
mc._x=_xmouse;
mc._y=_ymouse;
i++;
}

Maybe ilyaslamasse made it on purpose tho to get u thinking...hehe....atleast it got me to learn the code more then just copy/paste. THANK U! HE HE =)

also jubbas way u need to put the mc on the stage(outside view or not) so u can give the mc a instance name. right?? (atleast i couldnt find a way to give a mc an instance name any other way..)

great site.

-MZA

andr.in
January 6th, 2003, 11:40 AM
please note that the circles stop appearing when the mouse is not moved
That's the difference between onEnterFrame and onMouseMove
So it should be onMouseMove!

Deftones19391
January 6th, 2003, 06:59 PM
yeh,
im not to swift with action script yet...
i copied down what you guys wrote and put down my instances
as "circle" and stuff, but it doesn't follow my mouse.

i have this in the first frame


i=0;
this.onMouseMove=function(){
circle=this.attachMovie("circle","c"+i,i);
circle._x=_xmouse;
circle._y=_ymouse;
i++;
}

i dont really understand it all to well

MZA
January 6th, 2003, 07:23 PM
here is how u do it as ilyaslamasse wrote with one little change on his last code:

-------------------------------------------------------------
It's the usual trailer technique:
You create a movie clip with a motion tween of a circle that grows bigger and bigger. In the frame after the last frame of the tween, put the code


this.removeMovieClip();

Now all you have to do is attach that clip onMouseMove. To do that, give the clip a linkage name in your library, for instance circle, and this code in the first frame of your movie:


i=0;
this.onMouseMove=function(){
mc=this.attachMovie("circle","c"+i,i);
mc._x=_xmouse;
mc._y=_ymouse;
i++;


pom

-------------------------------------------------------------


"give the clip a linkage name in your library" means u right click on the movie clip u created first on library go to "linkage", click on "Export for ActionScript" and type in the name "circle" and then "ok". This way u dont have to give the clip an instance name.
If you do all this right it must work. :)


-MZA

pom
January 7th, 2003, 09:55 AM
Damned!! Yeah, of course I meant onMouseMove, it was just a huge typo. :beam: really. I swear it will never happen again.