5 Replies Latest reply on Jul 12, 2009 11:17 PM by maestro91

    [AS3 Newbie question] Images and shapes

    maestro91

      Hello, i'm experiencing this weird thing, probably it's a noob question.

       

      Problem: If instantiate an Image and draw over something using updateDisplayList, no problem, but if I change the source dynamically from that moment i cant see anymore the shapes.

       

      Some details:

       

      If I instantiate from a custom class extending Image, and i have this somewhere under the Class definition

      ...
      [Embed(source="icons/imageMark.png")]
      [Bindable]public var imageIcon:Class;
      ...
      protected var activeMask:Shape = new Shape();
      ...
      

       

      then, when the constructor method is executed, i do

      ...
      this.source = imageIcon;
      ...
      

      finally when the event creationComplete on the instance occour i do this

      ...
      this.addChild(activeMask);
      ...
      

       

      the shapes are drawn during every updateDisplayList, calling drawMask() - a function tha does some activeMask.graphics.drawsomethingover

      override protected function updateDisplayList(w:Number, h:Number):void {
           super.updateDisplayList(w, h);
           drawMask();
      }
      

       

      Everything works fine, because I can see the shape over the image.

       

      BUT

       

      If i, as i need, change the image source dynamically with a new image _imgTmp loaded from a server

       

      this.source =_imgTmp;

       

      NOW i can see the image loaded BUT don't see my shape anymore!

       

      I know it's a visibility or an order problem, but i can't help myself...