Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 10-21-2009, 01:26 PM   #1
Registered User
Join Date: May 2008
Posts: 11
Default Small BitmapData problem

I have a sample code like this;
ActionScript Code:
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); }

I would like to populate thumbsData array collection with images for displaying them in some TileList. That same array collection in my example contains image and bitmap data but my testImg (which is Image class) is just white. Why is this happening?
Thanks for any help in advance!
knucklehead is offline   Reply With Quote
Old 10-21-2009, 02:06 PM   #2
Registered User
Join Date: Oct 2009
Posts: 16

Are you using an .xml file to refer to your images located in another folder?
Have you thought about using a custom item renderer, which can be used on any of the list controls?
kshelton360 is offline   Reply With Quote
Old 10-21-2009, 02:20 PM   #3
Registered User
Join Date: May 2008
Posts: 11

Hi and thanks for help!
I am not using xml file, the whole thing is little more complicated.
_32 is actually an mxml file (component) and I would like to take a snapshot of that component. So, there is no actual file which I would like to capture. Components are instantiated in my application but the container that holds those components is rendering each one only when user wants to see them.
So, I'm trying to add a component to some 'temp' container, take a snapshot, put that snapshot in array collection, and finally make 'temp' container invisible.
I'm not sure if something like that is possible to do with itemRenderer?
knucklehead is offline   Reply With Quote
Old 10-21-2009, 03:31 PM   #4
Holosuit User
wvxvw's Avatar
Join Date: Oct 2006
Location: Tel Aviv
Posts: 4,301
Send a message via ICQ to wvxvw

Well, maybe show the getBitmapData()? It seems like nothing faulty in your code thus far.
The .NET open source editor for Flash and web developers
*This would be my contribution to the project*
couchsurfing if you need it
wvxvw is offline   Reply With Quote
Old 10-21-2009, 03:37 PM   #5
Senior Member
Join Date: Jan 2008
Posts: 831

Yeah, missing code for proper evaluation.

Another thing to look at is the object being drawn, needs to 'validateNow()' possibly before its ready to be drawn.
i = (Andy)this;
bowljoman is offline   Reply With Quote
Old 10-21-2009, 03:49 PM   #6
Registered User
Join Date: May 2008
Posts: 11

Of course, I will post needed code, I just thought this will be easy one =)
So, this is the function:
ActionScript Code:
private function getBitmapData(target:UIComponent):BitmapData{     var bd:BitmapData = new BitmapData(target.width, target.height);     var m:Matrix = new Matrix();     bd.draw(target, m);     return bd; }

In my case it could be something involved with validateNow()... I am working with FlexBook component and I'm not sure how to 'override' some of their methods of validating etc...
I also don't understand if tempHolder (which is Canvas) displays what I want (my component) and I try to get a copy of that and display it somewhere else it won't cooperate =)

Thanks for your help!!
knucklehead is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 12:24 AM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.