13 Replies Latest reply on Apr 20, 2009 1:07 PM by hkpadobe

    Not able to get the data from variables contained in more than 1 mxml file

    hkpadobe Level 1

      I have got 5 Bindable Public integer variables in total in 5 mxml files (Pages). Each variable is assigned it's value in a Public function in each of the mxml files.

      What I need to do is add up the values of the 5 variables. The way I approached this was to create a public function add5Variable in my main mxml file (Page1) as shown below.



      public var varTotal:int = 0;










      varTotal = (variableP1 +

      Page2.variableP2 + Page3.variableP3 + Page4.variableP4 + Page5.variableP5);






      I have got a TextInput field on Page5 where I display the varTotal. The function add5Variable is called when moving from Page to Page.


      The results I am getting is that the varTotal will always be the value of variableP1. When I tried some debugging in Flex Builder it showed me that the other 4 variables had a value of 0.


      Why is this the case and do you have any suggestions on how I can get the correct total for varTotal?



      function add5Variable():int {