Jump to content
Search Community

[Flex] Blank objects in Crop

sonicworks test
Moderator Tag

Recommended Posts

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

Link to comment
Share on other sites

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.

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