ofranko
11-15-2010, 02:06 PM
i've written a small app for kids....i'm now trying to display a score using classic dynamic text... i've tried a few different things but i can't get it to display on my stage, however, it does display when i use trace statements...
Will you tell me what is wrong with txtScore1.text = ___________?
i use this in my fxScoreIncrease()
import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.media.SoundChannel;
//import flash.events.MouseEvent;
//import totScore.totScore;
stop();
var myDelay:Timer = new Timer(5000,1);
var snd:Sound = new cCat();
var channel:SoundChannel = new SoundChannel();
//var theScore:totScore = new totScore();
var myScore:Number = 0;
var theText:TextFormat = new TextFormat();
letterC1.addEventListener(MouseEvent.CLICK,showLet C);
//instance letterC1;
letterA1.addEventListener(MouseEvent.CLICK, showWrong);
//instance letterA1;
letterT1.addEventListener(MouseEvent.CLICK, showWrong);
//instance letterT1;
play1.addEventListener(MouseEvent.CLICK, fxSndPlay);
function showLetC(Event:MouseEvent):void
{
initSound.backgroundColor = 0xffff00;
initSound.textColor = 0x000000;
initSound.text = "c";
fxScoreIncrease();//fx call
myDelay.start();
myDelay.addEventListener(TimerEvent.TIMER, fxNextScene);
}
function fxScoreIncrease():void//*******
{
theText.size = 24;
var increaseBy:Number = 1000;
myScore += increaseBy;
txtScore1.textColor = 0x000000;
trace((myScore) +"score");// works
txtScore1.text = "x";//no output
trace(txtScore1.text);//works
//String(myScore / 10);
}
function fxNextScene(evt:TimerEvent)
{
this.nextScene();
}
function showWrong(evt:MouseEvent):void
{
theText.size = 24;
initSound.backgroundColor = 0xff0000;
initSound.textColor = 0x000000;
initSound.text = "*";
}
function fxSndPlay(evt:MouseEvent):void
{
channel.stop();
//stops repeat/echo;
channel = snd.play(0,0);
}
Will you tell me what is wrong with txtScore1.text = ___________?
i use this in my fxScoreIncrease()
import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.media.SoundChannel;
//import flash.events.MouseEvent;
//import totScore.totScore;
stop();
var myDelay:Timer = new Timer(5000,1);
var snd:Sound = new cCat();
var channel:SoundChannel = new SoundChannel();
//var theScore:totScore = new totScore();
var myScore:Number = 0;
var theText:TextFormat = new TextFormat();
letterC1.addEventListener(MouseEvent.CLICK,showLet C);
//instance letterC1;
letterA1.addEventListener(MouseEvent.CLICK, showWrong);
//instance letterA1;
letterT1.addEventListener(MouseEvent.CLICK, showWrong);
//instance letterT1;
play1.addEventListener(MouseEvent.CLICK, fxSndPlay);
function showLetC(Event:MouseEvent):void
{
initSound.backgroundColor = 0xffff00;
initSound.textColor = 0x000000;
initSound.text = "c";
fxScoreIncrease();//fx call
myDelay.start();
myDelay.addEventListener(TimerEvent.TIMER, fxNextScene);
}
function fxScoreIncrease():void//*******
{
theText.size = 24;
var increaseBy:Number = 1000;
myScore += increaseBy;
txtScore1.textColor = 0x000000;
trace((myScore) +"score");// works
txtScore1.text = "x";//no output
trace(txtScore1.text);//works
//String(myScore / 10);
}
function fxNextScene(evt:TimerEvent)
{
this.nextScene();
}
function showWrong(evt:MouseEvent):void
{
theText.size = 24;
initSound.backgroundColor = 0xff0000;
initSound.textColor = 0x000000;
initSound.text = "*";
}
function fxSndPlay(evt:MouseEvent):void
{
channel.stop();
//stops repeat/echo;
channel = snd.play(0,0);
}