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 / Re: View updates itself -- should this be avoided? on: November 13, 2009, 10:07:22
So helpful Cliff, thanks. I'm slowly but surely "getting it".
2  Announcements and General Discussion / General Discussion / Re: View updates itself -- should this be avoided? on: November 11, 2009, 03:37:35
Is the question whether the XML should be defined in the view?

Not exactly. My StatesMediator binds the statesArray to the comboBox. The comboBox then displays just the state names. But since I bound the full XML (including the cities for each state), I can get the cities for the selected state within the view by simply saying:

citiesCombo.dataProvider = XML(statesCombo.selectedItem).cities.city as XMLList;

So, my question is: is it bad to be doing that work on the data within the view, or should I implement something else so that the mediator tells the citiesCombo what it's data should be?

Hopefully that's more clear.
Thanks, all.
3  Announcements and General Discussion / General Discussion / Re: Puremvc book on: November 11, 2009, 11:48:22
I was thinking even if you simply packaged up the docs and used something like Lulu.com to make a bound version available. These are the kinds of docs I read and reference enough that for a reasonable amount I'd buy a bound copy to have around.
4  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.


5  PureMVC Manifold / MultiCore Version / Re: How to get ApplicationFacade instance 'key' for modules subcomponent on: November 02, 2009, 08:02:59
So basically I'm performing a deferred instantiation in Multicore. I came up with a solution, let me know how this sounds.

My modules' ApplicationFacade defines a custom event string:

public static const EVENT_INITIALIZE_PANEL:String   = "eventInitializePanel";

Then MainMediator for the module listens for a button to be clicked, and when it handles that notification, it registers the new proxy and mediator in there because I have the access to the main facade. Then it sends a notification which calls a command to get the data to populate the new view component.

I was previously trying to send the notification that calls the command to populate the data of the new view from within the creationComplete handler, but I didn't have access to 'facade'.

I think this makes sense, and is an acceptable way to handle this problem, but at the same time it seems weird that sub views of the module would never reference 'facade' -- meaning that the root component/mediator would hold all these references.

Thoughts?
6  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?
7  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!
8  Announcements and General Discussion / Architecture / Re: Handling many HTTPService calls, and waiting for all results (in order) on: September 17, 2009, 11:25:30
Thanks guys.
Okay, I'm trying to use Loadup Util.

Once I get the path, I call LoadElevationCommand with a 'directions' object.

Because I need to put the results in order after they are retrieved, I have created a Proxy that does nothing but hold an array of 'points' created by the LoadElevationCommand from the 'directions' object.

Then when each call comes back to the mediator I check the 'point', find that 'point' in the array stored by the proxy, and set the elevation property. Then on Loadup.LOADING_COMPLETE I can do what I wish with all the results.

Does that makes sense, or am I over-complicating it?
9  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.
10  Announcements and General Discussion / General Discussion / Re: Best method for caching objects created by mediator on: September 15, 2009, 04:55:41
It looks like after some more searching I found my answer...
http://forums.puremvc.org/index.php?topic=724.0

I'll give it a shot and report back if I still have questions.
11  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!
12  Announcements and General Discussion / Architecture / Re: Implementing Command which can perform multiple tasks on: March 18, 2008, 03:39:02
Thanks Cliff-
 Is that the idea behind the 'type' parameter? Are there other ways you see if may be used frequently?
Mac
13  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

14  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]