Building Forms in Flash MX

HTML forms are structured elements, consisting of a <FORM> tag surrounding form elements. In Flash, there is no encompassing form tag. The form elements can be text fields, UI components, or other Flash objects and can reside anywhere in the movie. Because Flash is an object-oriented interface, you need only reference the objects by name to access their properties and methods. You can utilize the text property of a TextField object in your Flash Remoting service calls like this:

myService.myMethod(somefield_txt.text);

When you do that, you are essentially posting the contents of somefield_txt to the remote service. This is equivalent to sending a form and the contents of a form field to a server-side page. Because your remote services are expecting the argument, they don’t need to process and parse a form field—they need only access the value.

For that reason, building forms in Flash is somewhat of a misnomer. You are not actually building a web form, per se; you are simply creating interface elements that act as collectors of user data and passing this data to your remote services. No form is ever created; no post is ever made to the server. This highlights a key difference between Flash Remoting and working with the LoadVars class (or working with loadVariables( ) in Flash 5).

When working with the LoadVars class, your server-side page has to parse the incoming form data and determine what to do with it. Working with Flash Remoting is almost like working ...

Get Flash Remoting: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.