|
Sending the TRANSACTION element
The user interface of the Flash movie allows the user to enter a series of buy/sell trades. After these trades are entered, you want to transmit these trades to the server using the TRANSACTION element. To do this, the user interface scripts must first convert the data into an easy-to-manipulate form. You must create an Array object called trades that consists of one or more Trade objects. The Trade object is defined by the following construction function:
function Trade(action, type, symbol, qty, price){
this.action = action;
this.type = type;
this.symbol = symbol;
this.qty = qty;
this.price = price;
}
The following is an example of populating the trades array:
trades = new Array();
trades[0] = new Trade("BUY", "MARKET", "RICH", 50);
trades[1] = new Trade("SELL", "LIMIT", "POOR", 100, 50.375);
Note that the price argument may be omitted, in which case its value is set to undefined .
When the user presses the Submit Your Order button to execute the trades, the following button actions are executed: |