SherifAbdou – The Design Blog

Web Design Resources & Tutorials to help you design the best website!

Search

Friday September 3, 2010
  • Home
  • Wordpress Guide
  • About Us
  • Contact Us
  • Privacy
  • Hire Me!
  • SEO Tools
  • Full Posts  |  Comments
  • By Email

Categories

  • Blog (68)
    • Freebies (10)
    • Fun Stuff (24)
    • SEO (11)
    • Site News (10)
    • Tech (12)
    • Web Design (23)
  • C++ (1)
  • ColdFusion (10)
  • Flex (60)
  • LiveCycle (2)
  • Money (5)
  • Photoshop (9)
  • WordPress (16)
    • Plugins (2)
    • Themes (2)

Other Posts You May Enjoy !

  • Understanding the RemoteClass Metadata and its use in Flex and ColdFusion
  • understanding flex data management by using coldfusion livecycle
  • Simple Login Form Example using Flex and ColdFusion WebService
  • Flex and ColdFusion Remoting Simple DataBase Example
  • Very Simple Instant Message Client using ColdFusion, Flex, and LiveCycle

Preferred Webhosting

Tags

2008 ads Adsense advice background black friday Blog brushes Cms design extend extensions firefox Flex flex 4 flex 4 gumbo free Google grunge humor improve increase jpg layout layouts Money Photoshop photoshop brushes Plugins Quality RemoteObject SEO Template Theme Themes traffic tutorial vector videos wallpaper Wallpapers web website windows 7 WordPress

Hottest Posts

  • 10+ Websites that offer free blog hosting (61)
  • Top 15+ Social Bookmarking Sites of 2009 (55)
  • 60+ Free Vectors Icons for Web Designers (53)
  • How to make money using Wordpress and Google Adsense (proper SEO) (52)
  • 25 reasons not to use Ebay ; (it sucks!) Auction Alternatives (47)
  • The 20 Best Wordpress plugins on the net’ (39)
  • Is Your Website Cross Browser Compatible ? ; CSS, Html & Compatibility (39)
  • Google Page Rank Tips Secrets & Myths : Explained n’ Uncovered (31)
  • 25 Reasons You Don’t Need Google (30)
  • Using the new FileReference Class in Flex to save and load without a server (23)
  • 10+ Google Adsense Rules n’ Optimization Tips (22)
  • 30+ Stunning Photoshop Brushes (21)
  • 50+ Refreshing Web Design Interfaces (20)
  • 50 Website Promotion tips ; The guide to increase Web Traffic (15)
  • What is your Website Worth ? – Domain appraisal tools (13)
The Design Blog's Featured Posts
 
60+ Vector Icon Sets
 
50+ WebDesign Interfaces
 
 
 
 
 
30+ Logo Design Tutorials
 
35+ High Quality NBA Wallpapers
 
20+ Best Firefox Plugins
 
200+ Pocket PC / PDA Wallpapers
 
40+ Grunge Photoshop Brushes
 
10+ Free Blog Hosting Websites
 
Web 2.0 Design Generators
 
Abstract Wallpaper Tutorials
 
Vector Art Design & Tutorials
 
Is your website cross browser compatible ?
 
The 20 Best Wordpress Plugins
 
25 reasons ebay suck
 
10+ Eye candy Photoshop Videos Tutorials



Advertise Here

The Design Blog? Who are we?

SherifAbdou.com is a web design blog that we created with goal of provoking inspiration to other designers & webmasters all over the internet

~ READ MORE ~

Our Friend’s

FkdLife - Big LoL on You
Phatbrush Photoshop Brushes
CrazyLeaf Design Blog

Humor Gallery


Understanding the RemoteClass Metadata and its use in Flex and ColdFusion

2 Jun
2008
Delicious

Here is an example of how to use the RemoteClass metadata in Flex to map Actionscript objects that map directly onto ColdFusion Component that is found on a remote server. The data then can be converted to an Actionscript class with the appropriate properties and referenced in another actionscript class or MXML. My Workspace is under wwwroot/

Download Example

;
 
