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

score disappears in game

Community Beginner ,
Oct 08, 2015 Oct 08, 2015

Copy link to clipboard

Copied

to anyone whom can help:

this is a lesson I'm doing for a class except the tutorial doesn't cover the response to this scenario.  My score disappears once the game is in execution mode.  I've seen forms suggesting the placement of a .embed code (not specific where) I've also seen a suggestion to change font which i've done and nothing has happened.  I don't want to disrupt the code from the lesson to much so any suggestions to what I may be missing I appreciate.

thank you.

//Setting up the game variables

userChoice = "none";

userComp = "none";

//Setting up score variables

Wins = 0;

Losses = 0;

Draws = 0;

Tries = 0;

//control variable

control = true;

//Initial hideLogos call

hideLogos();

function hideLogos()

{

  //Hiding our logos

  this.StatWin._visible = false;

  this.statLose._visible = false;

  this.statDraw._visible = false;

}

//Choose functions

function choose(newChoice)

{

  //If we have control, run the game

  if (control)

  {

  hideLogos();

  userChoice = newChoice;

  trace("You've have selected " + userChoice);

  rndChoice = Math.ceil(Math.random() * 3);

  //trace ("Random number : " + rndChoice) ;

  switch (rndChoice)

  {

  case 1 :

  compChoice = "Rock";

  break;

  case 2 :

  compChoice = "Zors";

  break;

  case 3 :

  compChoice = "Paper";

  break;

  }

  trace("Computer selected" + compChoice);

  Object(this).scarecrowUser.gotoAndPlay(userChoice);

  Object(this).scarecrowComp.gotoAndPlay(compChoice);

  control = false;

  }

}

function gameLogic()

{

  if (!control)

  {

  if ((userChoice == "Rock" && compChoice == "Zors") || (userChoice == "Zors" && compChoice == "Paper") || (userChoice == "Paper" && compChoice == "Rock"))

  {

  //Result is victory

  trace("You've won!");

  this.StatWin._visible = true;

  wins++;

  }

  else if (userChoice == compChoice)

  {

  //Result is draw

  trace("it's a draw");

  Object(this).statDraw._visible = true;

  draws++;

  }

  else

  {

  //Result is loss

  trace("you've lost :(");

  Object(this).statLose._visible = true;

  losses++;

  }

  tries++;

  control = true;

}

}

//Functions for the buttons

Object(this).btnRock.onPress = function()

{

  choose("Rock");

};

Object(this).btnPaper.onPress = function()

{

  choose("Paper");

};

Object(this).btnZors.onPress = function()

{

  choose("Zors");

};

TOPICS
ActionScript

Views

501

Translate

Translate

Report

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
Enthusiast ,
Oct 08, 2015 Oct 08, 2015

Copy link to clipboard

Copied

Object(this).statLose._visible = true;

correct the "visible" code: statLose.visible = true; without underscore.

Votes

Translate

Translate

Report

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
Community Beginner ,
Oct 09, 2015 Oct 09, 2015

Copy link to clipboard

Copied

I tried pulling the underscore but unfortunately it still did not work.  There was another similar complaint where they changed the font and they were good.  I suspect it has something to do with Flash and the imbed radio button.

Screen Shot 2015-10-10 at 12.27.08 AM.png

Votes

Translate

Translate

Report

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
Enthusiast ,
Oct 09, 2015 Oct 09, 2015

Copy link to clipboard

Copied

First thing there's a lot of "visible" code needs a correction. you have to make sure that you've corrected all..

Regarding the font you have to make sure that you've done the following steps correctly:

1- Embed the font inside the flash movie library (click the embed button next to font style field, in the Font Embedding window > Character ranges > select "All".

2- Use this code for all the text fields you have on the stage "textField_name.embedFonts = true;"

Votes

Translate

Translate

Report

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
Enthusiast ,
Oct 09, 2015 Oct 09, 2015

Copy link to clipboard

Copied

One more thing, it's better to add an "as linkage" for the font you've embedded. (from the library select the font and double click on the "Linkage" area then type the font name as a linkage).

Votes

Translate

Translate

Report

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
Community Beginner ,
Oct 10, 2015 Oct 10, 2015

Copy link to clipboard

Copied

Think I very much for info this will take sometime to break down and understand I'll keep you posted.

Sent from my iPhone

Votes

Translate

Translate

Report

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
Enthusiast ,
Oct 10, 2015 Oct 10, 2015

Copy link to clipboard

Copied

This is a simple tutorial on YouTube for Dynamic TextField it'll help if you like to watch it.

https://www.youtube.com/watch?v=LmSibzZbLNY

Regards.

Votes

Translate

Translate

Report

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
Community Beginner ,
Oct 11, 2015 Oct 11, 2015

Copy link to clipboard

Copied

After further review with a friend that has some coding experienced she

broke down for me what you were trying to explain to me as far as

correcting the code I was working with at this point I'm going to reference

the video you sent and also an email in regards to font and property use;

Some links that may help:

http://www.adobe.com/devnet/archive/flash/quickstart/embedding_fonts.html

http://www.adobe.com/devnet/flash/articles/avoiding-mistakes-text.html

Thank you for using Picture and Video Messaging by U.S. Cellular. See

www.uscellular.com for info.

I'm actually a beginner and it appears that the font was not setup properly

(as you were explaining as well) which forces me to be clueless. There

were a lot of things my friend pointed out that I had no idea as far as how

the code was calling on the font and how my code was setup… I'm going to

try and work on this a little at a time and this may be a while but I

really appreciate the help and if I am able to fix this I will respond to

my ticket in which you've been helping me.

Thank you

Votes

Translate

Translate

Report

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
Enthusiast ,
Oct 12, 2015 Oct 12, 2015

Copy link to clipboard

Copied

LATEST

You're welcome & good luck.

Votes

Translate

Translate

Report

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
Enthusiast ,
Oct 10, 2015 Oct 10, 2015

Copy link to clipboard

Copied

As I see in the screenshot, the score text field has no instance name and in your code you're using trace only   trace("You've won!");.. that will not do anything to the score text field it'll only show you the result in the Flash output window! if I am not wrong you have to give an instance name for each text field you want to show your messages through it.. after that use the text fields names in the code to fill the text ( text_instance.text = "You've won!"; ) instead of trace("You've won!");.. plus the previews steps for the font.

Votes

Translate

Translate

Report

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