Hi,
I have some difficulties with SAS and Autowiring in my project.
I use: Flex 4 Final, Flashbuilder 4 final, SAS 1.0-RC1. My view contains of spark components whereever spark components are available.
If I try to use Autowiring in my Main.mxml (root application) I can see in the debug that the member variable is autowired.
But if I try to do so with a component ( Flashbuilder -> New -> Component ) which is somewhere deep in my package structure, no Autowiring is done.
My basic idea is to use the IOperation pattern to build services which can be easily injected into the PresentationModels.
What I've done so far:
used compiler option -keep-as3-metadata += Autowired
put the defaultAutowiringStageProcessor in my application context
defined my PresentationModel in application contextCode:<object id="defaultAutowiringStageProcessor" class="org.springextensions.actionscript.stage.DefaultAutowiringStageProcessor"/>
defined autowired member variableCode:<object id="userViewPM" class="de.test.presentation.usermanagement.UserViewPresentationModel" depends-on="userService"> <property name="userService" ref="userService" /> </object>
Is my approach totally wrong?Code:<?xml version="1.0" encoding="utf-8"?> <s:VGroup xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx"> <fx:Declarations> <!-- Platzieren Sie nichtvisuelle Elemente (z.*B. Dienste, Wertobjekte) hier --> </fx:Declarations> <fx:Script> <![CDATA[ [Autowired] [Bindable] public var pm:UserViewPresentationModel; ]]> </fx:Script> <s:Group width="100%"> <s:Label text="Search" /> <s:TextInput id="inputSearch" /> <s:Button label="search" click="{pm.findUsers(inputSearch.text)}" /> <s:layout> <s:HorizontalLayout /> </s:layout> </s:Group> <mx:DataGrid width="100%" height="100%" dataProvider="{pm.userList}"> <mx:columns> <mx:DataGridColumn headerText="name" dataField="name" /> </mx:columns> </mx:DataGrid> </s:VGroup>
Regards,
Christoph


Reply With Quote
