Jump to content
Search Community

[Flex] Blank objects in Crop

sonicworks
Moderator Tag

Recommended Posts

Posted

Hi,

 

I was having a little trouble when adding an image to the crop where it disapeared.

 

-------------------------------------------------------

var image1:Image = new Image;

image1.source="1.jpg";

myTransManager.addChild(image1);

var mc1Crop:FlexCrop = new FlexCrop(videoStageObject, myTransManager.manager);

-------------------------------------------------------

 

I had an idea that it's a usual flex issue where the image Display object isn't ready yet. solved by....

-------------------------------------------------------

var image1:Image = new Image;

image1.source="1.jpg";

myTransManager.addChild(image1);

TweenLite.delayedCall(1, addCrop, [image1]);

 

private function addCrop(imageDO:DisplayObject):void{

var mc2Crop:FlexCrop = new FlexCrop(imageDO, myManager.manager);

}

-------------------------------------------------------

 

It works, but is there a neater way?

 

Hope this helps someone

Posted

Yeah, Flex can be super annoying with little quirks like that. I'm not very familiar with the intricacies of the Flex framework, but I suspect that there's an event that gets fired by the Image when it is "officially" ready (maybe "creationComplete"?) Or you could use a delayedCall to call the update() methods of the associated TransformItem and FlexCrop.

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.
×
×
  • Create New...