ActionScript 3 problem, not working and I have no idea why, flash CS4
I am very new to ActionScript 3 and I followed this toturial on adobe TV. But I don't work. The thing is, I want the drawer to move left / right when I press the buttons, but nothing happens.
You can download the .fla file here:
http://www.habitats.no/files/AC3.zip
Thank.
0
Habitats
source
to share
2 answers
You have to give the names of the objects, for example:
-
Button - you must specify the name of the button in the properties of the button bar - myBtn (the name of the button in the instance name field);
-
Insert - you must put the Box name in the Box panel properties (is movieClip) - myBox (field name in the instance name field);
and write this code in actions:
myBtn.addEventListener(MouseEvent.CLICK, moveBox);
function moveBox(event):void
{
Box.x+=25;
}
// addEventListener - Registers an event listener for the target event.
When you call AddEventListener ()
, you are reporting two parameters:
- An event that must meet the requirements of the application;
- A function that is a reaction to this event.
+1
source to share