Saturday, July 18, 2009

Create simple external Action Script for HTTP Service

Flex developers can use ActionScript to extend the functionality of their Adobe® Flex™ applications. ActionScript provides flow control and object manipulation features that are not available in MXML. For a complete introduction to ActionScript and a reference for using the language, see Programming ActionScript 3.0 and ActionScript 3.0 Language Reference.

Flex developers can use ActionScript to implement custom behavior within their Flex applications. You first use MXML tags to declare things like the containers, controls, effects, formatters, validators, and web services that your application requires, and to lay out its user interface. Each of these components provides the standard behavior you'd expect. For example, a button automatically highlights when you roll over it, without requiring you to write any ActionScript. But a declarative language like MXML is not appropriate for coding what you want to happen when the user clicks a button. For that, you need to use a procedural language like ActionScript, which offers executable methods, various types of storage variables, and flow control such as conditionals and loops. In a general sense, MXML implements the static aspects of your application, and ActionScript implements its dynamic aspects.

ActionScript is an object-oriented procedural programming language, based on the ECMAScript (ECMA-262) edition 4 draft language specification. You can use a variety of methods to mix ActionScript and MXML, including the following:

  • Use ActionScript to define event listeners inside MXML event attributes.
  • Add script blocks using the tag.
  • Include external ActionScript files.
  • Import ActionScript classes.
  • Create ActionScript components.
This is simple code for create external Action Script for HTTP Service.

Code Action Script SrvHTTP.as


Flex Code for call the SrvHTTP.as like this :
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script source="SrvHTTP.as"/>
<mx:HTTPService id="validationLogin" method="POST" showBusyCursor="true" useProxy="false" url="{SrvHttp}/filePHP.php"/>
</mx:Application>

No comments:

Post a Comment