12 Replies - 15760 Views - Last Post: 29 November 2007 - 12:02 PM

#1 lodiposh   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 18-March 07

Getting dynamic text to display score and timer output in flash 8

Post icon  Posted 25 November 2007 - 12:16 AM

Hi,

I'm making a game for one of my flash classes and I cannot get the score nor the 30 second timer to display in a dynamic text box. It is a whack a mole type of game (though I'm using a hockey theme) and what I want is the 30 second countdown timer and the current # of hockey players whacked to display in a score board at the top of the screen. The actual dynamic text boxes are on the main timeline.

For the timer I have the following code attached to the text box (movie clip named theTimer):

onClipEvent (load) {
	seconds = 30;	
	time = seconds;
	running = false;
	restart = function () {
	   countdown = getTimer()+1000*seconds;
	   running = true;
	   time = seconds;
	}
}
onClipEvent (enterFrame) {
	if (running) {
		if (time == 0) {
			running = false;
			_root.play();
		} else {
		  time=Math.round((countdown-getTimer())/1000);
		}
	}
}




Main timeline has a theTimer.restart(); scritp on it.

As for the score I have a dynamic text box with var set to "hits", and the following code on a button script to keep track of number of hits:

 if (smacked) {
_root.hits++;
} 



I have smacked set to false in a frame before this code to make sure it is always reset to false before it is actually smacked. Anyway, I cannot get my display to output any of the numbers. Any help would be greatly appreciated!

thanks,
Tammy

Is This A Good Question/Topic? 0
  • +

Replies To: Getting dynamic text to display score and timer output in flash 8

#2 DilutedImage   User is offline

  • D.I.C Addict
  • member icon

Reputation: 15
  • View blog
  • Posts: 646
  • Joined: 20-November 06

Re: Getting dynamic text to display score and timer output in flash 8

Posted 25 November 2007 - 12:08 PM

Embed your fonts.
Was This Post Helpful? 0
  • +
  • -

#3 lodiposh   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 18-March 07

Re: Getting dynamic text to display score and timer output in flash 8

Posted 25 November 2007 - 08:35 PM

View PostDilutedImage, on 25 Nov, 2007 - 12:08 PM, said:

Embed your fonts.


They are embedded. Would it help to include the file?
Was This Post Helpful? 0
  • +
  • -

#4 DilutedImage   User is offline

  • D.I.C Addict
  • member icon

Reputation: 15
  • View blog
  • Posts: 646
  • Joined: 20-November 06

Re: Getting dynamic text to display score and timer output in flash 8

Posted 26 November 2007 - 11:07 AM

Yes it would; I'd be happy to take a look at it for you.
Was This Post Helpful? 0
  • +
  • -

#5 lodiposh   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 18-March 07

Re: Getting dynamic text to display score and timer output in flash 8

Posted 26 November 2007 - 11:13 PM

View PostDilutedImage, on 26 Nov, 2007 - 11:07 AM, said:

Yes it would; I'd be happy to take a look at it for you.


Thanks so much, here's the file. (I'm sending you the version without the annoying background music loop!)

Tammy
Was This Post Helpful? 0
  • +
  • -

#6 DilutedImage   User is offline

  • D.I.C Addict
  • member icon

Reputation: 15
  • View blog
  • Posts: 646
  • Joined: 20-November 06

Re: Getting dynamic text to display score and timer output in flash 8

Posted 27 November 2007 - 09:28 AM

So, where's the file? ;)
Was This Post Helpful? 0
  • +
  • -

#7 lodiposh   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 18-March 07

Re: Getting dynamic text to display score and timer output in flash 8

Posted 27 November 2007 - 10:40 AM

View PostDilutedImage, on 27 Nov, 2007 - 09:28 AM, said:

So, where's the file? ;)


Hmmm... good question. I'm using the "Add this Attachment" and it says it's sending the file, but when I go to either add reply or preview post, the attachment isn't there. Now I really feel stupid. Can't figure out my code... can't attach a file. I'm beginning to think it's a sign. :D

Any ideas why a file won't attach?

Tammy
Was This Post Helpful? 0
  • +
  • -

#8 DilutedImage   User is offline

  • D.I.C Addict
  • member icon

Reputation: 15
  • View blog
  • Posts: 646
  • Joined: 20-November 06

Re: Getting dynamic text to display score and timer output in flash 8

Posted 27 November 2007 - 02:41 PM

Odd. Are you seeing any error messages? And have you ZIP'd the file (an FLA file can't be attached)?
Was This Post Helpful? 0
  • +
  • -

#9 lodiposh   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 18-March 07

Re: Getting dynamic text to display score and timer output in flash 8

Posted 27 November 2007 - 03:02 PM

View PostDilutedImage, on 27 Nov, 2007 - 02:41 PM, said:

Odd. Are you seeing any error messages? And have you ZIP'd the file (an FLA file can't be attached)?


Yes, I did zip the file. I did not see an error message, just the sending file... message for a long long long time. Then it went back to the original post screen with no file attached. Is there a file size issue at all? My zipped file is 2.5mb. Maybe its the size.

I'm on a different computer right now, so let me try again. Cross your fingers...

Nope. No go. No error message either. Darn

thanks!
Tammy
Was This Post Helpful? 0
  • +
  • -

#10 DilutedImage   User is offline

  • D.I.C Addict
  • member icon

Reputation: 15
  • View blog
  • Posts: 646
  • Joined: 20-November 06

Re: Getting dynamic text to display score and timer output in flash 8

Posted 27 November 2007 - 04:24 PM

Very odd. I don't know of any size limit, but that certainly doesn't mean there isn't one.
Was This Post Helpful? 0
  • +
  • -

#11 DilutedImage   User is offline

  • D.I.C Addict
  • member icon

Reputation: 15
  • View blog
  • Posts: 646
  • Joined: 20-November 06

Re: Getting dynamic text to display score and timer output in flash 8

Posted 27 November 2007 - 08:11 PM

Have you set the variable values of your dynamic text boxes to "time" and "hits" (not just the instance names)?

And you might need to use _root.time or _parent.time (I'm a little rusty on pathing in AS2).
Was This Post Helpful? 0
  • +
  • -

#12 lodiposh   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 18-March 07

Re: Getting dynamic text to display score and timer output in flash 8

Posted 29 November 2007 - 11:01 AM

View PostDilutedImage, on 27 Nov, 2007 - 08:11 PM, said:

Have you set the variable values of your dynamic text boxes to "time" and "hits" (not just the instance names)?

And you might need to use _root.time or _parent.time (I'm a little rusty on pathing in AS2).



All is figured out. It was a simple change to the _sans font that finally allowed the text to display (instead of using the embedded fonts I had). All that distress for such a simple solution :) Don't ya just love it?

Thanks for all your help!
Tammy
Was This Post Helpful? 0
  • +
  • -

#13 DilutedImage   User is offline

  • D.I.C Addict
  • member icon

Reputation: 15
  • View blog
  • Posts: 646
  • Joined: 20-November 06

Re: Getting dynamic text to display score and timer output in flash 8

Posted 29 November 2007 - 12:02 PM

Sacrificing your font choice is not a solution .. . :)

There are two ways to embed fonts. You can add a font to your library and then select it, or you can embed it directly to the text field. With dynamic text fields, simply selecting an embedded font from your library will not always work. Instead, you'll need to embed your font directly to your fields. To do this, simply select your text field, then click the "Embed..." button on the lower-right of the Properties panel. A window will appear, where you can select which characters to embed. Do that for each dynamic text field.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1