A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Need help with code

  1. #1
    Junior Member
    Join Date
    Dec 2013
    Posts
    2

    Need help with code

    This is the part of my code that dosn't work. I have buttons that add to myGold and myHP but when i add to them and this event is trying to update my counters(that is 2 string objects that are visble on the screen) it only updates the text in strings the numbers myGold and myHP dosn't show up.

    addEventListener(Event.ENTER_FRAME, updatecounters);

    function updatecounters(event:Event)
    {
    goldCounter.text = String("My Gold = " + myGold);
    HPCounter.text = String("My Hp = " + myHP);
    }

  2. #2
    Junior Member
    Join Date
    Dec 2013
    Location
    Indiana
    Posts
    5
    Perhaps numerals were not embedded for your two text fields. This can be solved by going to the properties of the text fields and clicking on the "embed" button. A window should appear labeled "Font Embedding". Under "Character Ranges" check numerals and click "OK".

    Cheers,
    Drake Swartzy

  3. #3
    Registered User
    Join Date
    Dec 2013
    Posts
    1
    where do i go to get a swf file for a gchats and its for sking 3.o1 g chat

  4. #4
    Senior Member
    Join Date
    Nov 2012
    Posts
    106
    Drake is right about embedding your fonts... Without numbers available in your dynamic textbox, the numbers will not appear.

    When something like this happens to me, I always go back and check basics-
    Do you have text fields set to Dynamic Text?
    Do they have correct instance names?
    Are the fonts embeded?
    Are my variables being updated like i expected? check using trace statements trace(myGold, myHP)

    Instead of an ENTER_FRAME, why not just call the function inside your button Functions? This way Flash only needs to update when the values change. Delete your addEventListener, and place:
    updatecounters(); inside your button functions.

    Be Blessed.

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center