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

Show Posts

| * |

  Show Posts
Pages: [1]
1  Announcements and General Discussion / General Discussion / View updates itself -- should this be avoided? on: November 11, 2009, 11:35:45
A form contains a ComboBox populated with state names.

When the selection is changed, statesCombo.selectedItem might give me:
<state>
  <name>
    alabama
  </name>
  <cities>
    <city>
      auburn
    </city>
    <city>
      birmingham
    </city>
  </cities>
</state>

So I have all the city names there which I need to now populate the citiesCombo.

I can do so within the view by simply:
citiesCombo.dataProvider = XML(statesCombo.selectedItem).cities;

but should that be avoided?

Otherwise I guess I would send a notification that is caught by the mediator (no need for a command, right?) that would be passed the state name and the mediator would do the work to get the cities? Seems unnecessary since I already have them, but...

Thoughts?
Thanks.


2  PureMVC Manifold / MultiCore Version / How to get ApplicationFacade instance 'key' for modules subcomponent on: November 02, 2009, 04:29:03
I'm thinking I've probably just had too much coffee to think straight, but, I'm using AS3 Multicore, and:
I have a module that is loaded, but then on a button click I load a subview of that module.
On creationComplete of this subview I'm trying to send a notification to call a command, but I can't figure out the best way to get the ApplicationFacade instance 'key' I used in the main component of this module.
Make sense?
3  Announcements and General Discussion / Architecture / Referencing multiple proxies from mediator??? on: September 21, 2009, 10:53:31
This seems kind of bad, but I can't think of a better solution.

I have a Proxy (GetRouteProxy) that gets a route and it's mediator (GetRouteMediator) draws that route on a map.

Then another Proxy (GetBusinessesProxy) gets a bunch of results from a search that contain businesses at certain locations. The Mediator (GetBusinessesMediator) then gets these results and needs to compare the locations against the points in the route. But, this mediator doesn't have the route. So to access it, should I create a reference from within GetBusinessesMediator to GetRouteProxy to get the route? Or...?
Thanks!
4  Announcements and General Discussion / Architecture / Handling many HTTPService calls, and waiting for all results (in order) on: September 16, 2009, 06:04:32

I'm looking for the best (or at least a good) way to handle the following:

I need to call one HTTPService many times, and wait for all the results, and put them in order.

The reason is, I have a path of coordinates, and for each I call a service to get the elevation of that point. Once I have them all I will chart them, so they need to be in order of the path.

Thanks in advance for any thoughts.
5  Announcements and General Discussion / General Discussion / Best method for caching objects created by mediator on: September 15, 2009, 03:34:11
Hello-
I'm using AS3.
I have a Proxy that calls an HTTPService and returns with a bunch of information which the Mediator uses to draw lines. This can take some time, and since the user can hide/show the lines repeatedly by clicking a button, I want to be able to show the lines immediately instead of calling the service again. And as I have it now, I don't even have access to those lines anymore because they are created on the fly in the mediator with no references remaining accessible.

Sure, I could set a flag in my ApplicationFacade, as well as an array of lines I've created, then the next time the hide/show button is clicked I could check for that and if the array exists I can set the visibility of all the items in there to the appropriate state. But I don't feel like that a very good way. It's too tight of a dependency. How would you go about this?
Thanks!
6  Announcements and General Discussion / Architecture / Implementing Command which can perform multiple tasks on: March 18, 2008, 02:23:15
Project Overview:
I have a project with a TileList containing images.

I also have a List of tag names and each tag name has a checkbox next to it.

When one or more images are selected, then a tag checkbox is clicked, I need to apply the tag to the selected image(s) if the checkbox is checked (or remove the tag from the image if the checkbox is now unchecked.)

On to the implementation:
There are a couple things I need to do this. I need to grab the selectedIndices of the TileList (so I know which ArrayCollection items to add the tag to), and I need the tag name. I then push the selected tag name into the ArrayCollection of the  selectedIndices for the collection of images.
I also have a ‘state’ property on each tagVO which I set to ‘STATE_CHECKED’ for any tag that is checked.
Obviously to remove a tag this would all be reversed.

I started out with an ApplyTagCommand, a RemoveTagCommand, etc to handle these actions. But I also do a similar thing for ‘Sets’, and ‘Groups’ which behave very similar to the Tags list. So I combined the ApplyTagCommand and RemoveTagCommand into one TagCommand to keep down the number of commands and to consolidate related code. It seemed like the right thing to do.

The question:
My question is this: What would your approach be for accessing the particular behavior you want from a command that can perform several actions? I currently have static vars in the TagCommand, ADD_TAG and REMOVE_TAG, and I’m passing either one of those in the body of the notification – the command then calls the appropriate method depending on the which static is in the notification body.
Like this:
 sendNotification( ApplicationFacade.TAG_HANDLER, TagCommand.ADD_TAG );

Does that seem okay? Would it be preferable to set the value of a public variable ‘mode’ on the Command first, then leave the notification body empty? Is there an altogether different preferred approach?

Thanks in advance, and awesome job Cliff!
-Mac

7  Announcements and General Discussion / Architecture / Handling data added by user on: March 05, 2008, 11:19:02

I have an AIR app where the user can drag and drop images from their desktop to a TileList. My current debate is where to put the logic to sort through all this data. For example, once the images are dropped on the TileList I verify that each file is of an accepted type (jpg, gif, etc), then I need to update the model (the dataProvider to the TileList).
Would you recommend doing this logic in the TileList itself, then notifying the Proxy, which would in turn update the Model? That doesn't make too much sense to me, b/c at that point I would feel like the Mediator should just update the Model directly.
Otherwise, within the View I could add all the files to an Array, then notify the Mediator which could then sort through the Array and do the verification, then update the Model.
The latter seems to make more sense but I wanted to get another opinion, and also make sure I'm not overlooking something.
Thanks!
Mac
Pages: [1]