tag:blogger.com,1999:blog-305427760261504884.post333661998799752595..comments2014-09-27T19:51:56.890-07:00Comments on Programming Tricks: Typed container in AS3Kundan Singhhttp://www.blogger.com/profile/10408946176930869078noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-305427760261504884.post-40117638534631178112008-09-12T21:39:00.000-07:002008-09-12T21:39:00.000-07:00You can use a Proxy object for this. See this on ...You can use a Proxy object for this. See <A HREF="http://livedocs.adobe.com/flex/201/langref/flash/utils/Proxy.html#includeExamplesSummary" REL="nofollow">this</A> on how to use Proxy.<BR/><BR/>dynamic public class MyArray extends Proxy<BR/>{<BR/> private var _type:Class;<BR/> private var _item:Array;<BR/> public MyArray(type:Class,num:uint=0)<BR/> {<BR/> _type = type;<BR/> _item = new Array(num);<BR/> }<BR/> ...<BR/> override flash_proxy function setProperty(name:*, value:*):void {<BR/> if (!(value is _type)) <BR/> throw new Error("value is not " + _type);<BR/> _item[name] = value;<BR/> }<BR/>}Kundan Singhhttps://www.blogger.com/profile/10408946176930869078noreply@blogger.com