josef.van.niekerk
josef.van.niekerk

Reputation: 12121

Actionscript 3 - Type.<T> syntax

Is it possible to use the Type.<T> syntax with user defined classes? For example, let's say I want to create a List class, but I want the user to use it like this:

var myList:List.<String> = new List.<String>;

or is this syntax exclusively evailable to the Vector class only?

Thanks!

Upvotes: 1

Views: 128

Answers (2)

back2dos
back2dos

Reputation: 15623

Have a look at Haxe ... you can compile Haxe to swfs as well, and unlike AS3, it supports generics ...

edit: Haxe can target flash10 ... unlike ActionScript 3, Haxe even can use alchemy opcodes: http://haxe.org/api/flash9/memory ... plus the generated bytecode is faster ... actually Haxe is a much better tool to leverage the potentials of the AVM2

Upvotes: 0

Branden Hall
Branden Hall

Reputation: 4468

At the moment it can only be used by the Vector class. Any other attempted use of the syntax will throw a compiler error.

Upvotes: 4

Related Questions