|
|
Show Posts
|
Pages: [1]
|
2
|
Announcements and General Discussion / General Discussion / Re: Call a Command Every Frame
|
on: July 15, 2009, 12:39:55
|
I was thinking just a mediator would be fine, but I was trying to use the MVC framework pretty much just to learn the thing. But my concern then was that there would be logic inside the mediator, I didn't think this was proper. For instance, assume that the box has properties like minimum width or a maximum boundary. During the resize, I would need to perform logic that constrains the resizing to these areas. I would think that that type of logic would traditionally be inside a controller object.
I guess it would be fine if the mediator can communicate directly with the proxy, to reference it's minimum maximum properties, is this proper?
|
|
|
3
|
Announcements and General Discussion / General Discussion / Re: Call a Command Every Frame
|
on: July 14, 2009, 01:20:32
|
Well I was just messing around with having a box that the user could scale. The proxy holds the data of the width and height of the box. On mouse move, the mouse position is sent to the command, the command figures out what the new size of the box should be, updates the proxy, and tells the mediator how to visually represent the new box size.
The mediator I'm using is 'long-lived,' in that it is my main module mediator. I'm just not sure what's going on under the hood when I send a notification every frame that is mapped to a command. Is the command actually created on every call?
|
|
|
7
|
Announcements and General Discussion / Getting Started / Re: Loading Module Multiple Times Error
|
on: July 11, 2009, 07:03:58
|
Sorry for not being clear.
The way I understood modules is that I could have a module, let's say WindowModule (it makes a user interface window on the screen).
Every time I want to instantiate a new window I would load a new WindowModule. Is this not correct?
I have considered an alternative that might be the correct way where a Module is only loaded once and is used more as a Factory. For instance, you would have 1 WindowFactory per application, and therefore wouldn't need to load the Module twice.
I guess if you could let me know which one is the preferred use of MultiCore, because both will work.
|
|
|
8
|
Announcements and General Discussion / Getting Started / Re: Loading Module Multiple Times Error
|
on: July 10, 2009, 11:36:32
|
I can get around the problem by adding getTimer() to the initialization name/key. But that seems hacky, also I don't know if that will cause problems later.
I know I must be doing something wrong elsewhere because other people are obviously getting this to work loading the same module multiple times. It seems like the two modules should have different multiton keys no?
|
|
|
9
|
Announcements and General Discussion / Getting Started / Re: Loading Module Multiple Times Error
|
on: July 10, 2009, 10:21:58
|
Hmm tried it and it's still giving me the error. I guess since it's two separate SWFs using the same class, they are actually treated as separate classes. Changing the static variable moduleCount applies to the first module, but then when the second module loads it starts over since it's a new class. Maybe there is a problem with my getInstance function, I read in one of the many tutorials I've gone through to write it as such:
public static function getInstance( key:String ) : ApplicationFacade { trace("getInstance " + key ); if ( instanceMap[ key ] == null ) instanceMap[ key ] = new ApplicationFacade( key ); return instanceMap[ key ] as ApplicationFacade; } But maybe that's not right.
Oh I should probably add that I'm using AS3 (no flex modules) so I'm just extending Sprite class for my module and the facade just extends Facade and implements IFacade.
I've also tried changing the code to:
return ApplicationFacade( instanceMap[ key ] ); which gives the following error:
The error I get is:
Type Coercion failed: cannot convert com.scisci.mvc.modules.inspector::ApplicationFacade@3b94de81 to com.scisci.mvc.modules.inspector.ApplicationFacade.
|
|
|
10
|
Announcements and General Discussion / Getting Started / Loading Module Multiple Times Error
|
on: July 10, 2009, 09:45:25
|
Hi, I have a module that represents a gui 'window'. Each time I need a new window I was thinking of loading a new window module and adding it to some container. However, I have hit an error. The first module load is fine, however on subsequent module loads of the same file, the getInstance method returns a null value error. I'm guessing because the NAME of the module has already been registered in the instanceMap even though it is actually a different module.
Is there a way around this? Or is the best practice not to load multiple instances of the same module. Maybe I should rewrite the module so instead of being used for just one window instance, it handles ALL window instances of that type. That way when I need a new window I just tell that module to generate a new window view internally and not load a whole new module .swf.
Thanks for any tips,
Dan
|
|
|
11
|
Announcements and General Discussion / Architecture / Re: Windowing Architecture
|
on: July 08, 2009, 12:04:58
|
OK that's starting to make sense now. I have another very basic question now though ![:)](http://forums.puremvc.org/Smileys/default/xsmiley.gif.pagespeed.ic.R8GFI-pF6f.png) . Maybe I should move to the getting started forum. I have a button in my viewComponent that should create a window with some content in it. In the examples I have seen, the Loaders for modules have always gone into the viewComponent file ( I guess since they are display objects ). The problem I was running into with having the Loaders be in the view component is that, I would create the window module in the view component via a Loader then dispatch an event that it was initialized. The mediator would then receive that event but it wouldn't have a specific reference to which Loader was loaded without creating a custom event, which should be unnecessary with notificaitons. However, it seems to make sense to me that the viewComponent should only dispatch an event to the Mediator that a module should be loaded. Then the mediator can create a loader and load the module. Is this an OK way to do it? That way the mediator has a reference to the module and can pass it on in Notifications and things.
|
|
|
12
|
Announcements and General Discussion / Architecture / Re: Windowing Architecture
|
on: July 07, 2009, 02:47:16
|
Yes, I am aware of this. The only reason I guess I fall back to that is that it seems like the Shell would be the only place that is 'AWARE' of the configuration of modules since they should be unaware of eachother.
One place I'm confused is this:
I have a module listening for a message of type ADD_WINDOW. The ADD_WINDOW constant is stored in this module's constants file or application facade. If I had another module connected somewhere else in the application that should open a new window without going through the shell, that second module would have to refer specifically to the constants file of the first module breaking the generic usability of it. That's why traditionally I would send a message to the shell, then the shell would send a message out. I'm kind of stating this just so you will tell me how to do this correctly. I don't like sending everything through the shell, but it seems kind of necessary if all modules are independent and can't specifically target eachother.
|
|
|
13
|
Announcements and General Discussion / Architecture / Windowing Architecture
|
on: July 07, 2009, 11:59:11
|
Hi, I'm doing my first MVC project as a test of the framework, keeping in mind some projects in the future. I still don't fully understand the flow/where to put everything (especially with pipes) but I'm getting there.
The project I'm starting with is to create a basic windowing setup similar to an OS allowing for dragging, resizing, opening and closing the content of these windows. I want to use the Multicore functionality of PureMVC. At first I was thinking of making a WindowModule, and then the shell would load in a window module every time it needs to create one. This would work fine, however, I then realized I'd need to manage these windows somehow, for instance if the user wanted to cascade, resize, them or something, or just to enforce boundaries and theings on the windows, so I then thought I would need a WindowContainerModule. What I'm having trouble with is the communication between these elements, and if this is actually how it should be done.
This is what I was thinking: 1) The shell would take a button click to open a new window. 2) It would then pipe a message to the WindowContainerModule to create a new window. 3) The WindowContainerModule would load a WindowModule 4) Certain messages in the WindowModule would then be piped to the WindowContainerModule, while other messages would need to be piped all around the application to any possibly interested party ( I guess mainly to the shell which would then handle the logic ).
Does this sound right? I'm separating WindowContainerModule from WindowModule to allow for multiple types of window modules, like a notepad or a traditional window, etc.
Anyway I realize it can be done a number of ways, but I'm currently at a loss for how to setup the piping channels. I've followed the HelloPipes tutorial so I can get the shell to talk to a sub-module, but I'm not sure how to get The windowContainerModule to talk to the other modules. I guess I can just treat the WindowContainerModule as if it is a shell of sorts and have it talk to it's submodules with a TEE-SPLIT and a TEE-MERGE, but then it would also need a pipe that goes back to the main shell.
I'm obviously out of my element, but if there is anything that I'm obviously going astray about, let me know, or maybe there is an example of a pipes windowing system already?
|
|
|
|
|