|
|
|
[
Permlink
| « Hide
]
Deepa Subramaniam - [08/16/07 04:25 PM ]
Have spoken to Gordon about this - came up at 360. Should be fixed for Moxie.
Could you please include sample code of an app. which should compile? Thanks. Making Info. Needed.
Sending to IRB per Deepa. Gordon, could you please include files I can test with when this is fixed?
The ResourceManager wasn't designed to work outside the Flex framework. It currently relies on startup code in SystemManager to instantiate the compiled bundle classes. If we want it to work without SystemManager, I need to redesign this.
After thinking about this, I believe I can fix the problem with 1 day's work. The bug file in
Fixed with several changes culminating in 181344. A non-framework app which simply extends Sprite can now use the ResourceManager, and it only needs to compile again flex.swc to do so. For example,
package { import flash.display.Sprite; import mx.resources.IResourceManager; import mx.resources.ResourceManager; [ResourceBundle("mybundle")] public class Test extends Sprite { public function Test() { var rm:IResourceManager = ResourceManager.getInstance(); trace(rm.getString("mybundle", "whatever")); } } this case, the ResourceManager uses the autogenerated _CompiledResourceBundleInfo class (rather than the info() in the SystemManager, since there is no systemManager) to know which resource bundles to install into the ResourceManager. Did a basic verification that it works in mainline build 181415.
Injection. I've confirmed that the code in this bug works fine in build 181493 (from September), but does not work in the released build of Flex 3.0.0. It causes the error:
Error: No class registered for interface 'mx.resources::IResourceManager'. at mx.core::Singleton$/getInstance() at mx.resources::ResourceManager$/getInstance() at Test() Also, I've confirmed that the BrokenLogging.as file attached to i've uploaded files from related bugs. See Archive.zip. [hotfix candidate] Internal Review -> Opening to Gordon for 3.0.x
A workaround that has gotten me past this bug in my AS3-only application is this:
1) Ensure that your code does no initialization of Log objects before the main application's constructor runs. 2) Put the following at the top of your main application's constructor: // Do what FlexModuleFactory does, only by hand. var resourceManagerImpl:Object = flash.system.ApplicationDomain.currentDomain.getDefinition("mx.resources::ResourceManagerImpl"); Singleton.registerClass("mx.resources::IResourceManager", Class(resourceManagerImpl)); 3) Ensure that all initialization of ResourceManager-dependent classes (e.g. ArrayCollection, Logger) happens after the above code has run. I am not sure if this is the best solution, only that it works for me :-) Confirmed fixed in 3.0.x build 3.0.0.963.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||