[flexcoders] Re: snapshots of TabNavigator tabs

2008-08-26 Thread Vijay Ganesan

Sorry for the delayed response. Here's an example that may be useful:
http://meteorite-13.blogspot.com/2008/08/flex-tabnavigator-image-snapshot-icons.html

Vijay

--- In flexcoders@yahoogroups.com, "Danny Venier" <[EMAIL PROTECTED]> wrote:
>
> Thanks Vijay, Tim,
> 
>  
> 
> I definitely had two issues.  Tim nailed one in that I was adding the
> existing child object to the new view and therefore removing it from
the old
> because I copied a reference.
> 
>  
> 
> I'm still struggling with the capture part.  I think I need a bit of
> clarification on your suggestions Vijay.
> 
>  
> 
> I think I followed your instructions.  Because updateDisplayList() is
> protected, I had to expose it by extending the component to provide
a public
> method to pass the unscaled width and height to, then calling the
internal
> updateDisplayList, passing it the size properties received in the public
> method.
> 
>  
> 
> I have a tab navigator with canvas children for each tab.  In the canvas
> child I have and HBox barchart container and inside the container, I
have
> the barchart object.
> 
>  
> 
> The HBox supports a protected updateDisplayList() method, but the
BarChart
> object does not.  Based on your advice I stepped through each tab child
> canvas, got a reference to the extended HBox container, forced an
> updateDisplayList on the extended HBox with the unscaled size of the
> BarChart child in the container.
> 
>  
> 
> I didn't actually set the child selected index of each tab which in
theory
> would force it to be visible, but I think your advice said I didn't
have to.
> I just got the references to the containers by
> myTabNav.getChildAt(i).myHBoxContainer, then did an
updateDisplayList, then
> did my cloning, put the clone in an array in the model, supplied the
tile
> list with the array.and voila.still only the first tab container.
> 
>  
> 
> Did I force the updateDisplay on the right object?
> 
>  
> 
> Thanks for your help on this,
> 
>  
> 
> Danny
>




[flexcoders] Re: snapshots of TabNavigator tabs

2008-08-05 Thread Danny Venier
Thanks Vijay, Tim,

 

I definitely had two issues.  Tim nailed one in that I was adding the
existing child object to the new view and therefore removing it from the old
because I copied a reference.

 

I'm still struggling with the capture part.  I think I need a bit of
clarification on your suggestions Vijay.

 

I think I followed your instructions.  Because updateDisplayList() is
protected, I had to expose it by extending the component to provide a public
method to pass the unscaled width and height to, then calling the internal
updateDisplayList, passing it the size properties received in the public
method.

 

I have a tab navigator with canvas children for each tab.  In the canvas
child I have and HBox barchart container and inside the container, I have
the barchart object.

 

The HBox supports a protected updateDisplayList() method, but the BarChart
object does not.  Based on your advice I stepped through each tab child
canvas, got a reference to the extended HBox container, forced an
updateDisplayList on the extended HBox with the unscaled size of the
BarChart child in the container.

 

I didn't actually set the child selected index of each tab which in theory
would force it to be visible, but I think your advice said I didn't have to.
I just got the references to the containers by
myTabNav.getChildAt(i).myHBoxContainer, then did an updateDisplayList, then
did my cloning, put the clone in an array in the model, supplied the tile
list with the array.and voila.still only the first tab container.

 

Did I force the updateDisplay on the right object?

 

Thanks for your help on this,

 

Danny



[flexcoders] Re: snapshots of TabNavigator tabs

2008-08-03 Thread Vijay Ganesan

Hi Danny,
I've done this where I show thumbnails of the tab content in each tab.
The problem I faced originally was similar to what you allude to -
initially only the first tab's contents are drawn and the other tab
contents are not yet rendered. So how do you take a snapshot of
something that is not yet drawn on the screen? 

The way I got it to work is, after the first tab content is rendered,
force calling updateDisplayList() for each of the other tab's content
child object passing in the unscaledWidth and unscaledHeight of the
first tab child. After all tab contents are created and sized
(although not yet drawn on the screen), snapshots using the
ImageSnapshot's captureBitmapData() work fine. 

I do have very custom components and rely less on the Flex fwk for
sizing etc. but it should work the same.

Hope that helps. 

Vijay  

