|
[x]
Posted via EE Mobile
|
||
Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
||
| Question |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: |
package
{
import flash.display.MovieClip;
import flash.events.MouseEvent;
public class Main extends MovieClip
{
//why i have to declare these vars outside the Main function?
//this var is for user, he can guesses the number
// at the same time the program use it to compare in the (if) statment
var currentGuess:uint;
var startMessage:String;
// this is the number stored and the user try to guess it
var mysteryNumber:uint;
public function Main ()
{
init ();
function init ()
{
//trace ("Hello, from the init method!");
//initialize variable
startMessage = "I am thinking of a number between 1 and 100";
mysteryNumber = 50;
//initialize text field
output_txt.text = startMessage;
// why i have to define or give the input_txt empty value?
input_txt.text = "";
input_txt.backgroundColor = 0xffcccc;
input_txt.restrict = "0-9";
//why this command does not work
stage.focus = input_txt;
// add an event listener to a button
guessButton_btn.addEventListener (MouseEvent.CLICK, onGuessButtonClick);
}
function onGuessButtonClick (e:MouseEvent):void
{
//assigning the input from the text field to the currentGuess var
/*Its very easy to convert data types in AS3.0. All you need to do is
surround the data you want to convert in parentheses and then add
the name of the type you want to convert it to.*/
currentGuess = input_txt.text as uint;
//when i type from 0 - 49, it says: That's too high
//but when i type 50 or above 50, it does not give me the
//defined messege i specified
if (currentGuess > mysteryNumber)
{
output_txt.text = "That's too high";
}
else if (currentGuess < mysteryNumber)
{
output_txt.text = "That's too low";
}
else
{
output_txt.text = "You got it";
}
}
}
}
}
|
Advertisement
| Hall of Fame |