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: [DEFUSED] Pure MVC 2.0.4 startup and removeMeditor bugs  (Read 6876 times)
shrek1628
Newbie
*
Posts: 2


View Profile Email
« 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
« Last Edit: January 14, 2009, 01:49:36 by puremvc » Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 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()

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>
Logged
Pages: [1]
Print