--- In flexcoders@yahoogroups.com, "dannyvenier" <[EMAIL PROTECTED]> wrote:
>
> Hi,
> 
> Perhaps someone has tried to do this and has figured it out.  
> Me...no. The objective is to take image snapshots from the display 
> objects on individual tabs (children) of the tab navigator and use 
> them for a tile list in another container...preferrably on another 
> tab of the TabNavigator.
> 
> The problem seems to be that only the visible tab can be snapped. 
> Taking snapshots of the other non selected children produces what 
> appears to be a very narrow slice of display...
> 
> Stepping through the children, selectedIndex = i, setting that child 
> to be visible, taking a snapshot, all programmatically without user 
> interaction does not work.  Again, one valid snapshot, and the rest 
> are some machination of some image with positive size, but only a 
> slice.  I've done quite a bit with snapshots before so I'm confident 
> in that part of the code (getting the snapshot of bitmapData, using 
> it to form a Bitmap Object, wrapping in UIComponent, adding as child 
> to container), and I'm picking up one successfully but no luck on 
> picking them all up.  I set breakpoints at the first point of the 
> snapshot and the size tells me its not the full display object.  I'm 
> sticking the snapshots in a model and using to source the list.  The 
> copy in the model has only the single full image.   
> 
> I've even tried making a copy of the display objects themselves and 
> presenting them in the tile list but for whatever reason, the instant 
> I add the child to the tilelist container, it is no longer visible in 
> the original tab.
> 
> Its a barchart image I'm trying to capture so I try
>  var cloneBarChart:BarChart = new BarChart();
>  cloneBarChart = this.barChartDisplay as BarChart;
> 
> but as I mentioned, the minute I add the cloneBarChart as a child to 
> the tilelist container, the original barchart disappears from the 
> original tab.
> 
> I didn't include code cause its a bit spread out.  I'm just wondering 
> if I'm missing some characteristic of the tab navigator or a 
> viewstack that makes hidden children inaccessible?  It could be a 
> creation sequence problem but setting the selected index and 
> visibility should force creation, no?
> 
> thanks,  
> Danny
>




[flexcoders] Re: snapshots of TabNavigator tabs

2008-08-03 Thread Tim Hoff

Hi Danny,

Not sure about the snapshots; without seeing some code.  But, the
children are disappearing because you're creating references (not
copies) to the original display objects and then reparenting them with
addChild().  You might try this instead; to make a copy:

cloneBarChart = BarChart(this.barChartDispaly);

instead of :

cloneBarChart = this.barChartDisplay as BarChart;

-TH

--- In flexcoders@yahoogroups.com, "dannyvenier" <[EMAIL PROTECTED]>
wrote:
>
> Hi,
>
> Perhaps someone has tried to do this and has figured it out.
> Me...no. The objective is to take image snapshots from the display
> objects on individual tabs (children) of the tab navigator and use
> them for a tile list in another container...preferrably on another
> tab of the TabNavigator.
>
> The problem seems to be that only the visible tab can be snapped.
> Taking snapshots of the other non selected children produces what
> appears to be a very narrow slice of display...
>
> Stepping through the children, selectedIndex = i, setting that child
> to be visible, taking a snapshot, all programmatically without user
> interaction does not work. Again, one valid snapshot, and the rest
> are some machination of some image with positive size, but only a
> slice. I've done quite a bit with snapshots before so I'm confident
> in that part of the code (getting the snapshot of bitmapData, using
> it to form a Bitmap Object, wrapping in UIComponent, adding as child
> to container), and I'm picking up one successfully but no luck on
> picking them all up. I set breakpoints at the first point of the
> snapshot and the size tells me its not the full display object. I'm
> sticking the snapshots in a model and using to source the list. The
> copy in the model has only the single full image.
>
> I've even tried making a copy of the display objects themselves and
> presenting them in the tile list but for whatever reason, the instant
> I add the child to the tilelist container, it is no longer visible in
> the original tab.
>
> Its a barchart image I'm trying to capture so I try
> var cloneBarChart:BarChart = new BarChart();
> cloneBarChart = this.barChartDisplay as BarChart;
>
> but as I mentioned, the minute I add the cloneBarChart as a child to
> the tilelist container, the original barchart disappears from the
> original tab.
>
> I didn't include code cause its a bit spread out. I'm just wondering
> if I'm missing some characteristic of the tab navigator or a
> viewstack that makes hidden children inaccessible? It could be a
> creation sequence problem but setting the selected index and
> visibility should force creation, no?
>
> thanks,
> Danny
>