Skip to content
Browse files

Added GettingStarted sample

  • Loading branch information...
1 parent 96ab1df commit 10839ab17c1f1442d43c8c17767d14a6398382d4 @codam committed Aug 14, 2012
View
127 samples/GettingStarted/Sample.hx
@@ -0,0 +1,127 @@
+import haxe.Http;
+import js.Lib;
+import js.Dom;
+
+/**
+ * Getting Started with cocktail
+ *
+ * @author Raphael Harmel
+ * @date 2012-08-13
+ */
+class Sample
+{
+ /**
+ * Constructor
+ */
+ public function new()
+ {
+
+ // create a container to gather all of our visual elements
+ var container = createContainer();
+
+ // create a text node and attach it to the container
+ var text = Lib.document.createTextNode("Welcome to");
+ container.appendChild(text);
+
+ // create an image and attach it to the container
+ var image:Image = cast(Lib.document.createElement("img"));
+ image.src = "../assets/icone_cocktail_blanche_ombre.png";
+ container.appendChild(image);
+
+ // create interactivity
+ image.onmousedown = onMouseDown;
+ image.onmouseup = onMouseUp;
+ }
+
+ /**
+ * Creates a centered div container and attach it to the body
+ * @return container
+ */
+ public static function createContainer():HtmlDom
+ {
+ // create a container to gather all of our visual elements
+ var container = Lib.document.createElement("div");
+
+ // apply styles to the container
+ container.style.marginLeft = container.style.marginRight = "auto";
+ container.style.width = "150px";
+ container.style.textAlign = "center";
+
+ // create a reference to the body
+ var body = Lib.document.body;
+
+ //attach the container to the body
+ body.appendChild(container);
+
+ return container;
+ }
+
+ /**
+ * Mouse Down callback. Changes the image to be displayed.
+ * @param event
+ */
+ public static function onMouseDown(event:Event):Void
+ {
+ var image:Image = cast(event.target);
+ image.src = "../assets/icone_haxe_blanche_ombre.png";
+ }
+
+ /**
+ * Mouse Up callback. Resets the image to be displayed and loads the dynamic data.
+ * @param event
+ */
+ public static function onMouseUp(event:Event):Void
+ {
+ var image:Image = cast(event.target);
+ image.src = "../assets/icone_cocktail_blanche_ombre.png";
+
+ try {
+ // calls the http request
+ var request:Http = new Http("../assets/feed.txt");
+ // sets the callbacks
+ request.onData = onData;
+ request.onError = onError;
+ // closes the http request
+ request.request(false);
+ }
+ catch (error:Dynamic) {
+ onError(error);
+ }
+ }
+
+ /**
+ * Http request success callback. Attach the external file content to the stage using a centered container.
+ * @param string
+ */
+ public static function onData(string:String):Void
+ {
+ // create a container and attch it to the body
+ var container = createContainer();
+ // create a text node to display the content of the file
+ var text = Lib.document.createTextNode(string);
+ // attach the text node to the container
+ container.appendChild(text);
+ }
+
+ /**
+ * Http request error callback. Displays an error message.
+ * @param string
+ */
+ public static function onError(msg:Dynamic):Void
+ {
+ trace("there was an error while loading the external data");
+ }
+
+ /**
+ * main class. calls the constructor.
+ */
+ public static function main()
+ {
+ #if nme
+ nme.Lib.create(function() { new Sample(); }, 1024, 768, 60, 0xffffff, (1 * nme.Lib.HARDWARE) | nme.Lib.RESIZABLE);
+ #else
+ new Sample();
+ #end
+ }
+
+}
View
53 samples/GettingStarted/Sample.hxproj
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project version="2">
+ <!-- Output SWF options -->
+ <output>
+ <movie outputType="Application" />
+ <movie input="" />
+ <movie path="js/Sample.js" />
+ <movie fps="0" />
+ <movie width="0" />
+ <movie height="0" />
+ <movie version="1" />
+ <movie minorVersion="0" />
+ <movie platform="JavaScript" />
+ <movie background="#FFFFFF" />
+ </output>
+ <!-- Other classes to be compiled into your SWF -->
+ <classpaths>
+ <class path="..\..\src" />
+ </classpaths>
+ <!-- Build options -->
+ <build>
+ <option directives="" />
+ <option flashStrict="False" />
+ <option mainClass="Sample" />
+ <option enabledebug="False" />
+ <option additional="" />
+ </build>
+ <!-- haxelib libraries -->
+ <haxelib>
+ <!-- example: <library name="..." /> -->
+ </haxelib>
+ <!-- Class files to compile (other referenced classes will automatically be included) -->
+ <compileTargets>
+ <compile path="src\Main.hx" />
+ </compileTargets>
+ <!-- Paths to exclude from the Project Explorer tree -->
+ <hiddenPaths>
+ <!-- example: <hidden path="..." /> -->
+ </hiddenPaths>
+ <!-- Executed before build -->
+ <preBuildCommand />
+ <!-- Executed after build -->
+ <postBuildCommand alwaysRun="False">haxe compile-js.hxml
+haxe compile-swf.hxml</postBuildCommand>
+ <!-- Other project options -->
+ <options>
+ <option showHiddenPaths="False" />
+ <option testMovie="OpenDocument" />
+ <option testMovieCommand="bin/index.html" />
+ </options>
+ <!-- Plugin storage -->
+ <storage />
+</project>
View
1 samples/GettingStarted/assets/feed.txt
@@ -0,0 +1 @@
+Sunrise
View
BIN samples/GettingStarted/assets/icone_cocktail_blanche_ombre.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN samples/GettingStarted/assets/icone_haxe_blanche_ombre.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
3 samples/GettingStarted/compile-js.hxml
@@ -0,0 +1,3 @@
+-main Sample
+-js js/Sample.js
+-cp ../../src/
View
8 samples/GettingStarted/compile-nme.hxml
@@ -0,0 +1,8 @@
+-main Sample
+-cpp nme
+-D nme
+-cp ../../src/
+-lib nme
+-debug
+--remap flash:nme
+--remap js:cocktail
View
6 samples/GettingStarted/compile-swf.hxml
@@ -0,0 +1,6 @@
+-main Sample
+-swf swf/Sample.swf
+-cp ../../src/
+-swf-header 500:500:60:ffffff
+-swf-version 10.2
+--remap js:cocktail
View
630 samples/GettingStarted/js/Sample.js
@@ -0,0 +1,630 @@
+var $_, $hxClasses = $hxClasses || {}, $estr = function() { return js.Boot.__string_rec(this,''); }
+function $extend(from, fields) {
+ function inherit() {}; inherit.prototype = from; var proto = new inherit();
+ for (var name in fields) proto[name] = fields[name];
+ return proto;
+}
+var Hash = $hxClasses["Hash"] = function() {
+ this.h = { };
+};
+Hash.__name__ = ["Hash"];
+Hash.prototype = {
+ h: null
+ ,set: function(key,value) {
+ this.h["$" + key] = value;
+ }
+ ,get: function(key) {
+ return this.h["$" + key];
+ }
+ ,exists: function(key) {
+ return this.h.hasOwnProperty("$" + key);
+ }
+ ,remove: function(key) {
+ key = "$" + key;
+ if(!this.h.hasOwnProperty(key)) return false;
+ delete(this.h[key]);
+ return true;
+ }
+ ,keys: function() {
+ var a = [];
+ for( var key in this.h ) {
+ if(this.h.hasOwnProperty(key)) a.push(key.substr(1));
+ }
+ return a.iterator();
+ }
+ ,iterator: function() {
+ return { ref : this.h, it : this.keys(), hasNext : function() {
+ return this.it.hasNext();
+ }, next : function() {
+ var i = this.it.next();
+ return this.ref["$" + i];
+ }};
+ }
+ ,toString: function() {
+ var s = new StringBuf();
+ s.b[s.b.length] = "{";
+ var it = this.keys();
+ while( it.hasNext() ) {
+ var i = it.next();
+ s.b[s.b.length] = i == null?"null":i;
+ s.b[s.b.length] = " => ";
+ s.add(Std.string(this.get(i)));
+ if(it.hasNext()) s.b[s.b.length] = ", ";
+ }
+ s.b[s.b.length] = "}";
+ return s.b.join("");
+ }
+ ,__class__: Hash
+}
+var IntIter = $hxClasses["IntIter"] = function(min,max) {
+ this.min = min;
+ this.max = max;
+};
+IntIter.__name__ = ["IntIter"];
+IntIter.prototype = {
+ min: null
+ ,max: null
+ ,hasNext: function() {
+ return this.min < this.max;
+ }
+ ,next: function() {
+ return this.min++;
+ }
+ ,__class__: IntIter
+}
+var Sample = $hxClasses["Sample"] = function() {
+ var container = Sample.createContainer();
+ var text = js.Lib.document.createTextNode("Welcome to");
+ container.appendChild(text);
+ var image = js.Lib.document.createElement("img");
+ image.src = "../assets/icone_cocktail_blanche_ombre.png";
+ container.appendChild(image);
+ image.onmousedown = Sample.onMouseDown;
+ image.onmouseup = Sample.onMouseUp;
+};
+Sample.__name__ = ["Sample"];
+Sample.createContainer = function() {
+ var container = js.Lib.document.createElement("div");
+ container.style.marginLeft = container.style.marginRight = "auto";
+ container.style.width = "150px";
+ container.style.textAlign = "center";
+ var body = js.Lib.document.body;
+ body.appendChild(container);
+ return container;
+}
+Sample.onMouseDown = function(event) {
+ var image = event.target;
+ image.src = "../assets/icone_haxe_blanche_ombre.png";
+}
+Sample.onMouseUp = function(event) {
+ var image = event.target;
+ image.src = "../assets/icone_cocktail_blanche_ombre.png";
+ try {
+ var request = new haxe.Http("../assets/feed.txt");
+ request.onData = Sample.onData;
+ request.onError = Sample.onError;
+ request.request(false);
+ } catch( error ) {
+ Sample.onError(error);
+ }
+}
+Sample.onData = function(string) {
+ var container = Sample.createContainer();
+ var text = js.Lib.document.createTextNode(string);
+ container.appendChild(text);
+}
+Sample.onError = function(msg) {
+ haxe.Log.trace("there was an error while loading the external data",{ fileName : "Sample.hx", lineNumber : 112, className : "Sample", methodName : "onError"});
+}
+Sample.main = function() {
+ new Sample();
+}
+Sample.prototype = {
+ __class__: Sample
+}
+var Std = $hxClasses["Std"] = function() { }
+Std.__name__ = ["Std"];
+Std["is"] = function(v,t) {
+ return js.Boot.__instanceof(v,t);
+}
+Std.string = function(s) {
+ return js.Boot.__string_rec(s,"");
+}
+Std["int"] = function(x) {
+ return x | 0;
+}
+Std.parseInt = function(x) {
+ var v = parseInt(x,10);
+ if(v == 0 && x.charCodeAt(1) == 120) v = parseInt(x);
+ if(isNaN(v)) return null;
+ return v;
+}
+Std.parseFloat = function(x) {
+ return parseFloat(x);
+}
+Std.random = function(x) {
+ return Math.floor(Math.random() * x);
+}
+Std.prototype = {
+ __class__: Std
+}
+var StringBuf = $hxClasses["StringBuf"] = function() {
+ this.b = new Array();
+};
+StringBuf.__name__ = ["StringBuf"];
+StringBuf.prototype = {
+ add: function(x) {
+ this.b[this.b.length] = x == null?"null":x;
+ }
+ ,addSub: function(s,pos,len) {
+ this.b[this.b.length] = s.substr(pos,len);
+ }
+ ,addChar: function(c) {
+ this.b[this.b.length] = String.fromCharCode(c);
+ }
+ ,toString: function() {
+ return this.b.join("");
+ }
+ ,b: null
+ ,__class__: StringBuf
+}
+var StringTools = $hxClasses["StringTools"] = function() { }
+StringTools.__name__ = ["StringTools"];
+StringTools.urlEncode = function(s) {
+ return encodeURIComponent(s);
+}
+StringTools.urlDecode = function(s) {
+ return decodeURIComponent(s.split("+").join(" "));
+}
+StringTools.htmlEscape = function(s) {
+ return s.split("&").join("&amp;").split("<").join("&lt;").split(">").join("&gt;");
+}
+StringTools.htmlUnescape = function(s) {
+ return s.split("&gt;").join(">").split("&lt;").join("<").split("&amp;").join("&");
+}
+StringTools.startsWith = function(s,start) {
+ return s.length >= start.length && s.substr(0,start.length) == start;
+}
+StringTools.endsWith = function(s,end) {
+ var elen = end.length;
+ var slen = s.length;
+ return slen >= elen && s.substr(slen - elen,elen) == end;
+}
+StringTools.isSpace = function(s,pos) {
+ var c = s.charCodeAt(pos);
+ return c >= 9 && c <= 13 || c == 32;
+}
+StringTools.ltrim = function(s) {
+ var l = s.length;
+ var r = 0;
+ while(r < l && StringTools.isSpace(s,r)) r++;
+ if(r > 0) return s.substr(r,l - r); else return s;
+}
+StringTools.rtrim = function(s) {
+ var l = s.length;
+ var r = 0;
+ while(r < l && StringTools.isSpace(s,l - r - 1)) r++;
+ if(r > 0) return s.substr(0,l - r); else return s;
+}
+StringTools.trim = function(s) {
+ return StringTools.ltrim(StringTools.rtrim(s));
+}
+StringTools.rpad = function(s,c,l) {
+ var sl = s.length;
+ var cl = c.length;
+ while(sl < l) if(l - sl < cl) {
+ s += c.substr(0,l - sl);
+ sl = l;
+ } else {
+ s += c;
+ sl += cl;
+ }
+ return s;
+}
+StringTools.lpad = function(s,c,l) {
+ var ns = "";
+ var sl = s.length;
+ if(sl >= l) return s;
+ var cl = c.length;
+ while(sl < l) if(l - sl < cl) {
+ ns += c.substr(0,l - sl);
+ sl = l;
+ } else {
+ ns += c;
+ sl += cl;
+ }
+ return ns + s;
+}
+StringTools.replace = function(s,sub,by) {
+ return s.split(sub).join(by);
+}
+StringTools.hex = function(n,digits) {
+ var s = "";
+ var hexChars = "0123456789ABCDEF";
+ do {
+ s = hexChars.charAt(n & 15) + s;
+ n >>>= 4;
+ } while(n > 0);
+ if(digits != null) while(s.length < digits) s = "0" + s;
+ return s;
+}
+StringTools.fastCodeAt = function(s,index) {
+ return s.cca(index);
+}
+StringTools.isEOF = function(c) {
+ return c != c;
+}
+StringTools.prototype = {
+ __class__: StringTools
+}
+var haxe = haxe || {}
+haxe.Http = $hxClasses["haxe.Http"] = function(url) {
+ this.url = url;
+ this.headers = new Hash();
+ this.params = new Hash();
+ this.async = true;
+};
+haxe.Http.__name__ = ["haxe","Http"];
+haxe.Http.requestUrl = function(url) {
+ var h = new haxe.Http(url);
+ h.async = false;
+ var r = null;
+ h.onData = function(d) {
+ r = d;
+ };
+ h.onError = function(e) {
+ throw e;
+ };
+ h.request(false);
+ return r;
+}
+haxe.Http.prototype = {
+ url: null
+ ,async: null
+ ,postData: null
+ ,headers: null
+ ,params: null
+ ,setHeader: function(header,value) {
+ this.headers.set(header,value);
+ }
+ ,setParameter: function(param,value) {
+ this.params.set(param,value);
+ }
+ ,setPostData: function(data) {
+ this.postData = data;
+ }
+ ,request: function(post) {
+ var me = this;
+ var r = new js.XMLHttpRequest();
+ var onreadystatechange = function() {
+ if(r.readyState != 4) return;
+ var s = (function($this) {
+ var $r;
+ try {
+ $r = r.status;
+ } catch( e ) {
+ $r = null;
+ }
+ return $r;
+ }(this));
+ if(s == undefined) s = null;
+ if(s != null) me.onStatus(s);
+ if(s != null && s >= 200 && s < 400) me.onData(r.responseText); else switch(s) {
+ case null: case undefined:
+ me.onError("Failed to connect or resolve host");
+ break;
+ case 12029:
+ me.onError("Failed to connect to host");
+ break;
+ case 12007:
+ me.onError("Unknown host");
+ break;
+ default:
+ me.onError("Http Error #" + r.status);
+ }
+ };
+ if(this.async) r.onreadystatechange = onreadystatechange;
+ var uri = this.postData;
+ if(uri != null) post = true; else {
+ var $it0 = this.params.keys();
+ while( $it0.hasNext() ) {
+ var p = $it0.next();
+ if(uri == null) uri = ""; else uri += "&";
+ uri += StringTools.urlEncode(p) + "=" + StringTools.urlEncode(this.params.get(p));
+ }
+ }
+ try {
+ if(post) r.open("POST",this.url,this.async); else if(uri != null) {
+ var question = this.url.split("?").length <= 1;
+ r.open("GET",this.url + (question?"?":"&") + uri,this.async);
+ uri = null;
+ } else r.open("GET",this.url,this.async);
+ } catch( e ) {
+ this.onError(e.toString());
+ return;
+ }
+ if(this.headers.get("Content-Type") == null && post && this.postData == null) r.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
+ var $it1 = this.headers.keys();
+ while( $it1.hasNext() ) {
+ var h = $it1.next();
+ r.setRequestHeader(h,this.headers.get(h));
+ }
+ r.send(uri);
+ if(!this.async) onreadystatechange();
+ }
+ ,onData: function(data) {
+ }
+ ,onError: function(msg) {
+ }
+ ,onStatus: function(status) {
+ }
+ ,__class__: haxe.Http
+}
+haxe.Log = $hxClasses["haxe.Log"] = function() { }
+haxe.Log.__name__ = ["haxe","Log"];
+haxe.Log.trace = function(v,infos) {
+ js.Boot.__trace(v,infos);
+}
+haxe.Log.clear = function() {
+ js.Boot.__clear_trace();
+}
+haxe.Log.prototype = {
+ __class__: haxe.Log
+}
+var js = js || {}
+js.Boot = $hxClasses["js.Boot"] = function() { }
+js.Boot.__name__ = ["js","Boot"];
+js.Boot.__unhtml = function(s) {
+ return s.split("&").join("&amp;").split("<").join("&lt;").split(">").join("&gt;");
+}
+js.Boot.__trace = function(v,i) {
+ var msg = i != null?i.fileName + ":" + i.lineNumber + ": ":"";
+ msg += js.Boot.__string_rec(v,"");
+ var d = document.getElementById("haxe:trace");
+ if(d != null) d.innerHTML += js.Boot.__unhtml(msg) + "<br/>"; else if(typeof(console) != "undefined" && console.log != null) console.log(msg);
+}
+js.Boot.__clear_trace = function() {
+ var d = document.getElementById("haxe:trace");
+ if(d != null) d.innerHTML = "";
+}
+js.Boot.__string_rec = function(o,s) {
+ if(o == null) return "null";
+ if(s.length >= 5) return "<...>";
+ var t = typeof(o);
+ if(t == "function" && (o.__name__ != null || o.__ename__ != null)) t = "object";
+ switch(t) {
+ case "object":
+ if(o instanceof Array) {
+ if(o.__enum__ != null) {
+ if(o.length == 2) return o[0];
+ var str = o[0] + "(";
+ s += "\t";
+ var _g1 = 2, _g = o.length;
+ while(_g1 < _g) {
+ var i = _g1++;
+ if(i != 2) str += "," + js.Boot.__string_rec(o[i],s); else str += js.Boot.__string_rec(o[i],s);
+ }
+ return str + ")";
+ }
+ var l = o.length;
+ var i;
+ var str = "[";
+ s += "\t";
+ var _g = 0;
+ while(_g < l) {
+ var i1 = _g++;
+ str += (i1 > 0?",":"") + js.Boot.__string_rec(o[i1],s);
+ }
+ str += "]";
+ return str;
+ }
+ var tostr;
+ try {
+ tostr = o.toString;
+ } catch( e ) {
+ return "???";
+ }
+ if(tostr != null && tostr != Object.toString) {
+ var s2 = o.toString();
+ if(s2 != "[object Object]") return s2;
+ }
+ var k = null;
+ var str = "{\n";
+ s += "\t";
+ var hasp = o.hasOwnProperty != null;
+ for( var k in o ) { ;
+ if(hasp && !o.hasOwnProperty(k)) {
+ continue;
+ }
+ if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") {
+ continue;
+ }
+ if(str.length != 2) str += ", \n";
+ str += s + k + " : " + js.Boot.__string_rec(o[k],s);
+ }
+ s = s.substring(1);
+ str += "\n" + s + "}";
+ return str;
+ case "function":
+ return "<function>";
+ case "string":
+ return o;
+ default:
+ return String(o);
+ }
+}
+js.Boot.__interfLoop = function(cc,cl) {
+ if(cc == null) return false;
+ if(cc == cl) return true;
+ var intf = cc.__interfaces__;
+ if(intf != null) {
+ var _g1 = 0, _g = intf.length;
+ while(_g1 < _g) {
+ var i = _g1++;
+ var i1 = intf[i];
+ if(i1 == cl || js.Boot.__interfLoop(i1,cl)) return true;
+ }
+ }
+ return js.Boot.__interfLoop(cc.__super__,cl);
+}
+js.Boot.__instanceof = function(o,cl) {
+ try {
+ if(o instanceof cl) {
+ if(cl == Array) return o.__enum__ == null;
+ return true;
+ }
+ if(js.Boot.__interfLoop(o.__class__,cl)) return true;
+ } catch( e ) {
+ if(cl == null) return false;
+ }
+ switch(cl) {
+ case Int:
+ return Math.ceil(o%2147483648.0) === o;
+ case Float:
+ return typeof(o) == "number";
+ case Bool:
+ return o === true || o === false;
+ case String:
+ return typeof(o) == "string";
+ case Dynamic:
+ return true;
+ default:
+ if(o == null) return false;
+ return o.__enum__ == cl || cl == Class && o.__name__ != null || cl == Enum && o.__ename__ != null;
+ }
+}
+js.Boot.__init = function() {
+ js.Lib.isIE = typeof document!='undefined' && document.all != null && typeof window!='undefined' && window.opera == null;
+ js.Lib.isOpera = typeof window!='undefined' && window.opera != null;
+ Array.prototype.copy = Array.prototype.slice;
+ Array.prototype.insert = function(i,x) {
+ this.splice(i,0,x);
+ };
+ Array.prototype.remove = Array.prototype.indexOf?function(obj) {
+ var idx = this.indexOf(obj);
+ if(idx == -1) return false;
+ this.splice(idx,1);
+ return true;
+ }:function(obj) {
+ var i = 0;
+ var l = this.length;
+ while(i < l) {
+ if(this[i] == obj) {
+ this.splice(i,1);
+ return true;
+ }
+ i++;
+ }
+ return false;
+ };
+ Array.prototype.iterator = function() {
+ return { cur : 0, arr : this, hasNext : function() {
+ return this.cur < this.arr.length;
+ }, next : function() {
+ return this.arr[this.cur++];
+ }};
+ };
+ if(String.prototype.cca == null) String.prototype.cca = String.prototype.charCodeAt;
+ String.prototype.charCodeAt = function(i) {
+ var x = this.cca(i);
+ if(x != x) return undefined;
+ return x;
+ };
+ var oldsub = String.prototype.substr;
+ String.prototype.substr = function(pos,len) {
+ if(pos != null && pos != 0 && len != null && len < 0) return "";
+ if(len == null) len = this.length;
+ if(pos < 0) {
+ pos = this.length + pos;
+ if(pos < 0) pos = 0;
+ } else if(len < 0) len = this.length + len - pos;
+ return oldsub.apply(this,[pos,len]);
+ };
+ Function.prototype["$bind"] = function(o) {
+ var f = function() {
+ return f.method.apply(f.scope,arguments);
+ };
+ f.scope = o;
+ f.method = this;
+ return f;
+ };
+}
+js.Boot.prototype = {
+ __class__: js.Boot
+}
+js.Lib = $hxClasses["js.Lib"] = function() { }
+js.Lib.__name__ = ["js","Lib"];
+js.Lib.isIE = null;
+js.Lib.isOpera = null;
+js.Lib.document = null;
+js.Lib.window = null;
+js.Lib.alert = function(v) {
+ alert(js.Boot.__string_rec(v,""));
+}
+js.Lib.eval = function(code) {
+ return eval(code);
+}
+js.Lib.setErrorHandler = function(f) {
+ js.Lib.onerror = f;
+}
+js.Lib.prototype = {
+ __class__: js.Lib
+}
+js.Boot.__res = {}
+js.Boot.__init();
+{
+ Math.__name__ = ["Math"];
+ Math.NaN = Number["NaN"];
+ Math.NEGATIVE_INFINITY = Number["NEGATIVE_INFINITY"];
+ Math.POSITIVE_INFINITY = Number["POSITIVE_INFINITY"];
+ $hxClasses["Math"] = Math;
+ Math.isFinite = function(i) {
+ return isFinite(i);
+ };
+ Math.isNaN = function(i) {
+ return isNaN(i);
+ };
+}
+{
+ String.prototype.__class__ = $hxClasses["String"] = String;
+ String.__name__ = ["String"];
+ Array.prototype.__class__ = $hxClasses["Array"] = Array;
+ Array.__name__ = ["Array"];
+ var Int = $hxClasses["Int"] = { __name__ : ["Int"]};
+ var Dynamic = $hxClasses["Dynamic"] = { __name__ : ["Dynamic"]};
+ var Float = $hxClasses["Float"] = Number;
+ Float.__name__ = ["Float"];
+ var Bool = $hxClasses["Bool"] = Boolean;
+ Bool.__ename__ = ["Bool"];
+ var Class = $hxClasses["Class"] = { __name__ : ["Class"]};
+ var Enum = { };
+ var Void = $hxClasses["Void"] = { __ename__ : ["Void"]};
+}
+{
+ if(typeof document != "undefined") js.Lib.document = document;
+ if(typeof window != "undefined") {
+ js.Lib.window = window;
+ js.Lib.window.onerror = function(msg,url,line) {
+ var f = js.Lib.onerror;
+ if(f == null) return false;
+ return f(msg,[url + ":" + line]);
+ };
+ }
+}
+js["XMLHttpRequest"] = window.XMLHttpRequest?XMLHttpRequest:window.ActiveXObject?function() {
+ try {
+ return new ActiveXObject("Msxml2.XMLHTTP");
+ } catch( e ) {
+ try {
+ return new ActiveXObject("Microsoft.XMLHTTP");
+ } catch( e1 ) {
+ throw "Unable to create XMLHttpRequest object.";
+ }
+ }
+}:(function($this) {
+ var $r;
+ throw "Unable to create XMLHttpRequest object.";
+ return $r;
+}(this));
+js.Lib.onerror = null;
+Sample.main()
View
9 samples/GettingStarted/js/index.html
@@ -0,0 +1,9 @@
+<html>
+ <head>
+ <title>Sample</title>
+ </head>
+ <body>
+ <div id="haxe:trace"></div>
+ <script type="text/javascript" src="Sample.js"></script>
+ </body>
+</html>
View
BIN samples/GettingStarted/swf/Sample.swf
Binary file not shown.
View
23 samples/GettingStarted/swf/index.html
@@ -0,0 +1,23 @@
+<html>
+ <head>
+ <title>MyApp</title>
+ </head>
+ <body>
+ <div id="haxe:trace"></div>
+ <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="100%" height="100%" id="movie_name" align="middle">
+ <param name="movie" value="Sample.swf"/>
+ <param name="scale" value="noscale" />
+ <!--[if !IE]>-->
+ <object type="application/x-shockwave-flash" data="Sample.swf" width="100%" height="100%">
+ <param name="movie" value="Sample.swf"/>
+ <param name="scale" value="noscale" />
+ <!--<![endif]-->
+ <a href="http://www.adobe.com/go/getflash">
+ <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player"/>
+ </a>
+ <!--[if !IE]>-->
+ </object>
+ <!--<![endif]-->
+ </object>
+ </body>
+</html>

0 comments on commit 10839ab

Please sign in to comment.
Something went wrong with that request. Please try again.