Actionscript

From Wikicliki
Revision as of 10:37, 16 June 2008 by 85.8.189.160 (talk)

Jump to: navigation, search

trace

var message = "Hi there";
trace (message);                                    // prints "Hi there"
var message = "yellow";
trace ("big " + message + " truck");                // prints "big yellow truck"

conditionals

var message = "yellow";
trace ("big " + message + " truck");                // prints "big yellow truck"
if (message == "yellow") {
trace ("yes, i did say big yellow truck.");        // prints "yes, i did say big yellow truck"
}

loops

trace (101);
trace (102);
trace (103);
trace (104);
trace (105);
is equal to:
var x = 101;
trace (x);
x = x + 1;
trace (x);
x = x + 1;
trace (x);
x = x + 1;
trace (x);
x = x + 1;
trace (x);
is also equal to:
var x = 101;
while (x <= 5) {
trace (x);
x = x + 1;
}