jeudi 15 septembre 2016

create enum in actionscript 3 and compare

I new to flashbuilder so bare with me... I need to create som enum values, give it a default value and then compare it.

I have this enum class

public class Car
    public static const Tesla:int = 1;
    public static const Ford:int = 2;

How do I initiate a new Car enumn variable with a default value of "Tesla" and how do I compare the variable? Im looking for something like this...

public var c:Car = new Car(Car.Tesla);

if (c == Car.Tesla){
// Do something

Aucun commentaire:

Enregistrer un commentaire