Jump to content
GreenSock

ofirpicazo

Handles and selection box not showing

Recommended Posts

I have the following code:

 

var transformManager:TransformManager = new TransformManager({
bounds: new Rectangle(0, 0, 680, 344), 
allowDelete: true, 
handleFillColor: 0xFFFFFF,
lineColor: 0xFFFFFF
});

canvas = new MovieClip();
canvas.graphics.beginFill(0xFFFFFF, 0);
canvas.graphics.drawRect(0, 0, 680, 344);
canvas.graphics.endFill();
canvas.x = 145;
canvas.y = 145;
rawChildren.addChild(canvas);

private function agregaLetra(evento:ListEvent):void
{
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, function(evento:Event):void {
	canvas.addChild(loader);
	transformManager.addItem(loader);
});

loader.load(new URLRequest(evento.itemRenderer.data.image));	
}

 

The function is a listener that responds to selecting an item in a HorizontalList, it adds an image to the canvas using a Loader, but for some reason the transformManager does not show the selection box or the handles, although it lets me drag the element around.

 

Does anyone have an idea why?, please help!!

Link to comment
Share on other sites

You're doing this in Flex, right? There are all sorts of bugs in the Flex framework that cause trouble (NOT bugs in TransformManager). I have spoken directly with Adobe about these bugs and they acknowledge them and have no adequate workarounds. In this case, for example, you're adding things to rawChildren and inside TransformManager, it creates a Sprite for the selection and does a fill in its graphics to a certain width/height, but Flex doesn't accurately report the width/height - like if the rectangle is drawn to be 300x300 and then you trace(sprite.width), it reports 0! And Flex doesn't accurately update the width/height/scaleX/scaleY/x/y properties when a DisplayObject's transform.matrix is updated. Unbelievable. Anyway, that's why I created FlexTransformManager which works around many (but not all) of these Flex bugs. Is there a reason you're not using FlexTransformManager?

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.
×