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: External class  (Read 7317 times)
traced
Newbie
*
Posts: 2


View Profile Email
« 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...
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 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>   
Logged
traced
Newbie
*
Posts: 2


View Profile Email
« Reply #2 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
Logged
Pages: [1]
Print