Skip to content

Instantly share code, notes, and snippets.

View ThomasBurleson's full-sized avatar

Thomas Burleson ThomasBurleson

View GitHub Profile
@ThomasBurleson
ThomasBurleson / Chaining with Async Events
Created May 25, 2011 13:17
Swiz EventChains with conditionals
[EventHandler(event="DeviceEvent.LOAD_SUMMARY",properties="device,filters,forceLoad")]
/**
* Here is an example of Parallel chaining. Developers should not that the workflow() method returns
* IAsynchronousOperation to allow workflow() to be itself chained with other eventHandlers.
*
* - DeviceEvent extends AsynchronousEvent.
* - FunctionChainStep is also available
*
* Here we get Device Snapshot information (includes upTimes and durationInState)
*/
@ThomasBurleson
ThomasBurleson / gist:1019075
Created June 10, 2011 15:40
Popup Behavior for any Flex component
/**
* Add Popup Behavior to any Flex UI!
*
* 1) Want to show UI Components in Popup?
* 2) Want to use show/hide effects, autoClose, modality?
* 3) Want to use anchor constraints (top, right, etc.) to position the popup anywhere relative to ANY parent?
* 4) Want to position the popup relative to the mouse or any other specific location?
* 5) Want to cache the popup content for super-fast reuse ?
* 6) Want it super easy... with no need to worry about events or memory cleanup?
*
@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: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' };