Skip to content

Instantly share code, notes, and snippets.

View joshtynjala's full-sized avatar

Josh Tynjala joshtynjala

View GitHub Profile
@joshtynjala
joshtynjala / Binding.mxml
Created March 26, 2015 21:27
Feathers MXML binding
<?xml version="1.0" encoding="utf-8"?>
<f:LayoutGroup xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:f="library://ns.feathersui.com/mxml">
<f:layout>
<f:HorizontalLayout gap="10" horizontalAlign="center" verticalAlign="middle"/>
</f:layout>
<f:Slider id="slider1" minimum="0" maximum="1" value="0"/>
<f:Slider id="slider2" minimum="0" maximum="1" value="{slider1.value}"/>
</f:LayoutGroup>
@joshtynjala
joshtynjala / Sandbox.as
Created July 28, 2015 20:23
Root class for Feathers CreateJS experimental demo at http://joshblog.net/projects/feathers-createjs/demo/
package
{
import createjs.Event;
import createjs.Rectangle;
import createjs.Stage;
import createjs.Ticker;
import createjs.Touch;
import feathers.controls.ButtonState;
import feathers.controls.ScrollPolicy;
@joshtynjala
joshtynjala / MultiWindowFlexMediatorMap.as
Created September 5, 2010 07:32
When a RobotLegs mediator is created for an IWindow in Flex, this MediatorMap extension treats the window as a secondary contextView so that new children of the window automatically get mediators as well.
package org.robotlegs.base
{
import flash.display.DisplayObject;
import flash.display.DisplayObjectContainer;
import flash.display.Stage;
import flash.events.Event;
import flash.events.IEventDispatcher;
import mx.core.IWindow;
import mx.events.AIREvent;
@joshtynjala
joshtynjala / HideErrorString.mxml
Created March 3, 2011 19:08
Normally, a tool tip appears on roll over when the errorString property is set. This app demonstrates how to hide the error tip. Thankfully, Flex 4.5 adds the showErrorTip style, but this offers a workaround for older versions.
<?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:mx="library://ns.adobe.com/flex/mx">
<s:layout>
<s:VerticalLayout horizontalAlign="center" verticalAlign="middle"/>
</s:layout>
<s:RichText width="300">
@joshtynjala
joshtynjala / ShareRobotlegsCommands.as
Last active October 12, 2015 06:18
Share Robotlegs Commands between Flex and Feathers. You can use the regular Robotlegs Command class instead of the StarlingCommand class with a Starling context as long as you map a couple of things in your injector.
this.injector.mapSingletonOf(IMediatorMap, MediatorMap);
this.injector.mapSingletonOf(flash.display.DisplayObjectContainer, flash.display.Sprite);
@joshtynjala
joshtynjala / MyFirstTypeScript.ts
Created April 26, 2013 01:25
My First TypeScript
/// <reference path="libs/easeljs/easeljs.d.ts" />
/// <reference path="libs/underscore/underscore.d.ts" />
class Main extends createjs.Stage
{
constructor(canvas: HTMLCanvasElement)
{
super(canvas);
_.bindAll(this);
@joshtynjala
joshtynjala / GTween.as
Created July 8, 2013 16:49
GTween for Starling
/*
Copyright (c) 2012 Josh Tynjala
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
@joshtynjala
joshtynjala / CustomLayoutGroupItemRenderer.as
Last active December 28, 2015 08:59
Feathers: This subclass of LayoutGroupItemRenderer demonstrates how to create a simple custom item renderer.
package
{
import feathers.controls.Label;
import feathers.controls.renderers.LayoutGroupListItemRenderer;
import feathers.layout.AnchorLayout;
import feathers.layout.AnchorLayoutData;
public class CustomLayoutGroupItemRenderer extends LayoutGroupListItemRenderer
{
public function CustomLayoutGroupItemRenderer()
@joshtynjala
joshtynjala / ImageSkinExample.as
Created January 20, 2016 21:40
An example of skinning a button's states in Feathers 3.0
var skin:ImageSkin = new ImageSkin(upTexture);
skin.setTextureForState(ButtonState.DOWN, downTexture);
skin.setTextureForState(ButtonState.DISABLED, disabledTexture);
skin.scale9Grid = new Rectangle(2, 2, 1, 4);
button.defaultSkin = skin;
@joshtynjala
joshtynjala / CreateJS_RunningGrant.as
Last active March 4, 2016 01:28
ActionScript transpiled by FlexJS 0.5 RC1 using CreateJS library
package
{
import createjs.Bitmap;
import createjs.LoadQueue;
import createjs.Shape;
import createjs.Sprite;
import createjs.SpriteSheet;
import createjs.Stage;
import createjs.Ticker;
import createjs.TickerEvent;