flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Schmalle <teotigraphix...@gmail.com>
Subject [FalconJX] Vanilla compiler, all externs parsing and contained in SWC :)
Date Tue, 09 Jun 2015 18:20:03 GMT
Hey,

Well I spent the whole day getting this working and did a Web Audio
experiment as well! Wow, code completion in class form for Audio apps, I
think I am hooked. :)

1. AS
2 .JS (around a 2M SWC for everything)
3. List of classes currently compiled

This thing is pretty stable compiling this mess of JS in all the files
below.

WebGL and HTML5 is in there as well. :)

Mike


-------------------------------------------------------------
Extern Libs in SWC
-------------------------------------------------------------

model.addExternal("es3");
model.addExternal("es5");
model.addExternal("es6");

model.addExternal("w3c_anim_timing");
model.addExternal("w3c_audio");
model.addExternal("w3c_batterystatus");
model.addExternal("w3c_css");
model.addExternal("w3c_css3d");
model.addExternal("w3c_device_sensor_event");
model.addExternal("w3c_dom1");
model.addExternal("w3c_dom2");
model.addExternal("w3c_dom3");
model.addExternal("w3c_elementtraversal");
model.addExternal("w3c_encoding");
model.addExternal("w3c_event");
model.addExternal("w3c_event3");
model.addExternal("w3c_geolocation");
model.addExternal("w3c_indexeddb");
model.addExternal("w3c_navigation_timing");
model.addExternal("w3c_range");
model.addExternal("w3c_rtc");
model.addExternal("w3c_selectors");
//model.addExternal("w3c_serviceworker");
//model.addExternal("w3c_webcrypto");
model.addExternal("w3c_xml");

        //model.addExternal("fetchapi");

model.addExternal("window");

model.addExternal("ie_dom");
model.addExternal("gecko_dom");

model.addExternal("webkit_css");
model.addExternal("webkit_dom");
model.addExternal("webkit_event");
model.addExternal("webkit_notifications");

model.addExternal("iphone");
model.addExternal("chrome");
model.addExternal("flash");

model.addExternal("page_visibility");
model.addExternal("fileapi");
model.addExternal("html5");

    model.addExternal("webgl");
model.addExternal("webstorage");




-------------------------------------------------------------
AS
-------------------------------------------------------------

package
{

import ui.ButtonFactory;

public class Main
{
    public var factory:ButtonFactory;

    private var _audioContext:AudioContext;
    private var sound:ArrayBuffer;

    public function Main()
    {
        factory = new ButtonFactory();

        var button:Element = factory.createButton(function ():void {
            button.textContent = "Say Hello FalconJX!";
            window.alert("Hello browser from FalconJX!");
        });
        button.textContent = "Say Hello";
        document.body.appendChild(button);

        var n:Number = Math.ceil(420);
        button.tabIndex = 1;
        //ButtonFactory.foo();

        var t:Touch = new Touch();
        t.pageY = 3;

        var context:AudioContext;
        try {
            _audioContext  = new AudioContext();
        }
        catch (e:Error) {
            alert('Web Audio API is not supported in this browser')
        }

        loadSound('/foo/bark.wav');
    }

    private function loadSound(url:String):void
    {
        var request:XMLHttpRequest = new XMLHttpRequest();
        request.open('GET', url, true);
        request.responseType = 'arraybuffer';

        // Decode async
        request['onload'] = function () {
            _audioContext.decodeAudioData(request.response,
                                          function
(buffer:ArrayBuffer):void {
                sound = buffer;
                playSound();
            }, onError);
        };

        request.send();
    }

    private function playSound():void
    {
        var source:AudioBufferSourceNode =
_audioContext.createBufferSource();
        source.connect(_audioContext.destination);
        source.start(0);
    }

    private function onError():void
    {

    }
}



-------------------------------------------------------------
JS
-------------------------------------------------------------


/**
 * Main
 *
 * @fileoverview
 *
 * @suppress {checkTypes}
 */

goog.provide('Main');

goog.require('org_apache_flex_utils_Language');



/**
 * @constructor
 */
Main = function() {
  var self = this;
  this.factory = new ui_ButtonFactory();
  var /** @type {Element} */ button = this.factory.createButton(function() {
    button.textContent = "Say Hello FalconJX!";
    window.alert("Hello browser from FalconJX!");
  });
  button.textContent = "Say Hello";
  document.body.appendChild(button);
  var /** @type {number} */ n = Math.ceil(420);
  button.tabIndex = 1;
  var /** @type {Touch} */ t = new Touch();
  t.pageY = 3;
  var /** @type {AudioContext} */ context;
  try {
    this._audioContext = new AudioContext();
  } catch (e) {
    alert('Web Audio API is not supported in this browser');
  }
  this.loadSound('/foo/bark.wav');
};


/**
 * @expose
 * @type {ui_ButtonFactory}
 */
Main.prototype.factory;


/**
 * @private
 * @type {AudioContext}
 */
Main.prototype._audioContext;


/**
 * @private
 * @type {ArrayBuffer}
 */
Main.prototype.sound;


/**
 * @private
 * @param {string} url
 */
Main.prototype.loadSound = function(url) {
  var self = this;
  var /** @type {XMLHttpRequest} */ request = new XMLHttpRequest();
  request.open('GET', url, true);
  request.responseType = 'arraybuffer';
  request['onload'] = function() {
    self._audioContext.decodeAudioData(request.response, function(buffer) {
      self.sound = buffer;
      self.playSound();
    }, goog.bind(self.onError, this));
  };
  request.send();
};


/**
 * @private
 */
Main.prototype.playSound = function() {
  var /** @type {AudioBufferSourceNode} */ source =
this._audioContext.createBufferSource();
  source.connect(this._audioContext.destination);
  source.start(0);
};


/**
 * @private
 */
Main.prototype.onError = function() {
};


/**
 * Metadata
 *
 * @type {Object.<string, Array.<Object>>}
 */
Main.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'Main', qName:
'Main'}] };





Mike

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message