Click to See Complete Forum and Search --> : Actionscript Help


ragy
12-20-2010, 08:15 AM
Hello guys
i'm starting to learn actionscript,
1-i created a button using flash cs4, and what i'm searching for is how to do (onclick event : sum two values and dispaly them ).
2-i wanna know what to write on actionscript( events needed ).
3-where i can define the id for the button
I want the answer as fast as possible
thanks alot

mankis
12-27-2010, 11:35 AM
Your questions are very confusing. Are you using Actionscript 3? Where do you wish to display values, in text field on the stage?

To answer the first question

import flash.events.MouseEvent;

yourButton.addEventListener(MouseEvent.CLICK, buttonClick);
var some_number:Number;
var some_other_number:Number;

//On mouse clicked function
function buttonClick(event:MouseEvent):void {
var yoursum:Number;
yoursum=some_number+some_other_number;
yourTextField.text = yoursum;
}