PureMVC Architects Lounge

Announcements and General Discussion => General Discussion => Topic started by: traced on July 12, 2008, 01:55:54



Title: External class
Post by: traced on July 12, 2008, 01:55:54
Hi all,

I need some help about using external classes to the framework:

I have a helper class that I use to connect to the database with amfphp 1.9. I need to retrieve a proxy property within that class. I import the following classes:

   import org.puremvc.as3.interfaces.IProxy;
   import org.puremvc.as3.patterns.proxy.Proxy;
   import org.puremvc.as3.patterns.facade.*;
   import com.xyz.project.ApplicationFacade;
   import com.xyz.project.model.ConfProxy;

and within the class I call the proxy:

   private var _confProxy:ConfProxy;

   public function amfWrapper():void {
      _confProxy = facade.retrieveProxy( ConfProxy.NAME ) as ConfProxy;
      gatewayURL = _confProxy.amfphp_gateway;
   }

As the helper class is not a proxy, the facade is not implemented and I have the following error:

   1120: Access of undefined property facade

What is the right way to retrieve proxy or mediator properties within an external class?

Many thanks for your help...


Title: Re: External class
Post by: puremvc on July 12, 2008, 04:37:48
You have to retrieve the facade first.

var facade:MyFacade = MyFacade.getinstance();

That assumes you are using the standard version. With multicore your class will need to know the multiton key.

-=Cliff>   


Title: Re: External class
Post by: traced on July 13, 2008, 11:49:13
Many thanks Cliff... That was the issue (should have find it by myself, sorry...)

As my facade is called ApplicationFacade, the correct code is:

var facade:ApplicationFacade = ApplicationFacade.getInstance();

Best regards,

Oliver