Skip to content

Instantly share code, notes, and snippets.

/*
****** Colors extracted from Reflow ******
// hex value RGB value Closest color Used isBackground?
//---------------------------------------------------------------------
// #000000 rgb(0,0,0) black 12 times
// #282729 rgb(40,39,41) *darkslategray 9 times
// #ffffff rgb(255,255,255) white 5 times background
// #7da7a6 rgb(125,167,166) *cadetblue 1 time background
// * means that color name is the closest match
@tpryan
tpryan / .properties
Created July 13, 2010 22:54
ant files for building and installing AIR for Android applications
flex.path= [Path to folder containing Flex SDKs]
flex.sdkVersion=[The name of the Flex SDK you wish to use]
flex.sdkPath=${flex.path}/${flex.sdkVersion}
FLEX_HOME=${flex.sdkPath}
contentText=[This value will be overwritten by Flash Builder in the output app.xml]
ADB = [Path to the Android SDK ADB File]
ADT = ${flex.sdkPath}/bin/adt
cert = [Path to the cert file you wish to sign app with]
component{
This.name = "cfartgallery";
This.ormenabled = true;
This.datasource = "cfartgallery";
}
<cf_pageWrapper>
<cf_uiWidget />
</cf_pageWrapper>
@tpryan
tpryan / build.xml
Created December 9, 2010 22:19
Fragment of an ANT script to compile Flex Hero for devices.
<target name="compile">
<echo message="Compiling swf"/>
<mxmlc file="${full path to the project File}" output="${Name for the compiled swf}">
<load-config filename="${FLEX_HOME}/frameworks/airmobile-config.xml"/>
<source-path path-element="${FLEX_HOME}/frameworks"/>
<static-link-runtime-shared-libraries />
<!-- Include this piece to pull in the Flex Framework or it won't compile. -->
<compiler.library-path dir="${FLEX_HOME}/frameworks" append="true">
<include name="libs/*" />
</compiler.library-path>
@tpryan
tpryan / build.xml
Created December 9, 2010 22:45
Ant build script that installs to Android Device and BlackBerry in the same build.
<?xml version="1.0" encoding="UTF-8"?>
<project name="AboutTime" default="" basedir=".">
<property file="settings.properties"/>
<!-- path to the flex task libraries. -->
<path id="flextasks.classpath">
<fileset dir="${FLEX_HOME}/ant/lib">
<include name="*.jar"/>
</fileset>
@tpryan
tpryan / gist:777064
Created January 12, 2011 22:50
ActionScript StageWebView snippet
protected var webView:StageWebView = new StageWebView();
protected function processAuth(event:ServiceEvent):void
{
var url:String = "http://theurl.com";
webView.addEventListener(Event.COMPLETE, afterAuthLoad);
webView.loadURL(url);
}
@tpryan
tpryan / ActionBar.mxml
Created June 23, 2011 19:38
Flex Mobile without actionBars
<?xml version="1.0" encoding="utf-8"?>
<s:ViewNavigatorApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
creationComplete="init(event)"
xmlns:s="library://ns.adobe.com/flex/spark" >
<fx:Script>
<![CDATA[
import flash.utils.clearInterval;
import flash.utils.setInterval;
import mx.events.FlexEvent;
@tpryan
tpryan / TimedClose.mxml
Created June 28, 2011 18:31
Mobile Application that closes itself 30 seconds after it loses focus.
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
creationComplete="init(event)"
xmlns:s="library://ns.adobe.com/flex/spark" >
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
public var closeTimer:Timer;
@tpryan
tpryan / example.as
Created September 2, 2011 14:56
Haversine Formula in ActionScript
private const RADIUS_OF_EARTH_IN_MILES:int = 3963;
private const RADIUS_OF_EARTH_IN_FEET:int =20925525;
private const RADIUS_OF_EARTH_IN_KM:int =6378;
private const RADIUS_OF_EARTH_IN_M:int =6378000;
private function distanceBetweenCoordinates(lat1:Number,lon1:Number,
lat2:Number,lon2:Number,
units:String="miles"):Number{
var R:int = RADIUS_OF_EARTH_IN_MILES;