|
ColdFusion 9.0 Resources |
Using the Image classThe Image class is the proxy for the ColdFusion Image service, which provides the functionality of the cfimage tag. You specify the required cfimage attributes for the action as Image tag attributes. The following examples show typical usage, in this case adding a border: <?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"
xmlns:cf="coldfusion.service.mxml.*" creationComplete="init()">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import coldfusion.service.events.*;
function init():void
{
img.execute();
}
function handleResult(event:ColdFusionServiceResultEvent):void
{
mx.controls.Alert.show("result=" + event.result.toString());
retImage.source = event.result.toString();
}
function handleError(event:ColdFusionServiceFaultEvent):void
{
mx.controls.Alert.show(event.toString());
}
]]>
</mx:Script>
<cf:Config
id="configid"
cfServer="127.0.0.1"
cfPort="80"
servicePassword="service"
serviceUserName="service"/>
<!-- Add border-->
<cf:Image
id="img"
action="addborder"
color="red"
thickness="5"
source="http://127.0.0.1:80/GetExifmetaData.jpg"
result="handleResult(event)"
fault="handleError(event)"/>
<mx:Image id="retImage"/>
</mx:Application>
|