
var Impetus = {};

(function(){ // namespace

// class ImpetusSound
function ImpetusSound(url)
{
    this.url = url; // :String
}
// function play():void
ImpetusSound.prototype.play = function(pos)
{
    flash.playSound(this.url, pos);
};
// function stop():void
ImpetusSound.prototype.stop = function()
{
    flash.stopSound(this.url);
};
// function getPos():int
ImpetusSound.prototype.getPos = function()
{
    return flash.getSoundPos(this.url);
};
// function setVolume(int volume):void
ImpetusSound.prototype.setVolume = function(volume)
{
    flash.setSoundVolume(this.url, volume);
};
// function getVolume():int
ImpetusSound.prototype.getVolume = function()
{
    return flash.getSoundVolume(this.url);
};
// function setBalance(int balance):void
ImpetusSound.prototype.setBalance = function(balance)
{
    flash.setSoundBalance(this.url, balance);
};
// function getBalance():int
ImpetusSound.prototype.getBalance = function()
{
    return flash.getSoundBalance(this.url);
};

// var sounds:Array<ImpetusSound>
var sounds = [];

// var flash:HTMLObjectElement
var flash = null;

// static var isLoaded:boolean
Impetus.isLoaded = false;

// static function Impetus.getSound(String url):ImpetusSound
Impetus.getSound = function(url)
{
    for(var i = 0; i < sounds.length; ++i)
    {
        if(sounds[i].url === url)
        {
            return sounds[i];
        }
    }

    var s = new ImpetusSound(url);

    sounds.push(s);

    return s;
};

// static function Impetus.setDefaultVolume(int volume, boolean all = false):void
Impetus.setDefaultVolume = function(volume, all)
{
    flash.setDefaultVolume(volume / 100, all);
};

// static function Impetus.setDefaultBalance(int balance, boolean all = false):void
Impetus.setDefaultBalance = function(balance, all)
{
    flash.setDefaultBalance(balance / 100, all);
};

// static function Impetus.load():void
Impetus.load = function()
{
    flash = new Builder('object')
        .set('id', 'impetus_flash')
        .set('type', 'application/x-shockwave-flash')
        .append(new Builder('param')
            .set('name', 'movie')
            .set('value', 'Impetus.swf'))
        .append(new Builder('param')
            .set('name', 'allowScriptAccess')
            .set('value', 'always'))
        .insert(document.body)
        .node;
};

// static function Impetus._flashLoadedCallback():void
Impetus._flashLoadedCallback = function()
{
    Impetus.isLoaded = true;
};

})();

@@ -1083,16 +1083,71 @@
  null;%0A%0A
+// var loadCallback:function%0Avar loadCallback = null;%0A%0A
 // stati
@@ -1913,16 +1913,40 @@
 us.load(
+callback:function = null
 ):void%0AI
@@ -1960,32 +1960,40 @@
 load = function(
+callback
 )%0A%7B%0A    flash = 
@@ -2382,16 +2382,46 @@
   .node;
+%0A%0A    loadCallback = callback;
 %0A%7D;%0A%0A// 
@@ -2544,16 +2544,96 @@
  = true;
+%0A%0A    if(typeof loadCallback === 'function')%0A    %7B%0A        loadCallback();%0A    %7D
 %0A%7D;%0A%0A%7D)(

Add callback arg to Impetus.load()