Hi, i just stumbled upon a weird behavior when i tried to inject a
bean property. I get the following error :
Error: InjectionProcessorError: bean not found:
applicationModel.version. It seems i cannot acces my bean with its ID.
On BeanProvider initialization, setBeanIds doesn't find the bean's id
i wrote in my bean declaration.
I find this very disturbing since it's a basic feature, my guess is i
must be doing something wrong but i can't find what it is. I'd
appreciate some help ^^
Here are peaces of code that produce the error :
--------------------------------------------------------------------------------
code : NamedBean.mxml
--------------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="
http://www.adobe.com/2006/mxml"
xmlns:swiz="
http://swiz.swizframework.org"
xmlns:models="models.*"
xmlns:local="*">
<mx:Script>
<![CDATA[
import mx.events.FlexEvent;
]]>
</mx:Script>
<swiz:Swiz>
<swiz:config>
<swiz:SwizConfig setUpEventType="{FlexEvent.PREINITIALIZE}"/>
</swiz:config>
<swiz:beanProviders>
<swiz:BeanProvider>
<models:ApplicationModel id="applicationModel"/>
<local:SomeBean/>
</swiz:BeanProvider>
</swiz:beanProviders>
</swiz:Swiz>
</mx:WindowedApplication>
--------------------------------------------------------------------------------
code : SomeBean.as
--------------------------------------------------------------------------------
public class SomeBean
{
[Inject("applicationModel.version")]
public var appVersion:String;
}
--------------------------------------------------------------------------------
code : ApplicationModel.as
--------------------------------------------------------------------------------
import flash.desktop.NativeApplication;
[Bindable]
public class ApplicationModel implements IApplicationModel
{
private var _version:String;
public function get version():String
{
return _version;
}
public function set version(val:String):void
{
_version = val;
}
public function ApplicationModel()
{
var appXml:XML =
NativeApplication.nativeApplication.applicationDescriptor
var ns:Namespace = appXml.namespace();
version = appXml.ns::version;
}
}
--------------------------------------------------------------------------------
code : IApplicationModel.as
--------------------------------------------------------------------------------
[Bindable]
public interface IApplicationModel
{
function get version():String;
function set version(val:String):void;
}