auto register object aliases for remoting


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  1. public static function checkAlias(obj:Object):void {
  2. var cname:String = getQualifiedClassName(obj);
  3. cname = cname.split("::").join(".");
  4.  
  5. try {
  6. getClassByAlias(cname)
  7. } catch (e:Error){
  8. registerClass(obj);
  9. }
  10. }
  11.  
  12. public static function registerClass(cls:*):void {
  13. var cname:String = getQualifiedClassName(cls);
  14. var cname_fixed:String = cname.split("::").join(".");
  15.  
  16. if (!(cls is Class)){
  17. cls = getDefinitionByName(cname);
  18. }
  19.  
  20. registerClassAlias(cname_fixed, cls);
  21. }

URL: http://friendfeed.com/away4m

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.