EasyManua.ls Logo

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH - Page 658

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
830 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
658 Working with External Data
First, the XML-formatted data is created, using the values that the user inputs in the SWF file,
and that XML object is sent using the
sendAndLoad method. Similar to data from a
loadVariables() function, the loginreply XML element arrives asynchronously (that is, it
doesnt wait for results before being returned) and loads into the
loginReplyXML object.
When the data arrives, the
onLoad handler of the loginReplyXML object is called. You must
define the
loginReplyXML function, which is called when the onLoad handler triggers, so it
can process the
loginreply element.
If the login is successful, the SWF file progresses to the
welcome frame label. If the login is not
successful, then the playhead moves to the
loginfailure frame label. This is processed using
a condition and case statement. For more information on case and break statements, see
case statement and break statement in the ActionScript 2.0 Language Reference. For
more information on conditions, see if statement and else statement in the
ActionScript 2.0 Language Reference.
For more information, see Integrating XML and Flash in a Web Application at
www.macromedia.com/support/flash/interactivity/xml/ and the XML entry in the
ActionScript 2.0 Language Reference. For more information on local file security, see About
local file security and Flash Player” on page 679.
You can find a sample source file, login.fla, in the Samples folder on your hard disk. This
sample shows how to add simple login functionality to your websites using ActionScript 2.0.
The sample uses ActionScript and components to create a small form in which you enter a
user name and password and then click a button to enter a site.
In Windows, browse to boot drive\Program Files\Macromedia\Flash 8\Samples and
Tutorials\Samples\ActionScript\Login.
On the Macintosh, browse to Macintosh HD/Applications/Macromedia Flash 8/Samples
and Tutorials/Samples/ActionScript/Login.
Flash Player 8 introduced the
onHTTPStatus event handler for the XML class, LoadVars
class, and MovieClipLoader class to allow users to access the status code from an HTTP
request. This allows developers to determine why a particular load operation may have failed
instead of only being able to determine that a load operation already has failed.
NOTE
This function must always be on the frame that contains the ActionScript for the login
button.
NOTE
This design is only an example, and Macromedia can make no claims about the level of
security it provides. If you are implementing a secure password-protected system, make
sure you have a good understanding of network security.

Table of Contents

Related product manuals