User login |
sourceJavaScript proxy for ActionScript 3I find the syntax for calling JavaScript functions from ActionScript to be awkward at best. Consider the following JavaScript: function handleClick(source) { // stuff } var Library = { processOrder: function(itemID, quantity) { // stuff } } The standard way of calling these functions is to use ExternalInterface: ExternalInterface.call("handleClick", "mainPage"); ExternalInterface.call("Library.processOrder", 51829, 3); I find the following syntax to be preferable: JS.window.handleClick("mainPage"); JS.window.Library.processOrder(51829, 3); Source code of the JS class that allows this syntax follows:
Brevity in conditionalsI see a lot of constructs in code that are just wordier than they need to be. All of these examples are in ActionScript 3, though most of them apply in other languages as well. Many of these are also marginally faster than their wordier counterpart.
Making friends with binary representationThis post is inspired by Nick’s aversion to bitwise operators all over the place. Despite this glaring personality flaw, he’s still worth hiring. Many developers, and unfortunately almost every Flash developer, are far too comfortable with their abstract data types like
|
Recent blog posts
|
Recent comments
3 weeks 1 day ago
5 weeks 2 days ago
16 weeks 6 days ago
19 weeks 6 days ago
19 weeks 6 days ago
31 weeks 11 hours ago
36 weeks 18 hours ago
40 weeks 1 day ago
50 weeks 3 days ago
50 weeks 5 days ago