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: registering Commands in different SWFs (Flash)  (Read 3208 times)
rpereira
Newbie
*
Posts: 1


View Profile Email
« on: March 13, 2008, 07:49:29 »

Hi!

Building a website with PureMVC.

My question regards best practices.

Due to size requirements I need to put code regarding a section of the website in the swf that corresponds to that section. If someone wants to see the news everything related to news is in the called on the news.fla

When the news.swf is loaded into the main Application I call the facade and instantiate Mediators, Proxies and Commands.

I all works beautifuly.

If I navigate into another portion of the website and return to news the commands are executed twice (or the number of times I have loaded the news.swf)

I managed to remove the mediators and proxies on unload of the news swf but I cannot remove the commands without digging into the framework.

Solutions I've come up with:

1. I could register the commands on the facade but it seems reasonable that the main swf does not need to instantiate everything when only a portion is needed.

2. I can also create a util singleton and flag the commands registered so they don't get registered again.

3. I also noted that Controller has a method removeCommand but I don't see it beeing used anywhere and through the facade I don't have access to it. Maybe one could be implemented

Any help on how this should be done would be greatly appreciated.

Thank you very much for PureMVC
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: March 13, 2008, 11:20:14 »

Hi,

This is a known issue, and will be fixed in the next release of the Standard version. See the bottom of the Release Notes here: http://trac.puremvc.org/PureMVC_AS3/wiki/ReleaseNotes.

However, you might want to do some experimentation with the MultiCore Version.

It allows each SWF or Flex Module to have its own set of MVCF actors (a 'Core'). You will not have to remove all the Commands, Mediators and Proxies when you unload a SWF. You can remove the entire PureMVC Core for the swf by doing facade.removeCore().

-=Cliff>

Logged
Pages: [1]
Print