|
Mailing Lists
|
Home / Groups / Adobe Flex
passing a variable value from a component to the main applicationhi , I have a flex application with one component . in that component I have defined a variable named "correctUsername" . after I click a button in the component I give a value to the correctUsername variable . and I want to have that value in my main application . but seems I can't do it in a way I'm doing it . the code is as below : my component is named "signIn" ------------------------- ..... <!-- signIn component --> <fx:script> public var correctUsername:String; ..... public function submitLogin():void{ correctUsername = "ok"; } ... </fx:script> ..... <s:Button label="myBtn" click="submitLogin()"/> --------------------------- --------------------------- my main application: .... <!-- my main application --> <fx:script> public var testSign:signIn; public funtion btnClick():void{ testSign = new signIn(); testInput.text = testSign.correctUsername; } </fx:script> .... <components:signIn id="myComponent"/> <s:TextInput id="testInput"/> <s:Button label="btn" click="btnClick()"/> ------------------------------------------ ------------------------------------------ anyone knows where the problem is? the thing that has mixed me up is that if I give the value of correctUsername variable in my component outside of any funtions it works fine and my main application shows the value correctly , but if I give it value inside any functions the main application doesn't show the value . I'll be appreciated if you can help me with this . |
June 18, 2013
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||