Difference between revisions of "Actionscript"

From Wikicliki
Jump to: navigation, search
(loops)
Line 19: Line 19:
 
== loops ==
 
== loops ==
  
<table><tr><td><pre>trace (101);
+
<table><tr><td valign=top><pre>trace (101);
 
trace (102);
 
trace (102);
 
trace (103);
 
trace (103);
 
trace (104);
 
trace (104);
 
trace (105);</pre></td>
 
trace (105);</pre></td>
<td>is equal to:
+
<td valign=top>is equal to:
 
<pre>var x = 101;
 
<pre>var x = 101;
 
trace (x);
 
trace (x);
Line 35: Line 35:
 
x = x + 1;
 
x = x + 1;
 
trace (x);</pre></td>
 
trace (x);</pre></td>
<td>is also equal to:
+
<td valign=top>is also equal to:
 
<pre>var x = 101;
 
<pre>var x = 101;
 
while (x <= 5) {
 
while (x <= 5) {

Revision as of 10:37, 16 June 2008

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;
}