I have a data grid that lists the contents of a folder an the server.What I
want to do is have a button that allows the user to swap between a data grid
and a list of thumbnails. There maybe a chance that these directories have
more than images but for now lets just pretend they are all images.

Using a remote object call I can go to the server and get the binary data
for an image, like I have in the example below. I was wondering if anyone
has an example of this in an item renderer and second once I grab the binary
data, how can I create thumbnails of that image?

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="vertical"
    creationComplete="init()">

    <mx:Script>
        <![CDATA[
            import mx.rpc.events.ResultEvent;
            private var imgData:ByteArray;

            private function init():void {
                var imgData = new ByteArray();
                ImageService.readImage("C:\\dan\\rocket_step7_a.png");
            }

            private function onReadImage(event:ResultEvent):void {
                imgData = event.result as ByteArray;
                var loader:Loader = new Loader();
                loader.loadBytes(imgData);

                imageCanvas.rawChildren.addChild( loader );

            }
        ]]>
    </mx:Script>

    <mx:RemoteObject id="ImageService" destination="ColdFusion"
source="ImageLoader.src.ImageService" showBusyCursor="true">
        <mx:method name="readImage" result="onReadImage(event)"/>
    </mx:RemoteObject>

    <mx:Canvas id="imageCanvas" width="100" height="100"/>

</mx:Application>


Thank You
Dan Vega
danv...@gmail.com
http://www.danvega.org

Reply via email to