Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Welcome, Guest. Please login or register.
April 26, 2017, 08:14:27 PM
Home Help Search Login Register
News: ATTENTION: Spambots must die! Humans must visit http://contact.futurescale.com to request forum access.
Pages: [1]
Print
Author Topic: Questions about Facade (Issue 25)  (Read 2299 times)
piotrzarzycki
Newbie
*
Posts: 5


View Profile WWW Email
« on: September 30, 2010, 03:02:12 AM »

If you whant register on forum you must write email with reason of registration.
Link to contact form: http://futurescale.com/v3/company/contact-us --> Select "Request Access to Futurescale-operated Forums"

To solve your problem you can use Custom dependencies mechanism -> http://code.google.com/p/fabrication/wiki/CustomDependencies.

Code: (mxml)
<fabrication:DependenciesProvider xmlns:fx="http://ns.adobe.com/mxml/2009"
                         xmlns:fabrication="http://puremvc.org/utilities/fabrication/2010">
    <fx:Object id="userVo"
               userVo=""/>
</fabrication:DependenciesProvider>

In Main application override properties:

Code: (as)
override public function get dependencyProviders():Array
{
    return super.dependencyProviders.concat([LoggedUserProvider]);
}

When user login to your application by proxy class (I assume you use proxy to login user) you can modify dependency provider object:

Code:
public class LoginProxy extends FabricationProxy
{
//---------------------------------------------------------------
// <------ PUBLIC CONSTS ------>
//---------------------------------------------------------------
//{
public static const NAME:String = "LoginProxy";
//}
//---------------------------------------------------------------
// <------ CTOR ------>
//{
public function LoginProxy(data:Object=null)
{
super(NAME, data);
}
//}
//---------------------------------------------------------------
// <------ PUBLIC & PRIVATE PROPERTIES ------>
//{
[Inject("userVo")]
public var userObj:Object;
//}
//---------------------------------------------------------------
// <------ PUBLIC METHODS/OVERRIDE ------>
//{
public function loginUser(email:String, password:String):void
{
var userVo:UserVo = new UserVo("Piotr", "Z", email);
//modify provider
userObj.userVo = userVo;
}
//}
}

Whenever you whant use logged user in your fabrication actors Command, Mediator or Proxy you just create property:

[Inject("userVo")]
public var userVo:Object;

I hope it help. Wink

Logged
Pages: [1]
Print
Jump to: