6 Replies Latest reply on May 25, 2010 5:15 AM by vasanthmss

    create a Class object from URL

    jm_flex_newbie

      Hi

       

      I need to create a Class object (¿instance?) from a URL. I need to load a several URL's from a database and later use those url to construct Class instances

       

      After, those instances are going to be used as source from Image objects. So far i have this:

       

      public class LegendNode extends BaseNode {
             
              private var _icon:Class;

       

              public function LegendNode(iconSource:String) {
                  super();
                 
                  var loader:Loader = new Loader();
                  loader.load(new URLRequest(iconSource), new LoaderContext(true));
                  loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler, false, 0, true);
              }

       

              override public function get icon():Class {
                  return _icon;
              }

       

              override public function set icon(o:Class):void {
                  _icon = o;
              }
             
              private function completeHandler(event:Event):void {
                  var loader:LoaderInfo = event.target as LoaderInfo;
                  var bitmap:Bitmap = loader.content as Bitmap;
                  icon = bitmap.bitmapData as Class;

              }
          }

       

       

      Any ideas ???

       

      thanks a lot