3 Replies Latest reply on Sep 5, 2012 11:40 AM by Flex harUI

    Change BitmapImage source on a socket event

    mariana22b

      Hello,

       

      I have a BitmapImage and I would like to change its source at runtime.

       

      <BitmapImage source="img1.png" id="img" smooth="true" smoothingQuality="high"
            
      transformX="102" transformY="162">
         
      <filters>
             
      <DropShadowFilter distance="-1" angle="45"/>
         
      </filters>
      </BitmapImage>


      In the script part, I change its source so it points to another image.

       


      img.source = "img2.png";

       

      If the previous assignment is inside the mouseDown handler, it works perfectly. But, if I place it in a method that is triggered when data is received through a socket, the source remains unchanged.

      What I've found out, so far, is: I've added an event listener for the type "sourceChanged" and this is actually triggered, but when I inspect the source, it points to the old image.

       

      Thanks!