In today's prac, used Flash and followed the instruction to build a very simple program. At first, I print "Hello World" to console/output and the code looks like ( trace("Hello World!"); ) when working on a more complicate and long program, print becomes very important for debugging. Then, I also learnt to create variable to represents a value in the computer's memory. This makes it convenient as you can use variable to replace line/lines of code. It is also easy to change the value. like
After that, i learnt how to use event as a way of keyboard interaction where you have to add (addEventListener(KeyboardEvent.KEY_DOWN, doSomething)) where doSomething is another function that prints the particular key that pressed.
After that, in this case, i made if pressed A, it prints move left, Z move down, W move up, S move down also if another other keys are pressed it will print "key does nothing".
This prac exercise gives me an idea how actionscript works. I think it is a bit similar to java so it seems to be quite familiar.
No comments:
Post a Comment