Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: michaelforrest/tidy-as3
base: 1bc096caa7
...
head fork: michaelforrest/tidy-as3
compare: ab3fda7ab3
  • 3 commits
  • 4 files changed
  • 0 commit comments
  • 1 contributor
50 tidy/mvc/helper/ColorHelper.as
View
@@ -24,5 +24,55 @@ package tidy.mvc.helper {
var resultColor:uint = resultA << 24 | resultR << 16 | resultG << 8 | resultB;
return resultColor;
}
+ // from http://snipt.net/tafaridh/conver-rgb-values-to-hex-string-or-number-and-back/
+ // TODO: clean up.
+ public static function stringToNumber(str:String, base:Number=16):Number {
+ //trace("we start with "+str);
+ var nVal:Number = 0;
+ var tVal:Number = 0;
+ var charz:Array = str.split("");
+ charz.reverse();
+ for (var a:int; a<charz.length; a++) {
+ nVal = 0;
+ var val:String = charz[a];
+ if (!isNaN(Number(val))) {
+ //trace("should be a Number="+val);
+ nVal = Number(val);
+ } else {
+ val = val.toLocaleLowerCase();
+ switch (val) {
+ case "a" :
+ nVal = 10;
+ break;
+ case "b" :
+ nVal = 11;
+ break;
+ case "c" :
+ nVal = 12;
+ break;
+ case "d" :
+ nVal = 13;
+ break;
+ case "e" :
+ nVal = 14;
+ break;
+ case "f" :
+ nVal = 15;
+ break;
+ default :
+ charz.splice(charz.indexOf(val),1);
+ a--;
+ //trace(val+" is not a valid value");
+ break;
+ }
+ }
+ var pwr :Number = Math.pow(base, a);
+ //trace("pwr = "+pwr);
+ nVal *= pwr;
+ tVal += nVal;
+ //trace(a+"start = "+val+", new = "+nVal+", total = "+tVal);
+ }
+ return tVal;
+ }
}
}
1  tidy/mvc/helper/TypographyBase.as
View
@@ -202,6 +202,7 @@ package tidy.mvc.helper
public var filters : Array = [];
+ public var cssStyles : Object = {};
protected function Defaults() : void {
}
12 tidy/mvc/view/PackableView.as
View
@@ -43,10 +43,10 @@ package tidy.mvc.view {
}
super.setOptions(options);
}
-
- public function append(element : DisplayObject) : DisplayObject {
+
+ public function append(element : DisplayObject, options:Object = null) : DisplayObject {
if(!element.parent) addChild(element);
- placeElement(element);
+ placeElement(element,options);
elements.add(element);
return element;
}
@@ -60,15 +60,16 @@ package tidy.mvc.view {
return elements;
}
- protected function placeElement(element : DisplayObject) : void {
+ protected function placeElement(element : DisplayObject,options:Object = null) : void {
+ var offset : Number = options && !isNaN(options.offset) ? options.offset : 0;
if(orientation == VERTICAL){
if(maxHeight && nextY + element.height > maxHeight) {
nextY = paddingTop;
nextX += columnWidth + spacing;
}
+ nextY += offset;
moveElement(element,nextX,nextY);
nextY += element.height + spacing;
-// trace("object", this,unique_id, "y=", element.y,"element.height=",element.height,"nextY",nextY);
}else{
maxRowHeight = Math.max(maxRowHeight, element.height);
if(maxWidth && nextX + element.width > maxWidth) {
@@ -76,6 +77,7 @@ package tidy.mvc.view {
nextX = paddingLeft;
maxRowHeight = 0;
}
+ nextX += offset;
moveElement(element,nextX,nextY);
nextX = element.x + element.width + spacing;
}
26 tidy/mvc/view/TidyTextField.as
View
@@ -4,6 +4,8 @@ package tidy.mvc.view
import tidy.mvc.helper.ColorHelper;
import tidy.mvc.helper.TypographyBase;
+ import flash.geom.Point;
+ import flash.text.StyleSheet;
import flash.text.TextField;
import flash.text.TextFormat;
@@ -23,11 +25,23 @@ package tidy.mvc.view
if(v.embedFonts && v.font.substr(0,1)=="_")
Log.warn("The font name starts with \"_\" and the font is set as embedded");
+ mouseWheelEnabled = false;
+
var formats:Object = __style.getTextFieldParams();
for(var i:String in formats) this[i] = formats[i];
var fmt : TextFormat = __style.getTextFormat();
+
+
defaultTextFormat = fmt;
setTextFormat(fmt);
+
+ if(style.html){
+ var stylesheet : StyleSheet = new StyleSheet();
+ for (var styleName : String in style.cssStyles) {
+ stylesheet.setStyle(styleName, style.cssStyles[styleName]);
+ }
+ this.styleSheet = stylesheet;
+ }
}
public var autoAssignText : Boolean = true;
@@ -64,6 +78,16 @@ package tidy.mvc.view
textColor = ColorHelper.interpolate(style.color, inverse, v);
}
-
+ public function setPosition(...args) : TidyTextField {
+ if(args[0] is Point) {
+ var position : Point = args[0] as Point;
+ x = position.x;
+ y = position.y;
+ }else{
+ x = args[0];
+ y = args[1];
+ }
+ return this;
+ }
}
}

No commit comments for this range

Something went wrong with that request. Please try again.