Be a Supporter!

AS: Custem Cursor

  • 6,085 Views
  • 40 Replies
New Topic Respond to this Topic
lan00
lan00
  • Member since: May. 20, 2005
  • Offline.
Forum Stats
Member
Level 07
Blank Slate
AS: Custem Cursor Oct. 1st, 2005 @ 04:02 AM Reply

======
INTRO
======
ok so you want a custem cursor for your movies/games well you have came to the right place.
(i dont know if this has been done before but ohwell....)
Any questions please Email Me or post a reply here thanks.

http://flash-fantasy.com

=========
Let's Do It
=========
Ok so you wanna make a custom cursor for your flash movies?
well read below and find out how!

1. Create a Movie Clip (from now on it's MC) by going insert>new symbol name it cursor
2. Now draw the cursor you want.
3. Now this is an important part so LISTEN WELL.
You have to make sure the clicky part of the cursor is centered in the middle of the MC
4. Go to the main scene and open the libray (CTRL + L) and drag the cursor on to the stage
5. Now click on the cursor and open the actions panel (or push F9) and put these scripts onto the cursor

onClipEvent(load) { //when the movie clip loads
Mouse.hide(); // hide the normal mouse
startDrag(this,true); // and drag the cursor MC to follow the mouse
}

INFO
onClipEvent(load) means when the flash player loads the movie
Mouse.hide(); Means it will hide the normal mouse
startDrag(this,true); Means that the cursor MC will be draged in the center of the normal mouse position (which it is important why you center the clicky part)

6. Now push CTRL + ENTER and test the movie the cursor should follow the mouse

Finished, Enjoy!

**NOTE**
The mouse may lag when viewing the flash but you can make it more smoother by making the FPS (Frames-Per-Second AKA Frame Rate) more like about 20

IWantSomeCookies
IWantSomeCookies
  • Member since: Aug. 20, 2004
  • Offline.
Forum Stats
Member
Level 13
Blank Slate
Response to AS: Custem Cursor Oct. 1st, 2005 @ 04:15 AM Reply

Yay. Another bookmark for me. Lol.

Great tutorial - and yes, its actually a proper tutorial not a CTRL+V job ;-)


"Actually, the server timed out trying to remove all your posts..."
-TomFulp

lan00
lan00
  • Member since: May. 20, 2005
  • Offline.
Forum Stats
Member
Level 07
Blank Slate
Response to AS: Custem Cursor Oct. 1st, 2005 @ 04:42 AM Reply

thanks alot

PS: there are more tutorials at http://flash-fantasy.com

Flashdavis
Flashdavis
  • Member since: Sep. 15, 2005
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to AS: Custem Cursor Oct. 1st, 2005 @ 04:42 AM Reply

thaxs

Toast
Toast
  • Member since: Apr. 2, 2005
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to AS: Custem Cursor Oct. 1st, 2005 @ 04:56 AM Reply

Nice and detailed, but you mispelled "Custem" :P

Word corrects it to "Custom", but I'm not sure... =p


BBS Signature
Rustygames
Rustygames
  • Member since: May. 7, 2005
  • Offline.
Forum Stats
Member
Level 19
Programmer
Response to AS: Custem Cursor Oct. 1st, 2005 @ 04:58 AM Reply

even better

onClipEvent (enterFrame) {
this._x = _root._xmouse
this._y = _root._ymouse
updateAfterEvent ()
}

But I dunno may be heavier


- Matt, Rustyarcade.com

Hamypig
Hamypig
  • Member since: Sep. 11, 2005
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to AS: Custem Cursor Oct. 1st, 2005 @ 05:02 AM Reply

its a wicked way for a cursor but kinda hard cos you easy get muddled

liam
liam
  • Member since: Dec. 11, 2004
  • Offline.
Forum Stats
Member
Level 22
Blank Slate
Response to AS: Custem Cursor Oct. 1st, 2005 @ 05:52 AM Reply

This topic is gay, custom cursors are in AS:Drag & Drop I believe (maybe not by Inglor but someone else posted it).


Sup, bitches :)

BBS Signature
Denvish
Denvish
  • Member since: Apr. 25, 2003
  • Offline.
Forum Stats
Member
Level 46
Blank Slate
Response to AS: Custem Cursor Oct. 1st, 2005 @ 05:54 AM Reply

At 10/1/05 05:52 AM, -liam- wrote: This topic is gay, custom cursors are in AS:Drag & Drop I believe (maybe not by Inglor but someone else posted it).

Also, none of your tuts have a link back to AS: Main at the top.


- - Flash - Music - Images - -

BBS Signature
liam
liam
  • Member since: Dec. 11, 2004
  • Offline.
Forum Stats
Member
Level 22
Blank Slate
Response to AS: Custem Cursor Oct. 1st, 2005 @ 05:58 AM Reply

At 10/1/05 05:54 AM, Denvish wrote: Also, none of your tuts have a link back to AS: Main at the top.

Me?

