Jump to content


Photo

change cursor in FLASH on click


  • Please log in to reply
5 replies to this topic

#1 Jaysun

Jaysun

    Young Padawan

  • Members
  • Pip
  • 3 posts

Posted 03 May 2006 - 10:29 AM

Thanks for the great forum.

I looked at this site for most of the day yesterday and found several great resources for how to change your cursor in FLASH to some other spiffy image, however, I found nothing that showed how to change the cursor when you click as well.

What I want to do is us a hand for the cursor which I have already figured out with the handy tutorials your site offers. What I cannot figure out is how to make the finger click when the mouse button is pushed. I already have the graphic I wish to use with a clicking finger, just need to know how to swap on click. Thanks for all the help. Great site!

#2 Jaysun

Jaysun

    Young Padawan

  • Members
  • Pip
  • 3 posts

Posted 04 May 2006 - 08:18 AM

Ok. I'm having another problem now.

When I create my customer cursor the image is way off from the actual cursor. It's like there is an offset or something. I tried screwing around with the registration of the symbol but that only made it worse. Currently have it registered top left. Is there a specific place I should put the image when I drop the cursor into the main movie? Or does that matter?

#3 funkysoul

funkysoul

    The Funky Stuff

  • Publishing Betazoids
  • PipPipPipPip
  • 2,307 posts
  • Gender:Male
  • Location:Zurich, Switzerland
  • Interests:Music: HIM, HIM, HIM, Cafe del Mar, Linkin Park, Fort Minor, Coldplay, Eric Jordan<br />Sports: Snowboarding, KiteSurfing, Extreme Sports<br />Computer: Flash, After Effects, Actionscript

Posted 05 May 2006 - 01:44 PM

put your image on the stage, press F8 to create a new movieclip of it, ensure that you selected the topleft square in the Create Symbol panel.
Ensure that the new mc is just in the library and NOT on the stage and give it a linkage name of "newCursor_mc"

Then use this code:
this.attachMovie("newCursor_mc", "cursor_mc", this.getNextHighestDepth());
Mouse.hide();
var mouseListener:Object = new Object();
mouseListener.onMouseMove = function() {
	cursor_mc._x = _xmouse;
	cursor_mc._y = _ymouse;
	updateAfterEvent();
};
Mouse.addListener(mouseListener);


#4 Jaysun

Jaysun

    Young Padawan

  • Members
  • Pip
  • 3 posts

Posted 05 May 2006 - 01:57 PM

Thanks for the help. Worked like a charm when I tried it in a new movie. I know how to do most of the stuff I see on here but I love seeing new ways to do it. I'm by no means an expert but I would say I'm advanced. I would really like to learn more about AS 2.0 though.

You know how to change the cursor image on press? I want to have a finger that is the basica cursor default and the finger bend when clicked. I have both images ready and the finger as the cursor...just can't figure out how to do the on press switch to the bent finger then back to the regular.

#5 Ding

Ding

    Young Padawan

  • Members
  • Pip
  • 7 posts
  • Location:Michigan

Posted 05 May 2006 - 06:12 PM

Adding to funkysoul's code, you would do something like this.

var cursor1 = this.attachMovie("mcCursor1", "cursor1", this.getNextHighestDepth());
var cursor2 = this.attachMovie("mcCursor2", "cursor2", this.getNextHighestDepth());
cursor2._alpha = 0; //hides the second cursor
var cursor = cursor1; //sets cursor 1 as your cursor
cursor._x = _xmouse; //sets the x coordinate of your cursor to your mouse x position
cursor._y = _ymouse; //sets the y coordinate of your cursor to your mouse y position
Mouse.hide(); //hides the mouse
var mouseListener:Object = new Object();
mouseListener.onMouseMove = function()
{
	cursor._x = _xmouse;
	cursor._y = _ymouse;
	updateAfterEvent();
};
mouseListener.onMouseDown = function()
{
	cursor1._alpha = 0; //hides the first cursor
	cursor2._alpha = 100; //shows the second cursor
	cursor = cursor2; //sets cursor 2 as your cursor
	cursor._x = _xmouse;
	cursor._y = _ymouse;
};
mouseListener.onMouseUp = function()
{
	cursor1._alpha = 100; //shows the first cursor
	cursor2._alpha = 0; //hides the second cursor
	cursor = cursor1; //sets cursor 1 back as your cursor
	cursor._x = _xmouse;
	cursor._y = _ymouse;
}
Mouse.addListener(mouseListener);


#6 funkysoul

funkysoul

    The Funky Stuff

  • Publishing Betazoids
  • PipPipPipPip
  • 2,307 posts
  • Gender:Male
  • Location:Zurich, Switzerland
  • Interests:Music: HIM, HIM, HIM, Cafe del Mar, Linkin Park, Fort Minor, Coldplay, Eric Jordan<br />Sports: Snowboarding, KiteSurfing, Extreme Sports<br />Computer: Flash, After Effects, Actionscript

Posted 06 May 2006 - 02:24 PM

@Ding - good solution, simple and easy :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users