Author Topic: Help With ClickEvents  (Read 1918 times)

0 Members and 1 Guest are viewing this topic.

Offline rdarnz

  • Full Member
  • ***
  • Posts: 156
  • Pixel art - woooo!
    • View Profile
    • deviantART
Help With ClickEvents
« on: June 04, 2007, 10:47:37 PM »
I need a little help; well actually my mate does and I tried but have failed miserably, yet I call myself a coder/techie?! *hangs head in shame*
OK, the basis is that she's using Adobe Flash CS3 and she's trying to get a onMouseEvent working... ActionScript 3 has me stumped! In previous versions it was simply a case of OnClick (do Action) yet when I try this simple logic it tells me I'm missing a 'fr{' - Any help, guidance, links???


Offline mr_malee

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Help With ClickEvents
« Reply #1 on: June 06, 2007, 09:48:22 AM »
in AS3, the event model has changed, you can no longer write code in clipEvents. You have to add an event listener to your object/movieclip and also everything in AS3 is now a class.

if you are after mouseEvents, things like: onMouseMove, onMouseDown, onMouseUp then -

if you are just looking to create a simple button then -

Its a little complex for me to explain how to implement it unless you understand classes. For a simple click event on the stage add this to frame 1

Code: [Select]

stage.addEventListener(MouseEvent.CLICK, recieveClick)

function recieveClick(evt:MouseEvent):void {

trace("hoorah the stage was clicked")

i suggest that you read the help overview of AS3 before using it, it has completely changed from AS2 and is much more advanced and harder. It forces the use of OOP (object orientated programming). Infact the whole VM (virtual machine) has changed completely.

my suggestion is use AS2. In Flash CS3, go to the bottom of the properties pane, select publish settings, choose AS2 from the "Actionscript Version" drop down.

Hope it helps :)