flash actionscript:
Hi, I have 4 dynamic textfields for gender,age,weight,height and another field to display a calculation for those fields. I want to update the value (calculation) on-the-fly without pressing a "see result" button, for that purpose I made some listeners to check if the field has changed using onChange().. Everything is working perfect except the height field.. in this part I have a movieclip with buttons inside that displays values from 4'10" to 6'6". For example if I click on 5'6" that action will make my variable "ht" to assign a value of 5.6 and so on.. My big problem here is when I change the values for weight,age,gender the listener works fine but when I change the height the listener dont do the function to calculate the results... and what is more weird is if I press the "Check result" button that calls the same function that the movielcip calls too, it works fine. Why the function works pressing the button(see result button) and dont work when I choose a height? I did a test on the those buttons putting some trace actions like: // movieclip action... on(press) { ht = 5.6; checkResult(); trace("testing..."); } // button "see result" action.. on(press){ checkResult(); } Help will be very appreciate!, Ek
i don't think your listener is going to fire unless the you select the textfield and change its contents. changing its contents by changing a variable associated with that textfield probably won't work. the reason you movieclip button isn't working is because of a path problem. try: / movieclip action... on(press) { _root.ht = 5.6; // assuming ht is needed on the _root timeline and checkResult() is defined on the _root timeline _root.checkResult(); trace("testing..."); }
I was assigning the value to the variable in that way _root.ht= my value; but I didn't know that I had to do it the same way with the function too I was only using myfunction() instead of _root.myfunction(); You are my hero, Thanks a lot man!! Ek
Don't see what you're looking for? Try a search.
|