Mike Potter

February 28, 2006

Flex and PHP Using AMFPHP - A Simple Example

In a previous entry, I showed you how to connect Flex and PHP together using XML to transfer data from the server to the Flash client. (Here's the article in PDF format). A relatively simple example, but still useful to a bunch of people. When writing that sample, I thought, there must be a better way to transfer data than using XML. What if I wanted to send an array or an object from PHP through to ActionScript... Could that be done? Well, it turns out that it can be done, and its done using a project called AMFPHP. Using that code, it will convert data objects in PHP to data objects in ActionScript, so you can access them in your Flex projects. Sounds cool? Well, it is. Using that technology, and allowing a few hours for a small learning curve, I was able to build a Flash based front end to my Gallery website.

As a follow up to my first article, I've created a second article that shows how to connect AMFPHP to a Flex front end for development of Rich Internet Applications. The tutorial is extremely simple, but still shows the power of PHP and Flex. (The code is also available in a ZIP file). I'll post the files for my Gallery front end in a few days, once I've had a chance to clean it up a bit. I'm hoping to get this up on other PHP sites and our own developer centers, so I appreciate your feedback with this early draft of the article.

Please use this tutorial as a getting started guide to developing really cool things with Flex and PHP. If you're looking for suggestions, I think the best place to start is with existing PHP projects, and providing a Flex front end to them. Who wouldn't want a user admin application for Drupal written in Flex, rather than HTML? Or a Flash front end to PHPMyAdmin written in Flex (there's already one written in Flash). Get started, and let me know what you're up to.

Lastly, I'd like to thank some people who helped me create this sample. They're thanked in the PDF article, but here's some blog thanking:
Patrick Mineault - http://www.5etdemi.com/blog/ - AMFPHP guru.
Jesse Warden – http://www.jessewarden.com/ - Had some great samples up showing how to integrate Flex and AMFPHP.
http://www.tweenpix.net/blog - A blog in French where I got the ActionScript code for RemotingConnection from (http://www.tweenpix.net/blog/index.php?2006/01/03/543-hello-world-en-amfphp-avec-flex20)

(Links fixed to Gallery and FlashAdmin)

09:59 AM | Permalink | Comments [10]

February 27, 2006

Improving performance in Adobe LiveCycle

Last week Hong Qiu pushed our new LiveCycle Performance Center live. This page will be our main page for performance related information with LiveCycle. I urge you to check it out, bookmark it and check it if you're concerned or interested in LiveCycle software. BTW: A good way to keep up to date with new content is to subscribe to our monthly enterprise developer newsletter (at least until we get RSS feeds on our developer centers).

01:33 PM | Permalink | No Comments

February 24, 2006

Heading to New York in 2 Weeks

I'm heading to New York for the AJAX seminar in two weeks... If you're in New York and working on LiveCycle or Flex solutions, I'd love to meet you on Tuesday morning (14th of March). Leave a comment in the blog and I'll email you back.

01:31 PM | Permalink | No Comments

February 23, 2006

Adobe, Flash, Flex, LiveCycle - What's in the future?

Adobe's CEO Bruce Chizen gave a great interview to the Wharton School of Business where he discusses the merger between Macromedia and Adobe, the engagement platform that we're planning, challenges with Microsoft, Vista and the inclusion of PDF into Office, LiveCycle and enterprise sales at Adobe, the management structure at Adobe after the acquisition and Adobe's plans for the future (yes, its a long article). A good read if you're interested in our plans for the future, and where he hopes Adobe will be in 3, 5 and 10 years.

09:00 AM | Permalink | No Comments

An overview of Adobe Developer Relations

Sara Spalding, director of Adobe Developer Relations, gives a good overview of what our team does here at Adobe in a new Dev Center article... A good read if you've ever wondered what the role of people on our team was.

08:47 AM | Permalink | Comments [1]

February 22, 2006

Want to get started with LiveCycle? Try the toolbox

Yesterday we release the Adobe LiveCycle Toolbox which is a "self-contained development environment for prototyping, developing, and testing Adobe LiveCycle applications." What this toolbox does is provide developers with a single download that provides a Windows / JBoss / MySQL environment of LIveCycle software, including Forms, Form Manager, Reader Extensions and Workflow. It also contains samples that help you get started for common LiveCycle tasks, like prepopulating a PDF form, processing the data etc...

We've recently started a survey for members of the Adobe Enterprise Developer Program, and one consistent piece of feedback was that it would be nice to have one install that contained the most popular applications from LiveCycle. We're happy to announce today that we've got something that fulfills that request.

Please note that you do need to be a member of the Adobe Enterprise Developer Program to access this download.

09:55 AM | Permalink | No Comments

February 16, 2006

Adding a border to Designer fields

Jesse Warden posted a blog entry yesterday saying how LiveCycle forms would be much better if we had some sort of Flash content in the PDFs. One example that he gave was "tabbing that actually visually shows you where you are"... Here's a small samplethat shows a form highlighting fields as a user enters into them, and then reverting back to the original color as they exit the field.

Now, in making this sample, I came across a small problem. In Designer, you can't use fieldName.borderColor if the borderColor hasn't been set already. So, first you need to set the border color for each field (in the Border pallette), and *then* you can manipulate the border using JavaScript. If the border is not set in the Border pallette, you can't set the border attributes via JavaScript. I hope this helps you out, and also shows the ease of which the form designer can create better looking forms.

12:42 PM | Permalink | Comments [3]

February 14, 2006

A whole page of samples for LiveCycle Designer

Yesterday we posted an entire page of samples for LiveCycle Designer. The page currently includes 20 samples, dealing with topics such as "Getting and setting form field values", "Changing the appearance and behavior of an object at runtime", "Working with data sources and schemas", "Form layout techniques", and "Working with digital signatures".

Maybe the best part about the page is the one sentence at the top: Send us a sample to have it posted here. If you're building form based applications using LiveCycle software and want to put your code up on the web for others to use, send us an email and we'll work with you to get it up on that page (or other pages for software other than Designer).

If you have questions about the samples, please post them in the LiveCycle Designer forum.

09:19 AM | Permalink | Comments [2]

February 07, 2006

Flex and PHP - A simple sample

I also posted this to the Adobe Flex Builder forum...

I wrote up a small Flex Builder 2.0 sample that uses PHP to update a MySQL database, with the front end being a Flex based application. In this very simple example, we have two fields, username and email address, and a datagrid. The username and email address fields are text fields, and filling them in and clicking on the "Submit" button adds them to the database. The data grid displays all the users, with an ID and their username. Below that, a text field shows the email address of the selected user (I did this, rather than 3 columns in the datagrid, to show binding data to another field, and I think its cool) :)

Here's the code: (I don't know how to attach files to this forum!)

