views:

644

answers:

3

Hi!
I would like to make some kind of thumbnail with capturing BitmapData or ImageSnapshot of some UNINITIALIZED components in my Flex application.
Is it possible?

Thanks in advance!
m.

+2  A: 

No. I believe you will end up getting null references if the components are not initialized (The graphics and stuff will all be uninitialized). You can simply initialize the components but make them hidden and take a thumbnail.

CookieOfFortune
Thanks for answer. But let me ask you, what if I actually have an instance of component in my application but it is not yet 'rendered'? It is in some custom container which doesn't 'render' its children until user ask for specific child... Hmmm, I hope you understand what I mean =) Thanks!
errata
Hmmm... maybe you could have it render some fake children and thumbnail that? Or you could replace the children part of it with an image as you take the thumbnail.
CookieOfFortune
bomb on you would be best served by adding it to the display list but out of view, such as x = 10000 and y = 10000... that would probably do it. I'd be surprised if it didn't.
Jasconius
@Jasconius You think just to delete that line tempHolder.visible = false and put him to x=something_out_of_stage and y=something_out_of_stage? Hmmm, I will try it and report back =) Thanks!
errata
A: 

@CookieOfFortune Thanks for help man =)
I tried to make something like this in my main application

private function createThumbs():void{

    thumbsData = new ArrayCollection();

    tempHolder.addChild(_32);

    var bm:BitmapData = getBitmapData(tempHolder);
    var img:Image = new Image();
    img.source = new Bitmap(bm);
    thumbsData.addItem(img);

    tempHolder.visible = false;

    testImg.source = new Bitmap(bm);
}

_32 is my component which I would like to take thumbnail. tempHolder is Canvas, testImg is Image class. tempHolder displays what I want to capture, while testImg in my case is always white...
I don't understand it =)

Thanks one more time ;-)

errata
A: 

@Jasconius I used the technique you describe for creating thumbnails of imported stuff into an AIR app and it's a drag to build all the routines, but in the end I'm satisfied with this solution. I use it for creating thumbnails from images, video and modules (with each a different container and routines to load and unload the footage)

The good part of this is that when you are building your thumbnailcreatorComponent - you can position it in the viewarea of the app to see what's going on. Later, when you are sure that everything works fine, you can put the thumbnailCreator at -10000,-10000 and forget about it.

Tobias Beuving