Skip to content

Instantly share code, notes, and snippets.

View ThomasBurleson's full-sized avatar

Thomas Burleson ThomasBurleson

View GitHub Profile
@ThomasBurleson
ThomasBurleson / gist:1063561
Created July 4, 2011 16:15 — forked from bclinkinbeard/gist:1062343
Signals with Swiz and [SignalHandler]
package control
{
public class AlertsController
{
[Inject( "alertsDelegate" )]
public var delegate:CacheEnabledDelegate;
[Inject]
public var serviceHelper:IServiceHelper;
@ThomasBurleson
ThomasBurleson / gist:1132066
Created August 8, 2011 16:13
BabelFx with Swiz and PopupManager
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:swiz="http://swiz.swizframework.org"
minWidth="955" minHeight="600">
<!--
When using Swiz with dynamic content shown in popup windows
it is best to manually `register` the content instance as
a new `bean` with Swiz: easily done with BeanEvent.SET_UP_BEAN.
@ThomasBurleson
ThomasBurleson / gist:1132281
Created August 8, 2011 17:48
BabelFx with Swiz and Popup Behaviors
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:swiz="http://swiz.swizframework.org"
minWidth="955" minHeight="600" >
<fx:Script>
<![CDATA[
import com.codecatalyst.factory.ClassFactory;
import mx.effects.Fade;
@ThomasBurleson
ThomasBurleson / gist:1157828
Created August 19, 2011 19:52
AS3 Closures Cleanup
public class Something
{
public function doSomething(index:int) : void
{
// Async closure for timer completion event
function onComplete_doSomething(evt:TimerEvent) : void
{
// Always clean up 1st, then notify listeners
timer.removeEventListener(TimerEvent.TIMER, onComplete_Timer );
@ThomasBurleson
ThomasBurleson / gist:1157958
Created August 19, 2011 20:43
Most `flexible` policy file (cross-domain.xml)
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*" secure="false"/>
<allow-http-request-headers-from domain="*" headers="*" secure="false"/>
</cross-domain-policy>
@ThomasBurleson
ThomasBurleson / NoBorder.fxg
Created August 24, 2011 00:49 — forked from bclinkinbeard/NoBorder.fxg
AS3 Bar Skin for Mobile
<Graphic version="2.0" xmlns="http://ns.adobe.com/fxg/2008"
scaleGridLeft="0" scaleGridTop="0" scaleGridRight="0" scaleGridBottom="0">
<Rect x="0" y="0" width="1" height="1">
<fill>
<SolidColor color="#FFFFFF" alpha="0" />
</fill>
</Rect>
</Graphic>
@ThomasBurleson
ThomasBurleson / gist:1187324
Created September 1, 2011 21:24
Swiz Chaining... add a chaining idle delay easily with DelayChainStep
package ext.swizframework.utils.chain
{
import flash.events.TimerEvent;
import flash.utils.Timer;
import org.swizframework.utils.chain.BaseChainStep;
import org.swizframework.utils.chain.IAutonomousChainStep;
public class DelayChainStep extends BaseChainStep implements IAutonomousChainStep
{
@ThomasBurleson
ThomasBurleson / gist:1201605
Created September 7, 2011 20:17
AS3 complex string replacements with Regular Expressions (RegExp)
/**
* Use regular expressions to easily replace tokens within specific patterns
* Here we are using SWFAddress with deep linking to update the browser fragment
*/
var url1 : String = "http://www.test.com/ria.html#/user/100083?view=13432&filter=all&layout=horizontal"
var url2 : String = "http://www.test.com/ria.html#/user/100083&filter=all/edit"
// Here we want to update [with filter value above] only the section filter=xxx;
// without affecting any other part of the fragment...
@ThomasBurleson
ThomasBurleson / gist:1285433
Created October 13, 2011 20:31
AS3 code formatting similar to that seen in jQuery and Coffeescript.
candidates.where { n =>
!followers.any { f => f.user.id != n.user.id } &&
!followedBefore.any { f => f.user.id != n.user.id }
}
.where { it => /Flash | ActionScript | Adobe/.test(it.bio) }
.forEach { m => // TODO: do something with 'm' };
@ThomasBurleson
ThomasBurleson / gist:1368417
Created November 15, 2011 21:30
Use of Deferreds and Promises with Adventure.js for HTML5 Video Popcorn.js SDK
/**
* Below is excerpted code that was improved to properly use Deferreds, construction, and $.when()
*
* @see https://github.com/rwldrn/adventure/blob/master/src/adventure.js
**/
init: function( options ) {
// Program references
var