1 Reply Latest reply on May 26, 2010 8:45 AM by CapumCap

    Image Class - randomly Broken Image

    CapumCap

      Hi everybody,

       

      I've got some trouble with the <mx:Image> Class, which sometimes shows the correct image and othertimes shows a broken image. It seems to me, that there is no clear rule behind it. I assume, it is some loaderIssue, but I can't figure it out. I have already tried some different binding strategies, but all were ending in the same result.

       

      The context is quite simple.

      I've got a custom Component, that itself contians three simple components which display a label and an image. The labeltext and the imageSource of the child components depend on the data, with which the child component is feeded.

      Unfortunatly most of the time only not all 3 images are shown. But sometimes they are.

       

      Here's my source.

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:HGroup xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/mx"
               xmlns:basicTypes="components.basicTypes.*"
               >
         
          <fx:Script>
              <![CDATA[
                 
                  import environment.User.TFUser;
                 
                  private var user:TFUser;
                 
                  [Bindable]
                  private var imagePath:String;
                 
                  public function init(user:TFUser):void {
                      this.user = user;
                      this.imagePath = user.imagePath;
                      lblUserName.text = user.fullName;
                  }

       

              ]]>
          </fx:Script>
         
          <mx:Image id="imgUserPic"
                    width="140"
                    height="93" 
                    source="{'images/users/140px/' + imagePath + '.png'}"
                    />
             
         <s:Label id="lblUserName" />
         
      </s:HGroup>

       

      Any ideas? I do appreciate any kind of support.

       

      Thanks,

      Capum

        • 1. Re: Image Class - randomly Broken Image
          CapumCap Level 1

          Whoa,

           

          just after posting I tried sth. I though I've already tried several times before, but I must have missed sth. Anyway, it did the trick.

           

          I removed the binding in the image and set the source property within my custom init-function.

           

          I don't know why I didn't work before / why it does now, but result is all I care for (right now).

           

          Best Greeets,

          Maybe this will help anybody some time.

          Capum

           

          Message was edited by: CapumCap