Why ActionScript 3.0 should be your first programming language

 ActionScript 3.0, is the best programing language for somebody just learning programing!

ActionScript sounds like a weird choice, right? It’s client-side, not server-side. You can’t connect to a database or create files on the fly without some sort of middleware (like java or ColdFusion).  ActionScript 3.0 can also create AIR applications that can be deployed everywhere, the desktop, iOS, and Android! ActionScript 3.0 is write once deploy everywhere.

I think ActionScript 3.0 is worth learning, and that it’s a great starter language for budding developers. Here’s why.

  • ActionScript 3.0 is syntactically similar to other C-style languages.
    Curly braces rule! Semi-colons are awesome! Getting comfortable with how AS3 looks and works will make Java less intimidating.
  • ActionScript 3.0 is strongly-typed.
    Strongly typed languages enforce rules for variable behavior. It’s particularly useful when debugging, and will help you understand what different variable types are and how they work across languages.
  • ActionScript 3.0 is Object oriented.
    Objects are at the heart of several programming languages, and supported in several more. Getting comfortable with how OOP works in AS 3 means it is easier to understand how it works in Java and other programming languages. In fact, ActionScript is in some ways similar to Java in how it’s structured.
  • ActionScript 3.0 is a dialect of ECMAScript.
    You can treat ECMA Script as a kind of subset that defines the basic language structure, syntax and semantics. Then ECMA is only a subset of ActionScript. The language adds a wide range of features to this subset.
  • ActionScript 3.0 supports Local Shared Objects
     Yep. Local storage “super cookies” have been available in Flash for years now. What’s more, key-value datastores are the next wave of databases.
  • ActionScript 3.0 supports event-driven programming.
    Event listening and handling is critical to game development or interactive experiences in which the sequence of user input can’t be (or shouldn’t be) controlled. Knowing how to generate, add and remove elements from the stage, or when an item can be safely garbage collected are portable concepts that you can learn with ActionScript.

Compare 2 arrays with AS 3

The following function compares the values ​​of two arrays and returns another array with different values​​.

private function checkArrays(array1:Array,array2:Array):Array {
    var array3:Array=new Array();
    var length1:int=array1.length;
    var none:Boolean=false;

    for(var i:int=0;i < length1;i++) {
        var length2:int=array2.length;

        for(var j:int=0;j < length2;j++) {
            if(String(array1[i])==String(array2[j])) {
                none=false;
                break;
            }
            else {
                none=true;
            }
        }
        if(none) {
            array3.push(array1[i])
            none=false;
        }
    }
    return array3;
}


AS3 Drawing Pad Awesomeness

This is another project that I’ve been putting off. It really should have some kind of bitmap merging/drawing going on to allow for a greater number of shapes, but I think it would work just fine for anything a guest would want to spend time on. Just don’t try to recreate the Sistine Chapel ceiling and you’ll be fine 🙂

[kml_flashembed publishmethod=”static” fversion=”8.0.0″ movie=”http://johnbarrett.net/wp-content/uploads/2013/01/DrawingPad.swf” width=”400″ height=”300″ targetclass=”flashmovie”]

Get Adobe Flash player

[/kml_flashembed]