action script 3.0

basic Action script 3.0

Page 1 of 1

2 Replies - 1191 Views - Last Post: 26 March 2009 - 09:14 PM

#1 raajesh  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 11
  • Joined: 21-November 08

action script 3.0

Post icon  Posted 25 March 2009 - 11:46 PM

Hi,
I am new in Action script 3.0. I am facing problem when i click on a button this error come - ArgumentError: Error #1063: Argument count mismatch on test1_fla::MainTimeline/onButtonclicked(). Expected 0, got 1. Pls help.

My code is-

var score:Number = 0;

btn.addEventListener(MouseEvent.CLICK, onButtonclicked);

function onButtonclicked():void {
score += 5;
score_txt.text = String(score);
}

Is This A Good Question/Topic? 0
  • +

Replies To: action script 3.0

#2 thehat  Icon User is offline

  • awake ? web();
  • member icon

Reputation: 106
  • View blog
  • Posts: 951
  • Joined: 28-February 08

Re: action script 3.0

Posted 26 March 2009 - 06:40 AM

When the function is called it is passed an event object. You need to declare an argument for your function to allow for this:

function onButtonclicked(evt:MouseEvent):void {


Was This Post Helpful? 0
  • +
  • -

#3 raajesh  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 11
  • Joined: 21-November 08

Re: action script 3.0

Posted 26 March 2009 - 09:14 PM

View Postthehat, on 26 Mar, 2009 - 05:40 AM, said:

When the function is called it is passed an event object. You need to declare an argument for your function to allow for this:

function onButtonclicked(evt:MouseEvent):void {



Hi Thehat, Thanks a lot for replying. It works.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1