AS:Swap Depths, AS:Random Movement, AS:Upload/Download.


Sup, bitches :)

BBS Signature
lan00
lan00
  • Member since: May. 20, 2005
  • Offline.
Forum Stats
Member
Level 07
Blank Slate
Response to AS: Custem Cursor Oct. 1st, 2005 @ 06:04 AM Reply

At 10/1/05 05:54 AM, Denvish wrote: Also, none of your tuts have a link back to AS: Main at the top.

ok sorry ill put it on the top from now on

Toast
Toast
  • Member since: Apr. 2, 2005
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to AS: Custem Cursor Oct. 1st, 2005 @ 06:12 AM Reply

At 10/1/05 05:58 AM, -liam- wrote:
At 10/1/05 05:54 AM, Denvish wrote: Also, none of your tuts have a link back to AS: Main at the top.
Me?

AS:Swap Depths, AS:Random Movement, AS:Upload/Download.

No, not you, silly Liam :P


BBS Signature
T-H
T-H
  • Member since: Jan. 7, 2004
  • Offline.
Forum Stats
Member
Level 40
Blank Slate
Response to AS: Custem Cursor Oct. 1st, 2005 @ 06:20 AM Reply

At 10/1/05 04:58 AM, Ninja-Chicken wrote: onClipEvent (enterFrame) {
this._x = _root._xmouse
this._y = _root._ymouse
updateAfterEvent ()
}

Yeah thats one of my favorites, heavy in-game but I generally only like custom cursors on the menu anyway.

What the fuck is this topic, I hate it when uninformed semi-n00bs try to make AS topics.

liam
liam
  • Member since: Dec. 11, 2004
  • Offline.
Forum Stats
Member
Level 22
Blank Slate
Response to AS: Custem Cursor Oct. 1st, 2005 @ 06:25 AM Reply

At 10/1/05 06:12 AM, -Toast- wrote: No, not you, silly Liam :P

I wondered why he was quoting me, now I realise.. silly silly Liam =)


Sup, bitches :)

BBS Signature
Paranoia
Paranoia
  • Member since: Apr. 22, 2005
  • Offline.
Forum Stats
Member
Level 35
Game Developer
Response to AS: Custem Cursor Oct. 1st, 2005 @ 06:41 AM Reply

At 10/1/05 04:58 AM, Ninja-Chicken wrote: even better

onClipEvent (enterFrame) {
this._x = _root._xmouse
this._y = _root._ymouse
updateAfterEvent ()
}

But I dunno may be heavier

Call me Mr Silly-AS-N00b, but what does updateAfterEvent() do?

*Shame at stupid question*


BBS Signature
Toast
Toast
  • Member since: Apr. 2, 2005
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to AS: Custem Cursor Oct. 1st, 2005 @ 06:46 AM Reply

It basically "updates" the cursor's _x and _y every time you move teh mouse.


BBS Signature
Paranoia
Paranoia
  • Member since: Apr. 22, 2005
  • Offline.
Forum Stats
Member
Level 35
Game Developer
Response to AS: Custem Cursor Oct. 1st, 2005 @ 06:48 AM Reply

At 10/1/05 06:46 AM, -Toast- wrote: It basically "updates" the cursor's _x and _y every time you move teh mouse.

Yeah I sorta could have guessed that... But I'm sure I've used that script before without the "updateAfterEvent()" and it still works fine. Won't the "onClipEvent(enterFrame)" have the same effect anyway?


BBS Signature
liam
liam
  • Member since: Dec. 11, 2004
  • Offline.
Forum Stats
Member
Level 22
Blank Slate
Response to AS: Custem Cursor Oct. 1st, 2005 @ 07:11 AM Reply

updateAfterEvent

Availability
Flash Player 5.

Usage
updateAfterEvent()

Parameters
None.

Returns
Nothing.

Description
Action; updates the display (independent of the frames per second set for the movie) when you call it within an onClipEvent handler or as part of a function or method that you pass to setInterval. Flash ignores calls to updateAfterEvent that are not within an onClipEvent handler or part of a function or method passed to setInterval.


Sup, bitches :)

BBS Signature
Paranoia
Paranoia
  • Member since: Apr. 22, 2005
  • Offline.
Forum Stats
Member
Level 35
Game Developer
Response to AS: Custem Cursor Oct. 1st, 2005 @ 07:14 AM Reply

At 10/1/05 07:11 AM, -liam- wrote: ...(independent of the frames per second set for the movie)

Aha! Right I get that now...

Though wouldn't you a movie with a decent frame rate to have enough to allow for smooth sursor movement without the UpdateAfterEvent()? Meh, I dunno if its worth having that in...


BBS Signature
Toast
Toast
  • Member since: Apr. 2, 2005
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to AS: Custem Cursor Oct. 1st, 2005 @ 07:16 AM Reply

The only problem with it is that it is laggy.


BBS Signature
Paranoia
Paranoia
  • Member since: Apr. 22, 2005
  • Offline.
