| By Michael Labriola | Article Rating: |
|
| March 1, 2006 05:00 PM EST | Reads: |
21,465 |
Example 2: flexFCS_02.mxml (additions are highlighted) <?xml version="1.0"
encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"
xmlns="*" creationComplete="initializeApplication( event )">
<mx:Script>
<![CDATA[
var myData:Array;
function initializeApplication( event )
{
//We are called by the creation complete event of the application tag
//Instantiate a new Array
myData = new Array();
//Connect to the flash communication server.
//we are using rtmp as our first protocol attempt
my_fcs.connect(Œrtmp://[your_server]/random');
}
]]>
</mx:Script>
<mx:DataGrid id="display_grid" dataProvider="{myData}" width="90%" height="90%"/>
<!--Created a DataGrid and bound the dataProvider to myData-->
<!--Instantiate an FCSService component-->
<FCSService id="my_fcs"
closed=" alert( Œserver closed connection' )"
rejected=" alert(ŒServer rejected connection')"
failed=" alert(ŒServer connection failed')" />
<!--Instantiate an SharedRemote component and bind it to the FCSService tag
above-->
<!--The name property of this tag must match the argument in the SharedObject.get
command on the server file main.asc-->
<SharedRemote id="my_remote1"
name="RandomNumbers"
service="{my_fcs}"
failed="alert(ŒShared Object Failed')"
status="alert(ŒStatus Œ + event.info.level + Œ Œ + event.info.code );"/>
</mx:Application>
In this version, I added three important blocks of code:
- An FCSService component
- A SharedRemote component
- A call to the FCSService object's connect method
Second, the SharedRemote component has an id of my_remote1. The service property is set to {my_fcs}, the id of the FCSService component. This allows any FCSService component to have multiple shared remote objects defined. The SharedRemote component also defines event handlers for the failed and status messages. If an end user encounters a problem with the shared object, an alert box displays on the screen.
Finally, the initializeApplication handler calls my_fcs.connect(Œrtmp://yourServerName/random' ). The name, random, is the name of the application created when you placed the main.asc file into the random folder on your FCS.
When you invoke the connect method, you attempt to make a connection initially through RTMP to FCS. In reality, you actually have several protocols/port combinations which will be tried before a connection occurs. While this concept is outside the scope of this article, please read "Tunneling Macromedia Flash Communications Through Firewalls and Proxy Servers" for more information.
If you run the application at this point, you will see a DataGrid, much like the previous example.
If an alert box appears, ensure that your Flash Communication Server is running and that you placed the main.asc file in the proper directory as explained in the "Flash Communication Server" section.
The Good Stuff
After the last round of revisions, your application can receive updates from the server, but can't do anything with them yet. Now you'll add that functionality.
Add the highlighted code below to Example 2 (flexFCS_02.mxml) or, open the solution file, flexFCS_03.mxml, which contains all of the changes. The flexFCS_03.mxml file is included in the fcs_flex_sample.zip that you downloaded in the Requirements section of this article.
Published March 1, 2006 Reads 21,465
Copyright © 2006 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Michael Labriola
Michael Labriola is a founding partner and senior consultant at Digital Primates IT Consulting Group. Digital Primates analyzes client business processes and develops custom solutions that extend the latest technology.
![]() |
SYS-CON Italy News Desk 03/01/06 06:11:57 PM EST | |||
Communication Server (FCS) together provide an amazing toolbox that will undoubtedly provide inspiration to thousands of developers and projects. Unfortunately, without concrete examples and guidelines for good practices on their integration, we spent many hours on tiny issues that, with additional information, could have been easily circumnavigated. |
||||
- Adobe’s Aiming ColdFusion at Multiple Clouds
- Cloud Computing Journal: Adobe to Deliver ColdFusion in the Cloud
- Adobe May Cooperate with Apple to Transplant Flash Player to iPhone
- Adobe Flex Developer Earns $100K in New York City
- Adobe LiveCycle Enterprise Suite 2 for Cloud Computing
- Adobe Betas Target RIAs and Cloud Computing
- Adobe Cans Another 9% of its Workforce
- Moyea DVD4Web Converter V2.0 Converts DVD to FLV Fast and Synchronously with Watermarks
- Adobe Fiddles with its Web Apps
- Adobe & Salesforce Cut Cloud Deal
- Hosting.com Launches ColdFusion 9 in the Cloud
- The Real Time Infrastructure Ultimatum
- Adobe’s Aiming ColdFusion at Multiple Clouds
- Eval JavaScript in a Global Context
- Fig Leaf Software to Exhibit at Government IT Conference & Expo
- Cloud Computing Journal: Adobe to Deliver ColdFusion in the Cloud
- Is Microsoft as Free as Open Source?
- Adobe Reader Sued
- The Planet Named “Bronze Sponsor” of Cloud Computing Expo
- Microsoft Expression Web Has Got Game
- Adobe May Cooperate with Apple to Transplant Flash Player to iPhone
- Adobe Flex Developer Earns $100K in New York City
- Bruce Chizen Joins Voyager Capital as Venture Partner
- My Top Seven Wishes From Adobe MAX 2009
- The Next Programming Models, RIAs and Composite Applications
- Where Are RIA Technologies Headed in 2008?
- Constructing an Application with Flash Forms from the Ground Up
- AJAX World RIA Conference & Expo Kicks Off in New York City
- CFEclipse: The Developer's IDE, Eclipse For ColdFusion
- Personal Branding Checklist
- Adobe Flex 2: Advanced DataGrid
- Has the Technology Bounceback Begun?
- Building a Zip Code Proximity Search with ColdFusion
- i-Technology Viewpoint: We Need Not More Frameworks, But Better Programmers
- The Asynchronous CFML Gateway
- Web Services Using ColdFusion and Apache CXF























