Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 08-01-2009, 12:11 PM   #1
Registered User
Join Date: Jul 2009
Posts: 29
Default make circle appear on mouse click


I'm trying to make a simple 'spot the difference' game and would like a red circle (on its own layer in the attached fla) to appear around a specified area of the picture when the (invisble) button is clicked.

What is the action to make this happen? Also, is it possible to prevent the cursor from becoming a hand when hovering over the button, so the user must click on it in order to find out where it is?

Many thanks for help in advance

[Couldn't attach fla - it's here http://www.megaupload.com/?d=0LNQD3FU]
Noobug is offline   Reply With Quote
Old 08-01-2009, 01:19 PM   #2
ActionScript dominates me
Join Date: Jul 2009
Posts: 33

-Not Solved-

Hello Noobug

I am also new to ActionScripting myself, but just to make it easier for the 'experts' to be able to understand you, I have the following queries:

Just to clarify. You want to disable the mouse 'hand' if the mouse literally roll(s)Over the 'button', yes? If this is so, then I am guessing a Variable to be added in the ActionScript timeline.

would like a red circle (on its own layer in the attached fla) to appear around a specified area of the picture
Masking technique should satisfy this desire of yours (if I have understood you right).
dominatrix is offline   Reply With Quote
Old 08-01-2009, 01:21 PM   #3
Freshman ActionScript Dev
EvLSnoopY's Avatar
Join Date: Jun 2009
Location: Edmond, OK
Posts: 345

This should help you out a bit:

ActionScript Code:
package {     import flash.display.*;     import flash.events.*;         [SWF(backgroundColor="0x000000",width="500",height="100")]     public class FlashTest extends Sprite {                 private var buttonOne:Sprite = new Sprite();         private var buttonTwo:Sprite = new Sprite();         private var radius:int = 50;         private var buttonSpacing:int = 200;                 public function FlashTest(colorOne:uint=0x330044,colorTwo:uint=0x660066) {                         buttonOne.graphics.beginFill(colorOne);             buttonOne.graphics.drawCircle(60,0,radius);             buttonOne.graphics.endFill();             buttonOne.visible = false;             addChild(buttonOne);                         buttonTwo.graphics.beginFill(colorTwo);             buttonTwo.graphics.drawCircle(0,0,radius);             buttonTwo.graphics.endFill();             buttonTwo.x+= buttonSpacing;             addChild(buttonTwo);                         buttonOne.addEventListener(MouseEvent.CLICK, oneClicked)             buttonTwo.addEventListener(MouseEvent.CLICK, twoClicked);         }                 private function oneClicked(e:MouseEvent):void {                         buttonOne.visible = false;         }                 private function twoClicked(e:MouseEvent):void {                         buttonOne.visible = true;         }     } }
EvLSnoopY is offline   Reply With Quote
Old 08-03-2009, 11:58 AM   #4
Registered User
Join Date: Jul 2009
Posts: 29

Hi guys,

Many thanks for your help... Unfortunately I don't really understand your advice! Sorry, but I really am new to this!

What exactly does the below code do and where is it supposed to go? I presume it will disable the hand, so tried putting it on the button and ended up with lots of errors...

Just to clarify: what I really want to do is

a) for circles to appear on designated places [around the differences in a spot the difference game] when buttons are clicked - this is most important for me


b) if possible, for the cursor to remain a cursor, not turn into a hand, but for the user to still be able to click the button - although this might not be possible.

I really appreciate the help - sorry it's taking me so long to understand!!
Noobug is offline   Reply With Quote
Old 08-03-2009, 01:20 PM   #5
button queen
Join Date: Mar 2009
Posts: 39
Send a message via Skype™ to chichi2
Default I hope this helps

Click on your invisible button (assuming you already made it) and right click it and edit. In the frame panel you can put a couple key frames there and label them _up and _over.

On your _over frame you can have your red circle appear or play depending on if its just a graphic or animated clip - I'm not sure which one you have. You can also just do a quick visible = true/false

I know that the adobe website has a couple of tutorials on this, you could go and search button tutorials if you want to have a look.
chichi2 is offline   Reply With Quote
Old 08-03-2009, 03:50 PM   #6
Registered User
Join Date: Jul 2009
Posts: 29

Thanks a lot Chichi... but I'm still struggling!

If I put the red circle in the button itself, ie place it on the 'down' state, how do I make it actually come up and stay on the stage? Do I need to put in some code?

I have attached a simple fla exaplining what I'm trying to achieve... So that when you click the button, the red circle (currently on the stage on its own layer) will appear and stay... I have made it into a movie clip but don't know what else I should do.

Again any help much much appreciated and sorry to keep asking on such a simple matter
Attached Files
File Type: zip redcircle.zip (5.0 KB, 224 views)
Noobug is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

All times are GMT. The time now is 07:18 AM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.