Jump to content


BlitMask for Flex

Moderator Tag

Recommended Posts

Hi all,


New member to the GreenSock club so be nice :)


I use Flex (v4.6) and was trying to use the BlitMask. Naturally ran into no addChild.


To fix the addChildAt problem copy the code from the MotionBlurPlugin (or elsewhere)



if (_isFlex && _target.parent.hasOwnProperty("addElement")) { //to accommodate Flex 4 API additions

(_target.parent as Object).addElementAt(this, (_target.parent as Object).getElementIndex(_target));

} else {

_target.parent.addChildAt(this, _target.parent.getChildIndex(_target));



and set _isFlex by adding (to the constructor)



try {

_isFlex = Boolean(getDefinitionByName("mx.managers.SystemManager")); // SystemManager is the first display class created within a Flex application

} catch (e:Error) {

_isFlex = false;




Also, one for others greater than I to ponder. The BlitMask currently extends Sprite, which doesn't have addElement anyway, so changed to DisplayObject, only to find it doesn't have Graphics.


This site: http://www.hulstkamp...t-in-flex-4/555 suggested SpriteVisualElement, and it seems to work.


Not sure if this can be modified into the release, but hope this helps some out there.


Thanks Mr. GreenSock - terrific tools!



- sorry for lack of color.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.