SitePoint Sponsor

User Tag List

Results 1 to 1 of 1
  1. #1
    SitePoint Member
    Join Date
    May 2005
    0 Post(s)
    0 Thread(s)

    Angry Moock's VirtualPet - TextField Update not working


    I've followed Colin Moock's AS3 notes to create a VirtualPet
    I've got it working from the code at:

    ...but am now trying to add a textField on the stage that will display the % of calories remaining.

    Extra code I have created in
    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
    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 attached.
    Attached Files Attached Files

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts