2
  • I have a MovieClip which I compiled to SWC and imported to Flash Builder.

  • The MovieClip has a masked (visible) area, and an invisible area which is hidden by the mask:

    MC

  • I wrapped the MC in a UIMovieClip so that I could insert in the MXML of the application:

    <my:SomeMaskedControl bottom="0" />

  • In the MXML I set the attribute bottom="0", I wanted the UIMovieClip to sit at the bottom of the application. Unfortunately the invisible area of the MC is messing it up:

    Application

  • I wanted it more like this:

    BetterApplication

I realize that I could just change the bottom attribute to a negative value, but I think this would mess up the architecture of the application. Is there a way to fix it so that I can still use bottom="0"?

Drahcir
  • 11,772
  • 24
  • 86
  • 128
  • I think it is because it is a MovieClip what if you exported as a swf instead of swc, maybe that might work? – Neil Feb 27 '13 at 17:00
  • You may need to override the height property of that MovieClip and return the height from an intersection of the masked object's bounds with the bounds of the mask. – Marcela Feb 27 '13 at 18:12
  • try bottom for mask=0 and top of movieclip="{mask.x}" – Smolniy Feb 27 '13 at 18:14
  • bottom = mask.height-this.height or possible you will need to call updateDisplayList – The_asMan Feb 27 '13 at 20:40

1 Answers1

1

Try to use Colin Moock hack : http://www.moock.org/blog/archives/000292.html

public class SomeMaskedControl extends UIMovieClip
{
    protected var mc:MaskedMC;

    public function SomeMaskedControl()
    {
        super();

        mc = new MaskedMC();

        addChild(mc);
    }

    public function getVisibleHeight (o:DisplayObject):Number {
        var bitmapDataSize:int = 2000;
        var bounds:Rectangle;
        var bitmapData:BitmapData = new BitmapData(bitmapDataSize, bitmapDataSize, true, 0);
        bitmapData.draw(o);
        bounds = bitmapData.getColorBoundsRect( 0xFF000000, 0x00000000, false );
        bitmapData.dispose(); 
        return bounds.y + bounds.height;
    }

    override public function get height():Number
    {
        return getVisibleHeight( mc );
    }
}

But i don't like this way. If you will can create mask as MovieClip, and set instance name, in application you can get mask.height and replace UIMovieClip height:

public class SomeMaskedControl extends UIMovieClip
{
    protected var mc:MaskedMC;

    public function SomeMaskedControl()
    {
        super();

        mc = new MaskedMC();

        addChild(mc);
    }

    override public function get height():Number
    {
        return mc.maskMC.height;
    }
}
Ilya Zaytsev
  • 1,055
  • 1
  • 8
  • 12