
Create the Flex application 247
Import the required ActionScript classes
In this section, you create a script block and import a set of classes that you will use.
1. Create a script block for ActionScript code directly below the <mx:Application> tag:
<mx:Script>
<![CDATA[
]]>
</mx:Script>
2.
Directly below the <![CDATA[ tag, add the following ActionScript import statements:
import mx.messaging.events.*;
import mx.messaging.Producer;
import mx.messaging.messages.AsyncMessage;
3.
Save the file.
Create the Producer and Consumer
In this section, you declare the variables for the message Producer and the message Consumer.
1. Directly below the import statements in the script block, add the following variable
definition:
public var pro:mx.messaging.Producer;
public var con:mx.messaging.Consumer;
2.
Save the file.
Initialize the application
In this section, you create a function to create the message Producer.
1. Directly under the variable declaration, add the following method:
public function initApp():void {
pro = new mx.messaging.Producer();
pro.destination = "ColdFusionGateway";
consumer.subscribe();
}
2.
Save the file.
Kommentare zu diesen Handbüchern