Forum Stats
Member
Level 35
Game Developer
Response to AS: Custem Cursor Oct. 1st, 2005 @ 07:19 AM Reply

Yeah seems like a choice between (possible) reasonable smooth movement based on framerate and very smooth movement with more lag...


BBS Signature
liam
liam
  • Member since: Dec. 11, 2004
  • Offline.
Forum Stats
Member
Level 22
Blank Slate
Response to AS: Custem Cursor Oct. 1st, 2005 @ 07:19 AM Reply

At 10/1/05 07:14 AM, -Paranoia- wrote: Though wouldn't you a movie with a decent frame rate to have enough to allow for smooth sursor movement without the UpdateAfterEvent()? Meh, I dunno if its worth having that in...

A higher framerate does help, but it still isn't as smooth. Also, even if you have a framerate of 120 the movie/game will not always run that fast, it depends on what Flash is doing (if it is having to render loads of vectors it will be slow).


Sup, bitches :)

BBS Signature
Rustygames
Rustygames
  • Member since: May. 7, 2005
  • Offline.
Forum Stats
Member
Level 19
Programmer
Response to AS: Custem Cursor Oct. 1st, 2005 @ 08:04 AM Reply

At 10/1/05 07:19 AM, -Paranoia- wrote: Yeah seems like a choice between (possible) reasonable smooth movement based on framerate and very smooth movement with more lag...

thats doesnt make sense
Smooth movement with lag ?!?!
Trust me one extra little thing just on the menu or something really wont hurt the overall performance of the game : P


- Matt, Rustyarcade.com

CaptinChu
CaptinChu
  • Member since: Sep. 11, 2005
  • Offline.
Forum Stats
Member
Level 15
Blank Slate
Response to AS: Custem Cursor Nov. 8th, 2005 @ 03:08 PM Reply

And also! If you want to animate the cursor, here's what you can do.

After you put in all that code, you can double click on the cursor. On the top of the screen, it should have the symbol name on it. You can now edit your symbol, and it will be an animated cursor! W007ness!

If you need anymore help, just E-mail and I'll do the best I can.

scrimpy
scrimpy
  • Member since: Aug. 26, 2005
  • Offline.
Forum Stats
Member
Level 18
Blank Slate
Response to AS: Custem Cursor Mar. 17th, 2006 @ 10:21 AM Reply

The Tutorial is nice. It really helped me alot but I have a suggestion: Replace the "onClipEvent(load)" with "onClipEvent(enterFrame)"

If you are pressing the right click button, the actual cursor appeared. With this little change it doesn't

~ scrimpy

Pyromaniac
Pyromaniac
  • Member since: Jan. 14, 2005
  • Offline.
Forum Stats
Member
Level 18
Blank Slate
Response to AS: Custem Cursor Mar. 17th, 2006 @ 11:49 AM Reply

This is all outdated AS. Here is a much better way.
Custom Cursor
1-Make a Movieclip.
2-Make the clicky part on the little plus inside the MC.
3- Give it these actions
onClipEvent(load){ Mouse.hide();
}
onClipEvent(enterFrame){
this._x=_root._xmouse;
this._y=_root._ymouse;
}

Spaceon
Spaceon
  • Member since: Jun. 8, 2006
  • Offline.
Forum Stats
Member
Level 06
Blank Slate
Response to AS: Custem Cursor Jun. 26th, 2006 @ 03:41 PM Reply

thx that helped me!

r-50
r-50
  • Member since: Feb. 15, 2007
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
Response to AS: Custem Cursor Feb. 15th, 2007 @ 12:48 PM Reply

none are working for me

suppi
suppi
  • Member since: Jun. 29, 2003
  • Offline.
Forum Stats
Member
Level 07
Audiophile
Response to AS: Custem Cursor May. 6th, 2007 @ 06:21 PM Reply

and right before the update after event, u can stick

this._rotation=_x

and make it cooler :)

TeeTeeJay
TeeTeeJay
  • Member since: Feb. 17, 2006
  • Offline.
Forum Stats
Member
Level 07
Blank Slate
Response to AS: Custem Cursor Nov. 24th, 2007 @ 12:26 PM Reply

At 3/17/06 11:49 AM, Pyromaniac wrote: This is all outdated AS. Here is a much better way.
Custom Cursor
1-Make a Movieclip.
2-Make the clicky part on the little plus inside the MC.
3- Give it these actions
onClipEvent(load){ Mouse.hide();
}
onClipEvent(enterFrame){
this._x=_root._xmouse;
this._y=_root._ymouse;
}

i tried that...didn't work...and pyro....you created the tutorial collab '06 right? i have a question bout cursors..i have the actionscript for a cursor...I made the animation for a cursor...its kinda like the...
Unreal II cursor(wait for a while without movin the mouse and something happens...)problem is...how do i set the cursor to STOP playing the animation when the player is moving the mouse? i know how to do that for buttons though...

AS: Custem Cursor