[flexcoders] Re: Using @Resource directive with Moxie

2007-09-13 Thread kramus0
Thanks for your help. 

It has nothing to do with Cairngorm because I could reproduce it even
using just a component with an on namespace and a simple class. So I
have filled a bug report with that now.

Using the binding expression didn't solve the problem but adding the
extra script code to get the resourceManager worked.

So, thanks again

Markus


--- In flexcoders@yahoogroups.com, Gordon Smith [EMAIL PROTECTED] wrote:

 In Flex 2, the @Resource(...) directive autogenerated code to access
 resources directly from a ResourceBundle instance. In Flex 3, it
 autogenerates code to access them through a new ResourceManager. The
 general policy is to always access resources through the ResourceManager
 as the central repository for all resources, so that there is only one
 instance of each bundle and so that the locale can be switched at
 runtime.
  
 In Flex 3, base classes like UIComponent, Formatter, and Validator now
 have a resourceManager property to make the @Resource directive work,
 but Cairngorm's ServiceLocator doesn't have such a property.
  
 Try adding
  
 mx:Script
 
 import mx.resources.IResourceManager;
 import mx.resources.ResourceManager;
  
 private var resourceManager:IResourceManager =
 ResourceManager.getInstance();
  
 /mx:Script
  
 and see whether that makes the compiler happy. If that doesn't work, try
 using a binding expression like
  
 url={ResourceManager.getInstance().getString('myServiceBundle',
 'myServiceUrl')}
  
 instead of
  
 url=@Resource(...)
  
 But please file this as a bug at http://bugs.adobe.com/flex
 http://bugs.adobe.com/flex . We should probably make the MXML compiler
 autogenerate a resourceManager property if necessary so that
 @Resource(...) will work in any class.
  
 - Gordon
 
 
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of kramus0
 Sent: Wednesday, September 12, 2007 9:56 AM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Re: Using @Resource directive with Moxie
 
 
 
 Hi again, 
 
 maybe it is just a simple namespace problem. I am using Cairngorm and
 so I have a different namespace for my ServiceLocator where I use the
 HTTPService. Here an other code snippet. 
 
 Thanks for your help.
 
 Markus
 
 ?xml version=1.0 encoding=utf-8?
 
 cairngorm:ServiceLocator
 xmlns:mx=http://www.adobe.com/2006/mxml
 http://www.adobe.com/2006/mxml  
 xmlns:cairngorm=http://www.adobe.com/2006/cairngorm
 http://www.adobe.com/2006/cairngorm 
 
 mx:HTTPService id=myService url=@Resource(key='myServiceUrl',
 bundle='myServiceBundle')/
 
 The compiler error is on the last line, where it tries to allocate the
 Resource. Like I said in the 2.0.1 SDK that was fine.
 
 --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
 , kramus0 kramus0@ wrote:
 
  Hi, 
  
  when I use the 2.0.1 SDK I can use a localized value for the url in a
  HTTPService and it would look like this:
  
  mx:HTTPService id=myService url=@Resource(key='myServiceUrl',
  bundle='myServiceBundle')/
  
  But when I try to compile the same code with the Moxie SDK I get an
  error that basically says:
  
  Error: Try to access a not defined property resourceManager. 
  
  (My actual error message is in german language: Error: Zugriff auf
  eine nicht definierte Eigenschaft resourceManager.)
  
  So, what is going wrong? Did anyone have the same problem?
  
  Thanks, Markus
 





[flexcoders] Re: Using @Resource directive with Moxie

2007-09-12 Thread kramus0
Hi again, 

maybe it is just a simple namespace problem. I am using Cairngorm and
so I have a different namespace for my ServiceLocator where I use the
HTTPService. Here an other code snippet. 

Thanks for your help.

Markus


?xml version=1.0 encoding=utf-8?

cairngorm:ServiceLocator
xmlns:mx=http://www.adobe.com/2006/mxml; 
xmlns:cairngorm=http://www.adobe.com/2006/cairngorm;

