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 / Fabrication / trap/reacTo not working (fabrication 0.6) on: January 19, 2010, 04:38:36
Hi,

I'm implementing my first Fabrication app and I'm missing something since the trap/reactTo support is not working for any of my mediators.

I've double checked (following http://code.google.com/p/fabrication/wiki/Reactions):
1. My mediator extends FlexMediator;
2. I do have a property get function at the mediator for the component I'd like to reactTo/trap (btnEntrar);
3. My reactTo method is CamelCase named with the event (Click) CamelCased as well.

[EDITED] The only difference between the sample and my application that I'm aware of is the mediator registration:
:
registerMediator(new LoginScreenMediator(app.loginScreen));I'm not able to use correctly the resolve method receiving a cast exception when I do use it:
:
resolve(application).loginScreen (and I do have the loginScreen component at the application.

If I register the event listener (commented line on onRegister method) my application works fine.

Any idea on what am I missing?

:
package icm.main.view
{
import flash.events.MouseEvent;

import icm.main.*;
import icm.main.controller.*;
import icm.main.model.*;
import icm.main.model.vo.*;
import icm.main.view.screens.*;

import mx.controls.Button;

import org.puremvc.as3.multicore.interfaces.*;
import org.puremvc.as3.multicore.utilities.fabrication.patterns.mediator.FlexMediator;

    public class LoginScreenMediator extends FlexMediator
    {
        public static const NAME:String = "LoginScreenMediator";
       
private var configProxy:ConfigProxy;
private var localeProxy:LocaleProxy;
private var authProxy:AuthProxy;

public function LoginScreenMediator( viewComponent:LoginScreen )
        {
           super( NAME, viewComponent );
}

override public function onRegister():void {
        super.onRegister();
        //btnEntrar.addEventListener( MouseEvent.CLICK, trapBtnEntrarClick );
        }

protected function get loginScreen():LoginScreen
{
            return viewComponent as LoginScreen;
        }
       
        public function get btnEntrar():Button {
                return loginScreen.btnEntrar as Button;
        }
               
        public function respondToSuccessAuth(note:INotification):void {
        sendNotification( Messages.SHOW_MAIN_SCREEN );
        }
       
        public function respondToFailedAuth(note:INotification):void {
        loginScreen.userMessagePanel.visible = true;
var msgkey:String = note.getBody() as String;
var msgcomplement:String = note.getType() as String;
var msg:String = localeProxy.getText(msgkey);
if(msgcomplement != null)
msg += " " + msgcomplement;

loginScreen.userMessage.text =  msg;
        }

public function trapBtnEntrarClick(event:MouseEvent):void
{
var user:UserVO = new UserVO();
user.username = loginScreen.txtUsuario.text;
user.password = loginScreen.txtSenha.text;

return sendNotification(Messages.LOGIN, user);
}
    }
}
2  Announcements and General Discussion / Fabrication / trap events on root component on: January 19, 2010, 02:39:34
Hi,

I'd like to use the trap/reactTo support for events on the root tag of a component. The problem is that the root tag does not allow "id" to be set. Is there anyway to use it with fabrication?

thanks
Pages: [1]