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: Questions about Facade (Issue 25)  (Read 2792 times)
piotrzarzycki
Jr. Member
**
Posts: 11


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

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.

: (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:

: (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:

:
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. ;)

Logged
Pages: [1]
Print