MySQL schema:
Note: The PHP code assumes that you have created the following table in a database called "sample":
CREATE TABLE `users` (
`userid` int(10) unsigned NOT NULL auto_increment,
`username` varchar(255) collate latin1_general_ci NOT NULL,
`emailaddress` varchar(255) collate latin1_general_ci NOT NULL,
PRIMARY KEY (`userid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=3 ;

MXML:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml" xmlns="*" layout="absolute" creationComplete="send_data()">
<mx:Script>
<![CDATA[
private function send_data():void {
userRequest.send();
}
]]>
</mx:Script>
<mx:Form x="22" y="10" width="493">
<mx:HBox>
<mx:Label text="Username"/>
<mx:TextInput id="username"/>
</mx:HBox>
<mx:HBox>
<mx:Label text="Email Address"/>
<mx:TextInput id="emailaddress"/>
</mx:HBox>
<mx:Button label="Submit" click="send_data()"/>
</mx:Form>
<mx:DataGrid id="dgUserRequest" x="22" y="128" dataProvider="{userRequest.result.users.user}">
<mx:columns>
<mx:DataGridColumn headerText="User ID" columnName="userid"/>
<mx:DataGridColumn headerText="User Name" columnName="username"/>
</mx:columns>
</mx:DataGrid>
<mx:TextInput x="22" y="292" id="selectedemailaddress" text="{dgUserRequest.selectedItem.emailaddress}"/>
<mx:HTTPService id="userRequest" url="http://localhost/flex/php/request.php" useProxy="false" method="POST">
<mx:request xmlns="">
<username>{username.text}</username><emailaddress>{emailaddress.text}</emailaddress>
</mx:request>
</mx:HTTPService>
</mx:Application>

request.php:
NOTE: You'll likely have to change the default "username" and "password".

<?php
//connect to the database
$mysql = mysql_connect(localhost, "username", "password");

mysql_select_db( "sample" );
//if the username and email address are filled out
if( $_POST["emailaddress"] AND $_POST["username"])
{
//add the user
$Query = "INSERT INTO users VALUES ('', '".$_POST['username']."', '".$_POST['emailaddress']."')";

$Result = mysql_query( $Query );
}

//return a list of all the users
$Query = "SELECT * from users";
$Result = mysql_query( $Query );

$Return = "<users>";

while ( $User = mysql_fetch_object( $Result ) )
{
$Return .= "<user><userid>".$User->userid."</userid><username>".$User->username."</username><emailaddress>".$User->emailaddress."</emailaddress></user>";
}
$Return .= "</users>";
mysql_free_result( $Result );
print ($Return)
?>

I'll be posting other tutorials for Flex and PHP in the near future on many of the PHP focused websites. If you have comments, I'd appreciate them here before I send out samples to those sites.

03:09 PM | Permalink | Comments [40]

February 01, 2006

Want an intro to LiveCycle? Live in the Bay Area?

If you want an introduction to LiveCycle and the Adobe Enterprise Developer Program and live in the Bay Area, I'll be doing a presentation on LiveCycle to the Bay Area Application Developers Macromedia User Group next Wednesday night, February 8th, at 6:30 PM.

From their site:
When: February 8, 2006 at 6:30:00 PM
Where: Learn IT! (250 Montgomery Street in the San Francisco Financial District) - 15th Floor
Cost: $7.00 if registered in advance (see above); $10.00 at the door.
What: The use of forms, whether paper or electronic, to capture, validate, convey, and record data is essential to the successful operations of most enterprises. Adobe LiveCycle is a set of document services that greatly increase the efficiency with which electronic forms are processed. Mike Potter of Adobe Developer Relations will provide an overview of LiveCycle and demonstrate designing a form in LiveCycle Designer (a free download is available), pre-populating that form and extracting the information using LiveCycle Forms, enabling other functionality in Adobe Reader with LiveCycle Reader Extensions, securing the document with LiveCycle Policy Server and LiveCycle Document Security, and finally, building a workflow and putting the pieces together with Adobe LiveCycle Workflow. Mike also will discuss the features and benefits of the Enterprise Developer Program and will tell you how you can join.

If there are other topics related to LiveCycle that you'd like me to cover, please let me know and I'll try to squeeze them into the agenda.

01:25 PM | Permalink | Comments [2]

Adobe Flex Now In Beta

We released Adobe Flex 2.0 beta today on our Adobe labs website. There are three main parts to the beta: Adobe Flex Builder, Adobe Flex Enterprise Services and Adobe Flash Player 8.5. The Flex Builder tool, to those who aren't familiar with it, is an IDE to create Flash based applications. You can create the applications using Flex Builder, and compile the apps into flash files that you put on your website. Today Adobe also announced that the Flex Builder SDK, which will include the compiler and documentation, will be available for free... So now, anyone will be able to build Flex applications, with cost no longer being a barrier to entry. Those of us who still require the full IDE will be able to purchase Flex Builder 2.0 for less than $1,000 (final pricing yet to be announced).

The Flex Enterprise Services will be of interest to existing LiveCycle customers, who are looking to expand their existing enterprise web applications and provide a more intuitive and graphically pleasing interface to them than with HTML. Read more about Flex Enterprise Services and how it can help your business. Also today, we announced that Flex Enterprise Services will be available for use by a limited number of concurrent users, on a single CPU system, for free.

So, there you go... The barriers to entry have been removed. I've seen some cool integration work with LiveCycle and Flex already, and now its your turn. Get started with Flex by downloading the beta. Get started with LiveCycle by joining the Adobe Enterprise Developer Program and downloading individual developer versions of LiveCycle software. Then, contact me and let me know about the cool things that you're building using our two sets of technologies.

09:44 AM | Permalink | Comments [2]