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


source to share


2 answers


You need to list your instances. Click on one of the movie clips on the stage and bring up the properties window, you will see the input for instance name

. The way you coded this instance name should match the ie clips name mc_box

.



+1


source


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







All Articles