Skip navigation
Currently Being Moderated

Help With Code

Mar 2, 2013 2:34 PM

Why cant I write the code like this in FelxBuilder?



public var ValueIn:Sring



if(ValueIn == 1) {

NewBatteryStatus = "Red";

} else if(ValueIn == 2) {

NewBatteryStatus = "Green";


  • Currently Being Moderated
    Mar 3, 2013 3:04 AM   in reply to fsoender

    because it represents all things wrong as far as actionscript is concerned.

    1. Wrong Type (You meant "String" instead of sring),

    2, the default value for string is null(i think), you are comparing against integers

    Mark as:
  • Currently Being Moderated
    Mar 3, 2013 8:24 AM   in reply to fsoender

    String not sting or sring,


    you need to pick a book on actionscript. thats how you can fix it.

    Mark as:
  • Currently Being Moderated
    Mar 4, 2013 5:37 AM   in reply to fsoender

    As they pointed out, you probably should read up on ActionScript to figure this out, but....


    Things that are missing.

    public var ValueIn:String = "";

    Things that are wrong .

    if(ValueIn == 1) 

    However, the entire way your handing this is incorrect, because you can't treat a String as a Number to determine if the value equals something.  It looks like you are trying to pass in a numeric value to a function in or to set a global variable to a string value.  This is how I would do it.  But, you should figure out why.



         <s:String id="NewBatteryStatus" />
               private function batteryStatusCheck(batteryValue:int):void {
                         case 1:
                             NewBatteryStatus = "Red"; 
                        case 2:
                             NewBatteryStatus = "Green"; 
                             NewBatteryStatus = "Black"; 
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points