Thanks everyone.  Very helpful.

On Fri, Jan 9, 2009 at 10:49 AM , André Bargull wrote:

Not really...

This testcase prints:
s was null
and _*not*_
s was 'null'

<canvas debug="true" oninit="this.meth(null)" >
 <method name="meth" args="s:String" >
   Debug.write("s was %w", s);
 </method>
</canvas>

The only special thing about Strings in AS3, is how `undefined` is handled.
var t:String = undefined; // this will be changed to `null`
var r:String = String(undefined); // this is really `undefined`


Finally, you can declare the types of your arguments. These types are ignored in the JS1 back-ends, but they are enforced in JS2 (swf9).

   function foo (required:String, optional:Boolean=false)

Caution: You will get a type error, but _only_ if there is not a coercion available. Hence, passing `null` as the first argument to foo above will cause it to be called with the string "null", not the null value. If you want a nullable type, you should leave the type undeclared (for now...).


Reply via email to