mx:HTTPService id=myService  url=@Resource(key='myServiceUrl',
bundle='myServiceBundle')/



The compiler error is on the last line, where it tries to allocate the
Resource. Like I said in the 2.0.1 SDK that was fine.




--- In flexcoders@yahoogroups.com, kramus0 [EMAIL PROTECTED] wrote:

 Hi, 
 
 when I use the 2.0.1 SDK I can use a localized value for the url in a
 HTTPService and it would look like this:
 
 mx:HTTPService id=myService
 url=@Resource(key='myServiceUrl',
 bundle='myServiceBundle')/
 
 But when I try to compile the same code with the Moxie SDK I get an
 error that basically says:
 
 Error: Try to access a not defined property resourceManager. 
 
 (My actual error message is in german language: Error: Zugriff auf
 eine nicht definierte Eigenschaft resourceManager.)
 
 So, what is going wrong? Did anyone have the same problem?
 
 Thanks, Markus





RE: [flexcoders] Re: Using @Resource directive with Moxie

2007-09-12 Thread Gordon Smith
In Flex 2, the @Resource(...) directive autogenerated code to access
resources directly from a ResourceBundle instance. In Flex 3, it
autogenerates code to access them through a new ResourceManager. The
general policy is to always access resources through the ResourceManager
as the central repository for all resources, so that there is only one
instance of each bundle and so that the locale can be switched at
runtime.
 
In Flex 3, base classes like UIComponent, Formatter, and Validator now
have a resourceManager property to make the @Resource directive work,
but Cairngorm's ServiceLocator doesn't have such a property.
 
Try adding
 
mx:Script

import mx.resources.IResourceManager;
import mx.resources.ResourceManager;
 
private var resourceManager:IResourceManager =
ResourceManager.getInstance();
 
/mx:Script
 
and see whether that makes the compiler happy. If that doesn't work, try
using a binding expression like
 
url={ResourceManager.getInstance().getString('myServiceBundle',
'myServiceUrl')}
 
instead of
 
url=@Resource(...)
 
But please file this as a bug at http://bugs.adobe.com/flex
http://bugs.adobe.com/flex . We should probably make the MXML compiler
autogenerate a resourceManager property if necessary so that
@Resource(...) will work in any class.
 
- Gordon



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of kramus0
Sent: Wednesday, September 12, 2007 9:56 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Using @Resource directive with Moxie



Hi again, 

maybe it is just a simple namespace problem. I am using Cairngorm and
so I have a different namespace for my ServiceLocator where I use the
HTTPService. Here an other code snippet. 

Thanks for your help.

Markus

?xml version=1.0 encoding=utf-8?

cairngorm:ServiceLocator
xmlns:mx=http://www.adobe.com/2006/mxml
http://www.adobe.com/2006/mxml  
xmlns:cairngorm=http://www.adobe.com/2006/cairngorm
http://www.adobe.com/2006/cairngorm 

mx:HTTPService id=myService url=@Resource(key='myServiceUrl',
bundle='myServiceBundle')/

The compiler error is on the last line, where it tries to allocate the
Resource. Like I said in the 2.0.1 SDK that was fine.

--- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
, kramus0 [EMAIL PROTECTED] wrote:

 Hi, 
 
 when I use the 2.0.1 SDK I can use a localized value for the url in a
 HTTPService and it would look like this:
 
 mx:HTTPService id=myService url=@Resource(key='myServiceUrl',
 bundle='myServiceBundle')/
 
 But when I try to compile the same code with the Moxie SDK I get an
 error that basically says:
 
 Error: Try to access a not defined property resourceManager. 
 
 (My actual error message is in german language: Error: Zugriff auf
 eine nicht definierte Eigenschaft resourceManager.)
 
 So, what is going wrong? Did anyone have the same problem?
 
 Thanks, Markus