PureMVC Architects Lounge

PureMVC Manifold => Bug Report => Topic started by: shrek1628 on September 24, 2008, 09:17:26



Title: [DEFUSED] Pure MVC 2.0.4 startup and removeMeditor bugs
Post by: shrek1628 on September 24, 2008, 09:17:26
HI Cliff,

I have downloaded pure mvc 2.0.4 having read that the removeMediator bugs from previous post has been resolved.
Currently I am building a Flash base website and unfortunately I am still getting this problem.

What i am doing is :

 case ApplicationFacade.REMOVE_INTRO:
var _hasMeditor = facade.hasMediator(IntroMediator.NAME)
if(_hasMeditor){
var _med = facade.retrieveMediator(IntroMediator.NAME) as IntroMediator ;
facade.removeMediator(_med);
}
break;

When  ApplicationFacade.REMOVE_INTRO is called again from ApplicationMediator the _hasMeditor always results in true. Am I doing something wrong here.

Also i am experiencing problems with being able to add a preloader when ApplicationFacade.STARTUP: is tracked within ApplicationMediator.

I didn't have this problem with 2.0.3

Thanks in advance for any insight you can provide.

Shrek1628


Title: [DEFUSED] Pure MVC 2.0.4 startup and removeMeditor bugs
Post by: puremvc on January 14, 2009, 01:49:09
Sorry, this post somehow slipped through the cracks. This is not a bug in the framework, you're just calling removeMediator with the wrong arguments.

If you look at the docs for removeMediator:
http://puremvc.org/pages/docs/AS3/standard/framework_asdoc/org/puremvc/as3/patterns/facade/Facade.html#removeMediator() (http://puremvc.org/pages/docs/AS3/standard/framework_asdoc/org/puremvc/as3/patterns/facade/Facade.html#removeMediator())

You'll see that the method takes a String mediatorName, not a mediator instance. The point is you don't have to retrieve it to remove it. You can just remove it by name.

So instead of:
:
case ApplicationFacade.REMOVE_INTRO:
     var _hasMeditor = facade.hasMediator(IntroMediator.NAME)
     if(_hasMeditor){
        var _med = facade.retrieveMediator(IntroMediator.NAME) as IntroMediator ;
        facade.removeMediator(_med);
     }
     break;
do this:
:
case ApplicationFacade.REMOVE_INTRO:
     if facade.hasMediator(IntroMediator.NAME) {
         facade.removeMediator(IntroMediator.NAME);
     }
     break;

Again, sorry for missing this one.
-=Cliff>