mardi 27 avril 2010

Flash Scripting Primer, intro and basics

FLASH:
  • Flash can be used as a design tool totally not using script.
  • Flash can be used as a scripting environment, totally ignoring timeline and design features.

In this course we introduce you to the scripting aspects of FLASH.

Main subjects of this course:

  • MovieClip, a structure
  • Events, triggering things from the user
  • Timer, triggering actions from the program
Events:
  • Keyboard event
  • Mouse event
  • Camera event
  • Microphone event
Actions Window

Where do we find the place to do a bit of coding? In the basic scripting window called Actions:

(In Dutch; "Handelingen" )

here is a textfile of the first scripting commands we use:

http://www.contrechoc.com/flash/flash-coding.txt

But first we have to get used to the scripting environment, and we start with our big friend "trace". The command trace prints what you give it into the 'output' window. Trace is a help if something is wrong, if you have to "debug".

Examples: Just in the Actions Window:

trace("hello");

CMD ENTER (for MAC) CTRL ENTER (for Windows) gives:

hello in the output window.

trace( 5 + 4);

gives: 9!

The difference are the quotes....when you do trace("5 + 4");

it gives: 5 + 4

...........

Explore the textfile in the last link, it is filled with all kind of examples, do it line for line, do the typing yourself, that helps for later.

you can copy and paste it into the action window and look what happens, but then you have to know how to make it into a .swf movie.

Exporting a Movie:

Press the CTRL ENTER for exporting the movie as a .swf file.

Try to understand what is happening and try to get used to the strange way the code is written.


Now we go to some prepared movies:

The first example movies can be found here:http://www.contrechoc.com/flash/flash-basics.zip

(CS3 examples made in Flash CS3 also working in Flash CS4)

the basics:

a sound loading example

an image loading example

the scripts are small, and can be copied and pasted into other scripts, (be careful though!)

a sound folder and a banana are joining the party.

(added also: a framelabel example, good start for alternative presentations.)

a great site for FLASH examples (tutorials, also photoshop things) is http://www.smashingmagazine.com/2007/10/30/65-excellent-flash-designs/

Sounds: FLASH handles only .mp3 ,free sounds can be found at: http://www.freesound.org/

images/cartoons can be found everywhere, google images with the keyword “cartoon” and “rabbit” for instance, also this kind of site can be found easily: http://www.barrysclipart.com/barrysclipart.com/index.php

FLASH games? There are about three trillion to be found, but this is a great site: http://www.flash-game.net/