Skip to content

Instantly share code, notes, and snippets.

@sixones
Created September 14, 2010 13:40
Show Gist options
  • Save sixones/579043 to your computer and use it in GitHub Desktop.
Save sixones/579043 to your computer and use it in GitHub Desktop.
package
{
import flash.display.Shape;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import org.stylekit.css.value.BorderCompoundValue;
import org.stylekit.css.value.ColorValue;
import org.stylekit.css.value.LineStyleValue;
import org.stylekit.css.value.SizeValue;
import org.stylekit.ui.element.UIElement;
/**
* StyleKit-as3 Demo Application
*
* - Create AS3 Project in Flex Builder
* - Copy contents of File into the main Actionscript file
* - Link Project to StyleKit-as3
*/
public class Main extends Sprite
{
protected var _parent:UIElement;
protected var _element:UIElement;
public function Main()
{
this.stage.scaleMode = StageScaleMode.NO_SCALE;
this.stage.align = StageAlign.TOP_LEFT;
this.graphics.clear();
// draw a box to give our app some form of shape
this.graphics.beginFill(0xFFFFFF, 0.1);
this.graphics.drawRect(0, 0, this.stage.stageWidth, this.stage.stageHeight);
this.graphics.endFill();
this._parent = new UIElement();
this._parent.evaluatedStyles = {
"width": SizeValue.parse("260px"),
"height": SizeValue.parse("200px"),
"margin-top": SizeValue.parse("10px"),
"margin-right": SizeValue.parse("10px"),
"margin-left": SizeValue.parse("10px"),
"margin-bottom": SizeValue.parse("10px"),
"background-color": ColorValue.parse("#990000"),
"border-left-color": ColorValue.parse("#000000"),
"border-left-width": SizeValue.parse("1px"),
"border-left-style": LineStyleValue.parse("solid"),
"border-right-color": ColorValue.parse("#000000"),
"border-right-width": SizeValue.parse("1px"),
"border-right-style": LineStyleValue.parse("solid"),
"border-top-color": ColorValue.parse("#000000"),
"border-top-width": SizeValue.parse("1px"),
"border-top-style": LineStyleValue.parse("solid"),
"border-bottom-color": ColorValue.parse("#000000"),
"border-bottom-width": SizeValue.parse("1px"),
"border-bottom-style": LineStyleValue.parse("solid"),
"border-top-right-radius": SizeValue.parse("0"),
"border-bottom-right-radius": SizeValue.parse("0"),
"border-bottom-left-radius": SizeValue.parse("0"),
"border-top-left-radius": SizeValue.parse("0")
};
this._element = new UIElement();
this._parent.addElement(this._element);
this._element.evaluatedStyles = {
"width": SizeValue.parse("100%"),
"height": SizeValue.parse("100%"),
"margin-top": SizeValue.parse("0px"),
"margin-right": SizeValue.parse("0px"),
"margin-left": SizeValue.parse("0px"),
"margin-bottom": SizeValue.parse("0px"),
"background-color": ColorValue.parse("#EEEEEE"),
"border-left-color": ColorValue.parse("#000000"),
"border-left-width": SizeValue.parse("2px"),
"border-left-style": LineStyleValue.parse("solid"),
"border-right-color": ColorValue.parse("#000000"),
"border-right-width": SizeValue.parse("2px"),
"border-right-style": LineStyleValue.parse("solid"),
"border-top-color": ColorValue.parse("#000000"),
"border-top-width": SizeValue.parse("2px"),
"border-top-style": LineStyleValue.parse("solid"),
"border-bottom-color": ColorValue.parse("#000000"),
"border-bottom-width": SizeValue.parse("2px"),
"border-bottom-style": LineStyleValue.parse("solid"),
"border-top-right-radius": SizeValue.parse("25px"),
"border-bottom-right-radius": SizeValue.parse("25px"),
"border-bottom-left-radius": SizeValue.parse("25px"),
"border-top-left-radius": SizeValue.parse("25px")
};
this.addChild(this._parent);
//this.addChild(this._element);
this._parent.redraw();
this._element.redraw();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment