Welcome!

Adobe Flex Authors: Liz McMillan, RealWire News Distribution, Maureen O'Gara, Yakov Fain, Keith Swenson

Related Topics: Adobe Flex

Adobe Flex: Article

Web and Mobile Convergence Sharing Data Between Flex 2 and Flash Lite

Developing a blog aggregator

The HTTPService request waits for a parameter that represents the URL of the post selected by the user in the datagrid control. These saved values are stored into the database and will be requested by the Flash Lite application. So that all the news bookmarked will be available via a Flash Lite enabled mobile phone.

For our purposes, this is enough, but you could go further in extending the Flex application.

You should use the StringValidator tag to validate the data inserted by the user into the Text Inputs so that you avoid errors on the business tier. Or, you could add some styles or customizations to the user interface using Cascading Style Sheets (CSS).

The Mobile Application: Creating a Flash Lite XML Parser
All the data is stored in the MySQL database. Unfortunately, Flash Lite is not able to access a database directly. Therefore, in order to access data, we need to develop a PHP function that makes the connection and returns the values to our Flash Lite interface.

You can try it by launching the URL, http://88.149.156.198/develop/rssToDb/rssmobile.php. However, you will see that another limitation occurs because the Flash Lite 1.1 player cannot parse XML directly. It can load dynamic data via the loadVariables function, using the name/value pair data structure. Using this method, you can load almost any data within Flash Lite 1.1 content.

We were inspired by a ready-to-use PHP RSS parser written by Alessandro Pace who explained in an article for Adobe Developer Center (www.adobe.com/devnet/devices/articles/flashlitell_rss.html) how to create a Flash Lite 1.1 RSS (Really Simple Syndication) reader using a server-side PHP RSS parser.

With the following PHP 5 XML parser, a RSS 2.0 feed will be read to extract the <title> and <description> tags contents for each <item> block, and then the content will be customized so it can be loaded into the Flash Lite 1.1 RSS reader on the mobile phone, as shown in Listing 5.

The values returned by the echo will produce the following output:

&title1=Tips for Developing Flash Games for the iRiver U10&description1=New article on DevNet at Adobe: Tips for Developing Flash Games for the iRiver U10. It includes two samples available for download. The article is written by Sung-Hee Park of MiniGate. Alessandro

The code is pretty simple and well commented but if you want further explanation, you can read the "Analyze the Code" section of the tutorial (www.adobe.com/devnet/devices/articles/flashlite11_rss_02.html).

It's now the turn of the Flash Lite user interface. You can download the complete application on the Adobe Devnet : Flashlite11_rss_samples.zip (http://download.macromedia.com/pub/developer/flashlite11_rss_samples.zip). Opening the Flash file, you'll see the application is made up of 5 frames and 3 layers. The most important part of code is contained in frame two, where the call to the server is made using the loadVariable function:

loadVariable (http, "");

The "http" variable points to the server-side PHP file's URL, and it's definied on frame one:

http = "http://88.149.156.198/develop/rssToDb/mobileparser.php";

The loadVariable function reads data from an external file, such as a text file or text generated by server-side script (Coldfusion, PHP ...), and sets the values for variables in a target movie clip. The text at the specified URL must be in the standard MIME format application/x-www-form-urlencoded (a standard format used by CGI scripts):

&title1=more on apollo&description1=news from apollo&title2=flex url kit&description2=
a new kit for handling with URL has been released

All the navigation features are hidden on frame five inside the hidden button used to select the variables title and description and to scroll the dynamic text contained in the description variable, as shown in Listing 6.

Conclusion
The game is over. Thanks to the Flash Platform, in just a few simple steps, we built a simple Flex 2 application that manages data with PHP from a MySQL database. Data is then exposed and presented through a mobile application that uses Flash Lite as development technology. Users can reach through their cellular phones blog posts they previously selected and stored via a Flex 2 Web application.

More Stories By Marco Casario

Marco Casario is CEO of Comtaste, a company devoted to develop Rich Internet Applications on the Web and for mobile devices.

He collaborates intensively with Adobe Italy as a speaker at conferences and as a consultant for Flash, Flex, and Flash Lite.

Learn more about Marco Casario at his blog http://casario.blogs.com. In 2005, Marco has founded Comtaste, a company dedicated to exploring new frontiers in Rich Internet Applications and the convergence between the web and the world of mobile devices — MobyMobile and YouThru are representative of their recent work. He is founder of the biggest worldwide Flash Lite User Group and of www.augitaly.com, a reference point for the Italian community of Adobe users, in which he carries out the role of Channel Manager for the section dedicated to Flex.

Comments (2) View Comments

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


Most Recent Comments
Motorola Krzr K1 12/04/06 08:36:50 PM EST

Here is the page that you asked me to find. It is 3 reviews about Motorola Krzr K1 in it.
http://skyhaifa.com/reviewes.php?cat_id=19&model=nokia-n93
Motorola Krzr K1

Motorola Krzr K1 12/04/06 08:36:02 PM EST

Here is the page that you asked me to find. It is 3 reviews about Motorola Krzr K1 in it.
http://skyhaifa.com/reviewes.php?cat_id=19&model=nokia-n93
Motorola Krzr K1