package vo
{
/**
* @private
* What we need to do is map on this actionscript file
* the coldufusion component, this is done by using the Remote
* Class Metadata tag. so [RemoteClass(alias="from(wwwroot Folder).path.to.coldFusionCFC")]
* Everything has to match exactly between the variables declared here and the coldFusion arguments
* that will be declared in the CFC file otherwise it will not work at all. ALso we want this class to be
* Bindable so we can show some information to know that it works
*/
[RemoteClass(alias="RemoteClassExample.src.cfc.cfcVO")]
[Bindable]
public class ColdFusionFlexVO
{
/**
* @private
* What we will be creating are simple variables to
* prove the point, this can be used for a registration form for example.
* Make Sure when you write in the Coldfusion component you use the same
* exact name, case does matter.
* Now Go to the cfcVO.cfc file under cfc
*/
public var firstName:String;
public var lastName:String;
public var emailAddress:String;
public var password:String;
 
 
public function ColdFusionFlexVO()
{
}
public function toString():String
{
var result:String= " ";
result += "First Name : "+ firstName +"\n" +
"Last Name : " + lastName + "\n" +
"Email Address : " + emailAddress +"\n" +
"Passwrod : " + password;
return result;
}
 
}
}
<!-- What we need now is to give an alias to the cfcomponent tag which is basically where this file is stored-->
<cfcomponent output="false" alias="RemoteClassExample.src.cfc.cfcVO" style="rpc">
	<!--Create The Properties that will be used, Match them exactly with these
		 public var firstName:String;
		 public var lastName:String;
		 public var emailAddress:String;
		 public var password:String;
		 Including the type -->
	<cfproperty name="firstName" type="string"/>
	<cfproperty name="lastName" type="string"/>
	<cfproperty name="emailAddress" type="string"/>
	<cfproperty name="password" type="string"/>
 
 
	<!--Now We place the arguments that we will be using which is what we will
	passing in when we create a remote object in flex, the return type is the name
	of the coldfusion cfc file which is cfcVO-->
	<cffunction name="returnVOClassObject" returntype="cfcVO" access="remote">
		<cfargument  name="firstName" required="true" type="string"/>
		<cfargument  name="lastName" required="true" type="string"/>
		<cfargument  name="emailAddress" required="true" type="string"/>
		<cfargument  name="password" required="true" type="string"/>
 
		<!--Now set the property to the argument and return it-->
		<cfset this.firstName = arguments.firstName />
		<cfset this.lastName = arguments.lastName />
		<cfset this.emailAddress = arguments.emailAddress />
		<cfset this.password = arguments.password />
 
		<!--Return the entire cfc, which will mean that we are really returning a COldFusionFlexVO-->
		<cfreturn this>
		<!--Move on to the MXML File-->
	</cffunction>
</cfcomponent>
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"
	 creationComplete="onCreateComplete()">
	<mx:Script>
		<![CDATA[
			import mx.controls.Alert;
			import mx.rpc.events.FaultEvent;
			import mx.rpc.events.ResultEvent;
			import vo.ColdFusionFlexVO;
			/**
			 * @Private
			 * Create the class and pass to it values so we see that it works
			 */
			 [Bindable]
			 private var remoteVO:ColdFusionFlexVO;
 
 
			 private function onCreateComplete():void
			 {
			 	remoteSend.returnVOClassObject("Adobe","Flex","Adobe@flex.net","ColdFusion");
			 }
			 private function onResultEvent(event:ResultEvent):void
			 {
			 	remoteVO = event.result as ColdFusionFlexVO; //where our ColdFusionFlexVO class will be populated
			 	myText.text = remoteVO.toString();
			 }
			 private function onFaultEvent(event:FaultEvent):void
			 {
			 	mx.controls.Alert.show(event.fault.toString(),"Fault");
			 }
		]]>
	</mx:Script>
 
	<!--The Remote Object-->
	<mx:RemoteObject id="remoteSend" destination="ColdFusion" source="RemoteClassExample.src.cfc.cfcVO">
		<mx:method name="returnVOClassObject" result="onResultEvent(event)"
		            fault="onFaultEvent(event)">
 
		</mx:method>
	</mx:RemoteObject>
 
	<mx:TextArea id="myText" width="200" height="200"/>
 
</mx:Application>

Related Posts :

  •  Understanding the RemoteClass Metadata and its use in Flex and ColdFusion
    Populating a DataGrid In Flex from a ColdFusion Database

  •  Understanding the RemoteClass Metadata and its use in Flex and ColdFusion
    Creating Customs Tags in Coldfusion; An example

  •  Understanding the RemoteClass Metadata and its use in Flex and ColdFusion
    understanding flex data management by using coldfusion livecycle

  •  Understanding the RemoteClass Metadata and its use in Flex and ColdFusion
    Interactive Submit button with Symbols for Flex

  • In: ColdFusion| Flex
  • Tags: actionscript remoteclass, flex remoteclass, flex remoteclass alias, remoteclass alias, remoteclass alias flex, remoteclass flex, remoteclass metadata, [remoteclass(alias=
Incoming Search Terms :flex remoteclass , remoteclass flex , remoteclass alias , [remoteclass(alias= , flex remoteclass alias , actionscript remoteclass , remoteclass metadata , remoteclass alias flex , remoteclass(alias= , remoteclass(alias

Share this story with a friend !
Join SherifAbdou's Rss Feed Stumble This Article! Add this to your Delicious Bookmarks! Digg this story ! Add this story to Reddit ! Tweet This Brush


1 Response to Understanding the RemoteClass Metadata and its use in Flex and ColdFusion

Avatar

Kevin PennyNo Gravatar

May 29th, 2009 at 5:48 am

Excellent – My question is, what if your 'returnVOClassObject' component returned 'void' and merely populated itself – and cfreturn'd nothing? Is there a way in flex to be able to declare your object (which exists mapping to a cfc like you have) but merely call a 'read(obj)' on the obj (object) through the remoteObject call – and have that object be fully populated?? I'm getting 'null' in the event.result value – and the object I passed into it is not getting populated.

Thanks

Comment Form

top

Copyright ®2008 - SherifAbdou – The Design Blog

  • follow:
  • RSS
  • Tweet with me

Send me a message



Powered by SimpleModal Contact Form