3 Replies Latest reply on May 19, 2009 7:14 AM by Michael Borbor

    Question on Custom Icon Function

    apmyhr

      I have a custom icon function for an AdvancedDataGrid which looks like this...

       

       

       

       

      [

      Embed(source="assets/small_constellation.jpg")] public var

      ConstellationImg:Class;

       

       

      [

      Embed(source="assets/small_satellite.jpg")] public var

      ResourceImg:Class;

       

       

       

       

       

      private function CustomIconFunction(item:Object):Class

      {

      if (item is constellation) { return ConstellationImg; }

      else { return ResourceImg; }

       

      }

       

      This has worked fine but I now want to change it so that my program loads the image from the server it runs on.  I tried using the following code:

       

      if (item is constellation) {

           var constImage:Class = new Class();

           constImage.source = "imgUrl";

           return constImage;

      }

       

      However, I get an error stating that Class() is not a constructor.  Any suggestions?

        • 1. Re: Question on Custom Icon Function
          Gregory Lafrance Level 6

          You can use a url from the server, but I don't think you can use the syntax you are using, with the constructor.

           

          Just use the syntax you were using but have a url for the image on the server.

          • 2. Re: Question on Custom Icon Function
            apmyhr Level 1

            I don't think that is exactly what I want to do.  If I understand what "Embed" means, I think the image is embeded into the swf file during compilation.  What I would like to do is load the image during run time.  There are a couple of reasons for this.  I don't want to hardcode server URL's into the compiled swf file.  Also, I would like to be able to change the actual images themselves without having to recompile the swf file every time.

            • 3. Re: Question on Custom Icon Function
              Michael Borbor Level 4

              If I'm not wrong buttons can only use Embeded images. Or images classes.

               

              Sincerely,

               

              Michael

               

              El 19/05/2009, a las 8:51, apmyhr <forums@adobe.com> escribió:

               

              >

              I don't think that is exactly what I want to do.  If I understand 

              what "Embed" means, I think the image is embeded into the swf file 

              during compilation.  What I would like to do is load the image 

              during run time.  There are a couple of reasons for this.  I don't 

              want to hardcode server URL's into the compiled swf file.  Also, I 

              would like to be able to change the actual images themselves without 

              having to recompile the swf file every time.

              >

              1 person found this helpful