SitePoint Sponsor

User Tag List

Results 1 to 1 of 1

Threaded View

  1. #1
    SitePoint Member
    Join Date
    May 2005
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Angry Moock's VirtualPet - TextField Update not working

    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 attached.
    Attached Files Attached Files


Tags for this Thread

Bookmarks

Posting Permissions

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