Check out Ted's examples with code.

http://www.onflex.org/ted/2007/12/progressive-image-loading-with.php

 

this shows how to get binary data and turn it into an image.

 

Kenneth.

 

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Dan Vega
Sent: 13 January 2009 13:39
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Loading images using binary data

 

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

 

Disclaimer 
-------------------------------------------------------------------------------------------
This electronic message contains information which may be privileged and 
confidential. The information is intended to be for the use of the 
individual(s) or entity named above. If you are not the intended recipient, be 
aware that any disclosure, copying, distribution or use of the contents of this 
information is prohibited. If you have received this electronic message in 
error, please notify us by telephone on 0131 476 6000 and delete the material 
from your computer. 
Registered in Scotland number: SC 172507. 
Registered office address: Quay House 142 Commercial Street Edinburgh EH6 6LB. 

This email message has been scanned for viruses by Mimecast.
-------------------------------------------------------------------------------------------

Reply via email to