Hi...
I've followed Colin Moock's AS3 notes to create a VirtualPet
I've got it working from the code at: http://www.adobe.com/devnet/actionsc...n_moock_f6.pdf
...but am now trying to add a textField on the stage that will display the % of calories remaining.
Extra code I have created in VirtalPet.as:
1. private var petView (An instance of VirtualPetView)
2. petView.displayInfo() (Called from the digest() method, which is called by the Timer every second)
Extra code I have added in VirtualPetView.as:
1. The method, displayInfo()
2. The method, createTextField(whichField:TextField, x:Number, y:Number, align:String, size:Number, color:Number, bold:Boolean)
3. The textField calories_txt, created in VirtualPetView by the above method.
The problem:
It displays correctly at first: "50% remaining". However there is no change to the textField content after that, as the VirtualPet becomes more and more hungry.
The method which should update the textField is called displayInfo(), and is definitely being called, as a trace action within the function is working properly, giving the correct value of remaining calories.
Please see the source code in the zip file at: http://www.adamfrost.net/problems/Moock_VirtualPet.zip