3 Replies Latest reply on Feb 2, 2009 11:38 AM by tzeng

    Air display Image problem

    hayden.q Level 1
      I fetch an api service from a remote site, get a xml result, the format is below:

      <?xml version="1.0" encoding="UTF-8"?>
      <rss version="2.0">
      <channel>
      <item>
      <title>ssss....</title>
      <description><![CDATA[ssss....]]></description>
      <pubDate>Thu, 29 Jan 2009 05:38:39 +0000</pubDate>
      <guid> http://fanfou.com/statuses/xxx</guid>
      <link> http://fanfou.com/statuses/xxx</link>
      </item>
      <item>
      <title>ttt....</title>
      <description><![CDATA[ttt....]]></description>
      <pubDate>Thu, 29 Jan 2009 05:36:09 +0000</pubDate>
      <guid> http://fanfou.com/statuses/yyy</guid>
      <link> http://fanfou.com/statuses/yyy</link>
      </item>
      </channel>
      </rss>



      i will compute image url from this xml item and then i put the ArrayCollection in the the Repeater' DataProvider , as below:

      <mx:Image source="{getUsrImage(getUsr(String(rep.currentItem.title)))}"/> ## this image could display
      <mx:Repeater id="rep" horizontalCenter="true" verticalCenter="true" width="100%">
      <mx:HBox width="100%" horizontalAlign="center">
      <mx:Label text="{getUsr(String(rep.currentItem.title))}"/> ## this image could display
      <mx:Image source="{getUsrImage(getUsr(String(rep.currentItem.title)))}"/> ## this image could NOT display
      </mx:HBox>
      </mx:Repeater>


      Stange thing happened:



      if I run that in Flex Builder enviroment, all Image and Label could be displayed, but If i deploy to air and install it on windows or mac machine, only the label inside the repeater can display, also the image outside the repeater can display, but the Image control inside the Repeater can not display. it seems that any dynamic generate expression in source or tip property will cause the control not function.


      can anyone explains this to me, it puzzle me for a long time.
        • 1. Re: Air display Image problem
          mordsm Level 1
          Hi
          I have the same problem (dynamic image working in flex but not in air)
          did you find any solution yet

          moshe
          • 2. Re: Air display Image problem
            darkglovelove
            I am also having an issue that is fine when testing in Flash but stops working when compiled and installed as an AIR app.

            This saves an image to the desktop..... but does nothing in AIR.

            public function Main():void
            {
            var bitmapData:BitmapData = new BitmapData (stage.stageWidth, stage.stageHeight, true, 0x000000 );
            bitmapData.draw(this);
            var jpgEncoder:JPGEncoder = new JPGEncoder( 100 );
            var byteArray:ByteArray = jpgEncoder.encode( bitmapData );
            var filename:String = "IMAGE.jpg";
            var file:File = File.desktopDirectory.resolvePath( filename );
            var wr:File = new File( file.nativePath );
            var stream:FileStream = new FileStream();
            stream.open( wr , FileMode.WRITE);
            stream.writeBytes ( byteArray, 0, byteArray.length );
            stream.close();

            }
            • 3. Re: Air display Image problem
              tzeng Adobe Employee
              JPGEncoder should be JPEGEncoder.
              mx.graphics.codec.JPEGEncoder

              Otherwise, your code works fine.