2 Replies Latest reply on Oct 18, 2009 12:17 PM by UbuntuPenguin

    Bitmaps blatantly behaving badly

    UbuntuPenguin Level 4

      Hello Everyone ,

        Sorry for the lame title , everyone knows you can't kill alliteration like that.  Here goes , I have a user class that contains a bitmap.  These users are contained in a tilelist.  When the user is clicked , their image is supposed to pop up , basically by changing the source of the image.  However , if I visit a particular user in the tilelist more than once , the image is blank.  Does anyone know what could be happening , this "one and done" anomaly is hard to track down ?  The code is below and I will more than happily explain any misunderstood or confusing points.  Points will be awarded.

       

      The code controlling the image in the flex component

              <mx:Image id="userAvatar" width="120" height="120" source="{model.avatar}"/>

       

      The code in the presentation model

              private var _avatar:Bitmap;
              [Bindable(event="userChange")]
              public function get avatar():Bitmap
              {
                  return _avatar;
              }

       

      The code handling the user change from the tilelist click of a user

              private var _user:User;
              public function setUser(user:User):void
              {
                  _user = user;

                  _avatar = user.avatar;
                  dispatchEvent(new Event("userChange"));
              }

       

      Thanks