Mask image does not appear on the screen

Posted by Ponty on Stack Overflow See other posts from Stack Overflow or by Ponty
Published on 2010-04-15T22:58:43Z Indexed on 2010/04/15 23:03 UTC
Read the original article Hit count: 189

Filed under:
|

I have imported to the library two images and have given them the custom class names MaskImage and MaskedImage. Then i write the code:

package { import flash.display.*;

public class MaskDemo extends Sprite
{
    // Properties

    private var sprMaskedImage:Sprite;
    private var sprMaskImage:Sprite;
    private var bmMaskedImage:Bitmap;
    private var bmMaskImage:Bitmap;

    // Constructor

    public function MaskDemo()
    {
        do_magic();
    }

    // Methods
    private function do_magic():void
    {
        bmMaskedImage = new Bitmap(new MaskedImage(0, 0));
        bmMaskImage = new Bitmap(new MaskImage(0, 0));

        sprMaskedImage = new Sprite();
        sprMaskedImage.addChild(bmMaskedImage);

        sprMaskImage = new Sprite();
        sprMaskImage.addChild(bmMaskImage);

        sprMaskedImage.mask = sprMaskImage;
        this.addChild(sprMaskImage);
    }
}

}

But it does not appear anything on the display. Any ideas why is happening that?

© Stack Overflow or respective owner

Related posts about actionscript-3

Related posts about flash