Flash Remoting V2 + Trio Motor V2
As many of you may know, Macromedia released the new ActionScript 2.0 API for Flash Remoting. It is a big step forward. You will find a lot of changes in the syntax and most of the old syntax is deprecated, but they are all improvements. We have now a better, cleaner and more flexible API than we had in the previous version. The most important feature is the documentation; they did a great job (Hopefully, they will do the same with everything else they release).
Along with the Remoting components, an article written by Mike Kollen and I has been published on Devnet. It is about the new version of Trio Motor using the Remoting API v2. It is the first of a series of three and focuses on the small Work Order Status widget.
The article explains the basics of the new API using some of the Remoting classes like Service, PendingCall, Recordset, DataGlue, etc. What it does not cover is the connector component. If someone is interested in an example of the connector, I’ve got good news for you. I made a version of the widget using the connector but we later decided not use it for the article. You can take a look at it. The only thing that you may need to change is the GatewayUrl of the connector so that it is your own default gateway. Right now it is set to localhost but you can change it manually in the component parameters.
In the next two articles we'll make the big jump to the whole Trio Motor application and we’ll go deeper into Object Oriented Programming, so stay tuned.
Ross MacLachlan
I do have a question about step 8 of the ServiceOrder.as
I could not get the submit button to work unless I change the code from...
submit.addEventListener("openServiceManager", this);
to...
submit.addEventListener("click", openServiceManager);
or another way was to change the method name from...
openServiceManager
to...
click
and
submit.addEventListener("click", this);
(more along the lines of your change listeners)
I was also surprized to see that either of these worked. I have read too many was to create listeners. Your coments on best practices would be appreaciated.
Thanks again for the artical, looking forward to the next 2.
Ross
-- code in question -->
8. The init() function adds listeners for the UI components.
public function init():Void
{
/* listener for the TextInput*/
license.addEventListener("change", this);
/* listener for the ComboBox*/
statusComboBox.addEventListener("change", this);
/* listener for the Button*/
submit.addEventListener("openServiceManager", this);
createConnection();
}
PS to anyone-- I did mine AMFPHP. Make sure your have build 0.9b other wise the second call to the service will fail with "no class named Navigation is known to the gateway". Problem is in the flashservices\app\Executive.php file. 0.9b fixed this.
Nahuel
You are right, the tutorial should state:
submit.addEventListener("click", this) instead of
submit.addEventListener("openServiceManager", this)
If you download the tutorial solution from the first page, you will see that it has the correct function call.
I am not sure how that got there. I will contact Macromedia to get it fixed. Thanks for pointing that out!
Regarding the best practices of adding event listeners, I would suggest to do it by passing "this" (or any object such as a proxy) as the parameter instead of the function name.
Thanks again,
Nahuel
emer
Everything is working on the samples while I'm in the Flash environment. However, when I access the index.cfm on a client's station (im on an intranet), the UI components are empty. Your help is highly appreciated. Thanks and more power!
Emer
Nahuel
I believe the problem is that the movie doesn't find the gateway.
If you are using the example in the article, you need to change this line in the first frame of the movie:
var path:String = "http://localhost/flashservices/gateway";
and replace localhost with your ip or computer that is acting as server.
If you are using the connector example, you need to change the gatewayUrl property in the component inspector of both connectors
Nahuel
Jean-Charles Carelli
Please post Tab or Comma file so I can use MySQL.....