Skip to content

Instantly share code, notes, and snippets.

@pfeilbr
pfeilbr / Adobe AIR HTML Control <-> JavaScript Communication Example
Created March 20, 2010 10:06
Adobe AIR HTML Control <-> JavaScript Communication Example
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete="init()">
<mx:HTML left="10" top="10" bottom="10" right="10" id="html"/>
<mx:Script>
<![CDATA[
private function init():void {
html.addEventListener(Event.COMPLETE, this.htmlComplete);
html.htmlText = Helper.html();
}
@dgs700
dgs700 / objectToQueryString.js
Created January 30, 2013 22:39
Javascript object to URL encoded query string converter. Code extracted from jQuery.param() and boiled down to bare metal js. Should handle deep/nested objects and arrays in the same manner as jQuery's ajax functionality.
var objectToQueryString = function (a) {
var prefix, s, add, name, r20, output;
s = [];
r20 = /%20/g;
add = function (key, value) {
// If value is a function, invoke it and return its value
value = ( typeof value == 'function' ) ? value() : ( value == null ? "" : value );
s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
};
if (a instanceof Array) {