Entries Tagged as 'Flex'

Binding ColdFusion query to DataGrid in Flex

Posted by Vikas on December 01, 2010
  0 comments

 

Hi,

In this post I'll explain you how to bind ColdFusion data into Flex grid.

First, get ready with your cfc.

Your cfc method may look like:

 




HorizontalList control using flex

Posted by Naresh Patel on December 25, 2009
  0 comments

Hi,

I have created a sample Flex application that uses HorizontalList
component.

Now when I use dynamic dataprovider that is if data to display is
dynamic the HorizontalList component is working.

My code for the sample app is as under:

image.mxml



<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.controls.Image;
import com.events.MainButtonClickEvent;

public function cmdOpen_click(event:Event):void
{
if(grdResource.selectedIndex >= 0)
{
    var ImageURL:URLRequest = new URLRequest();
    ImageURL.url = grdResource.selectedItem.typeValue;
    navigateToURL(ImageURL,"_blank");
}
else
    Alert.show("Please select Image to open");
}
private function getResourceByProducts_result(event:ResultEvent):void
{    
    this.grdResource.dataProvider = new ArrayCollection(event.result.source as Array);
}

private function server_fault(event:FaultEvent):void
{
    Alert.show(ObjectUtil.toString(event.fault));
}

]]>
</mx:Script>

<mx:RemoteObject
id="rdoImageResource" destination="ColdFusion" 
source="Myapplication.coldfusion.Images.ImagesResourceGateway">
    <mx:method name="getResourceByImages" result="getResourceByImages_result(event)" fault="server_fault(event)"/>
</mx:RemoteObject>

<mx:HorizontalList id="grdResource" iconField="thumbnailImage" columnCount="6" columnWidth="135" rowCount="1" rowHeight="135"
            horizontalScrollPolicy="on" x="20" y="698" width="698" click="cmdOpen_click(null)" visible="false">
               <mx:itemRenderer>
        <mx:Component>
            <mx:VBox horizontalAlign="center">
                                 <mx:Label text="{data.reference}" id="test1" />
                                 <mx:Image source="{data.imagename}" id="image" height="100" width="115" />
                         </mx:VBox>
               </mx:Component>
    </mx:itemRenderer>
</mx:HorizontalList>

</mx:Application>