I am creating an interface that has a few different states for the different steps. For those steps, there is data that I am pulling in from a database to fill certain fields.
As of right now I am doing one db query to get all of the data back and want to fill in all of the fields at the same time but it is giving me "access to a null object reference".
It seems as though there is a scope issue when you are trying to access a text input field with actionscript when the state that the text input is in, isn't the current state.
Is there any way around this?
For Example (This would throw a "Null object reference" error):
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
creationComplete="init()">
<s:states>
<s:State name="State1"/>
<s:State name="state2"/>
</s:states>
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
protected function init(event:FlexEvent):void
{
ti_test.text = "Hello World";
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:TextInput id="ti_test" includeIn="state2" x="323" y="197"/>
</s:Application>