Posts Tagged ‘Events’

Update and Explanation.

Adobe, Flash, Learning, Photoshop | Posted by antirealism
Feb 01 2009

well I have been looking at my own blog exercise 1 and I have come to the conclusion that I did not explain the code in any shape or form and for me to show u what I have learned and hopefully help others understand a little more of what goes in flash coding, I have broken the code down a bit..

“Square_mc” This is the name I gave to the object on the stage. This is called the instance name. Also I used _mc to let me no it’s a movieclip. all objects on the stage need to have a instance to be called up in the code, there is Three symbol types Movieclip _mc, Button _bt and Graphic _gc , this also can make it easier to read the code at a later date.

The “addEventListener” is the way we tell flash to listen for an event. After this we have to let flash know what this event will be, in this it was a “MouseEvent”.

“MouseEvent.CLICK” is really as it says; the event will be a click event so as You press down on the mouse button the event will start.

we then give the event a name, in this I call it “onclick”, this could have been anything but it good to put something in relation to what you want to happen, also to make it easier for you to come back to it at a later date.

With “onclick” now the name of the function that will run, we have to let flash know what will be carried out once the item as been clicked on.

The “:void” part of the code is there to let the program know that we do not need a return a value from the event.

When the “square_mc” is clicked the object will then move up by 10 pixels ” x += 10″ and across 25 pixels y “+= -25″ with a rotation of 11 degrees “rotation += -11″ I put these value in by random they could have been anything.

Then at the end of this program there is “Square_mc.buttonMode = true;” which tells flash to treat “Square_mc” like a button, so when the cursor goes over the object it will show that the item is clickable.

Well that’s it, if you now go to the second exercise and read throw the code, I hope this would have given a better understanding of what’s going on in each part.

Thank you for reading …

Share and Enjoy:
  • Twitter
  • Facebook
  • Google Bookmarks
  • Print
  • del.icio.us
  • RSS
  • email
  • Digg
  • StumbleUpon
  • Live
  • Ping.fm
  • Slashdot
  • MySpace