Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

why does actionscript mess up strings

New Here ,
Apr 12, 2016 Apr 12, 2016

import flash.utils.Timer;

import flash.events.MouseEvent;

import flash.media.Sound;

import flash.media.SoundChannel;

var nCount: Number = 0;

var saying: String = (" welcome to the game");

var warning: String = (" Hurry 5 seconds till next question! ");

var ending: String = (" time has run out hope you had fun");

var score: Number = 0;

var answer: String = ("red square");

var answer2: String = ("blue polygon");

var answer3: String = ("green circle");

var answer4: String = ("gray triangle");

var userInput: String;

var shapes: Array = [sqr_mc, tri_mc, cir_mc, poly_mc];

var myTimer: Timer = new Timer(1000, nCount);

guess_txt.border = true;

var audio: Sound = new Mission();

var channel: SoundChannel = new SoundChannel();

timer_txt.text = nCount.toString();

myTimer.start();

timer_txt.border = true;

score_txt.border = true;

myTimer.addEventListener(TimerEvent.TIMER, count);

function count(e: TimerEvent): void {

  nCount++;

  timer_txt.text = ("Time:" + nCount.toString());

  if (nCount == 1) {

  response_txt.text = (saying);

  } else if (nCount == 5) {

  ques_txt.text = "What is color and shape shown ?";

  } else if (nCount == 10) {

  myTimer.stop();

  response_txt.text = (ending);

  channel.stop();

  }

}

guess_btn.addEventListener(MouseEvent.CLICK, testInput);

function testInput(e: MouseEvent) {

  userInput = guess_txt.text;

  if (userInput == answer || userInput == answer2 || userInput == answer3 || userInput == answer4) {

  response_txt.text = "correct";

  score += 10;

  score_txt.text = ("Score:" + score.toString());

  } else if (userInput != answer || userInput != answer2 || userInput != answer3 || userInput != answer4) {

  response_txt.text = "incorrect Try again. ";

  score -= 5;

  score_txt.text = (score.toString());

  }

}

reset_btn.addEventListener(MouseEvent.CLICK, resetGame);

function resetGame(e: MouseEvent) {

  nCount = 0;

  myTimer.reset();

  timer_txt.text = ("Time:" + nCount.toString());

  channel.stop();

  score = 0;

  score_txt.text = ("Score:" + score.toString());

}

play_btn.addEventListener(MouseEvent.CLICK, playGame);

function playGame(e: MouseEvent) {

  myTimer.start();

  timer_txt.text = ("Time:" + nCount.toString());

}

audio_btn.addEventListener(MouseEvent.CLICK, playAudio);

function playAudio(e: MouseEvent) {

  var audio: Sound = new Mission();

  var channel: SoundChannel = new SoundChannel();

  channel = audio.play()

}

i have that code and when i test my movie action script messes up the strings and only displays i o u and a's .. can any one help

TOPICS
ActionScript
277
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 13, 2016 Apr 13, 2016

Embed the fonts in your textfields.  Anytime you have text issues, first be sure to embed the fonts in the textfields.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 13, 2016 Apr 13, 2016

how would go about embedding the fonts with what i have there ?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 21, 2016 May 21, 2016
LATEST

It appears the textfield is not being added dynamically, so for what you have there, go to the stage and select the textfield and in the Properties panel for the textfield select the option to Embed the font.  Then select the font and the character set(s) you expect to be included in the textfield.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines