Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: Appropriate use of MXML WebService  (Read 10153 times)
jinglesthula
Newbie
*
Posts: 8


View Profile Email
« on: July 02, 2008, 03:33:14 »

Does using PureMVC in a Flex app prevent the use of data services that are mxml based?

I was going about implementing a web service in one of my proxies when I discovered that there is an AS3 version and an mxml version.  They seem similar with the exception that the mxml version includes a property called showBusyCursor (which I would like to use so that the user knows that the UI is waiting on the remote data to load).  The AS3 version doesn't have this ability. 

Would it be horrible to put an mxml WebService (non-visual) component in my display hierarchy and cache a reference to it in my proxy?  It sounds not-right somehow (coupling model and view).  There may be a way to send a notification as I invoke the WebService that the view will respond to which will set the cursor to busy and then send another notification onResult to change the cursor back, but that also seems a bit clunky.  I guess it's really a reflection of flex allowing you to define display objects as well as non-visual data-layer and business-layer objects (Xml, Bindings, WebService for example) in mxml.  Is there a way to use these mxml classes that seem to be made for things that fall into the model and controller areas in a way that adheres to best practices?
« Last Edit: July 02, 2008, 11:26:21 by jinglesthula » Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: July 03, 2008, 06:43:18 »

I believe you can instantiate the MXML version from AS, but the recommended way would be to use the AS3 version and send a notification to your ApplicationMediator to show the busy cursor when the call is made and another to clear it when your result or fault comes back.

-=Cliff>
Logged
skasssam
Jr. Member
**
Posts: 18


View Profile Email
« Reply #2 on: July 07, 2008, 12:55:09 »

I am not sure if this is the _correct_ way but in AS3 you are probably using:

:
import mx.rpc.remoting.RemoteObject;

That does not have the showBusyCursor attribute.

Instead use:

:
import mx.rpc.remoting.mxml.RemoteObject;

And you will be able to do something like:

:
configurationService = new RemoteObject();
configurationService.showBusyCursor = true;
...

HTH,
Shinan
Logged
creynders
Jr. Member
**
Posts: 18


View Profile Email
« Reply #3 on: July 08, 2008, 08:18:16 »

Probably I'm overlooking something very basic here, but why not create a proxy (not a pureMVC proxy, in this case) for the webservice that calls CursorManager.setBusyCursor() and CursorManager.removeBusyCursor() when the service is respectively called and finishes its call?
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #4 on: July 08, 2008, 09:45:54 »

The cusror state shouldn't be managed by a Proxy, that is coupling the Model to the View. The cursor state should be managed by either a Mediator (probably the ApplicationMediator if one is implemented), or, since the CursorManager functionality is static, from a Command. The latter would likely be the best choice. This allows any INotifier  to trigger cursor changes with a simple notification.

-=Cliff>   
Logged
Pages: [1]
Print