> What I would like to do is the following :
>
> 1) Take a "snapshot" of the current visual state
> 2) Load that snapshot into a dynamic "snapshot view" at the top level
> such that it is the only visible element on the screen.
> 3) Zoom into the "snapshot view" using the Flex zoom effect while
> loading all my updated view-state in the background.
> 4) When my updated view-state has loaded in the background, remove (or
> hide) the top-level "snapshot view".
I tried doing this:
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns="*">
<mx:Script>
import flash.display.Bitmap;
import flash.display.BitmapData;
import mx.core.UIComponent;
import mx.effects.Zoom;
import mx.managers.PopUpManager;
private function zoom(target:DisplayObject):void
{
var s:Number = target.scaleX == 1.0 ? 1.2 : 1.0;
var bitmapData:BitmapData = new BitmapData(
Math.round(target.width / target.scaleX),
Math.round(target.height / target.scaleY),
false);
bitmapData.draw(target);
var bitmap:Bitmap = new Bitmap(bitmapData);
var bitmapHolder:UIComponent = new UIComponent();
bitmapHolder.addChild(bitmap);
PopUpManager.addPopUp(bitmapHolder, target.parent);
bitmapHolder.x = target.x;
bitmapHolder.y = target.y;
bitmapHolder.width = bitmap.width;
bitmapHolder.height = bitmap.height;
bitmapHolder.scaleX = target.scaleX;
bitmapHolder.scaleY = target.scaleY;
target.visible = false;
var zoom:Zoom = new Zoom(bitmapHolder);
zoom.zoomWidthTo = zoom.zoomHeightTo = s;
zoom.play();
zoom.addEventListener("effectEnd", function():void {
target.scaleX = target.scaleY = s;
target.visible = true;
PopUpManager.removePopUp(bitmapHolder);
});
}
</mx:Script>
<mx:Button label="Zoom" click="zoom(dataGrid)" />
<mx:DataGrid id="dataGrid">
<mx:dataProvider>
<mx:Object Name="Manish" Location="Bangalore" />
<mx:Object Name="Nihit" Location="New Delhi" />
<mx:Object Name="Brian" Location="Newton" />
<mx:Object Name="Bruce" Location="San Jose" />
<mx:Object Name="John" Location="San Francisco" />
<mx:Object Name="Matt" Location="San Francisco" />
<mx:Object Name="Sho" Location="San Francisco" />
<mx:Object Name="Deepa" Location="San Francisco" />
</mx:dataProvider>
</mx:DataGrid>
</mx:Application>
Click on the Zoom button.
The performance isn't great. In fact, I think it's better to scale the
original object rather than its snapshot.
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
| Web site design development | Computer software development | Software design and development |
| Macromedia flex | Software development best practice |
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

