I know and have successfully tested embedding fonts in order to get the dynamically create textfields to rotate, but I'm using CSS to change the properties of the textfield. Is there a way to rotate a field without setting the textField.defaultTextFormat property, because that causes problems with textField.styleSheets = style;
anyway, right now the code is set up is to run the .swf without using style sheets. the code that assigns the CSS Data to the textfield object is commented.
CODE
var request:URLRequest = new URLRequest("binary.css");
var ld:URLLoader = new URLLoader(request);
var style:StyleSheet = new StyleSheet();
ld.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
ld.addEventListener(Event.COMPLETE, loaderCompleteHandler);
function errorHandler(e:IOErrorEvent):void {
trace( "Couldn't load the style sheet file. " + e);
}
function loaderCompleteHandler(e:Event):void {
style.parseCSS(ld.data);
trace(style.styleNames);
}
var background:MovieClip = new background1();
var containerOW:Sprite = new Sprite();
containerOW.addChild(background);
var ow0:Sprite = new owBackground();
var ow1:Sprite = new owBackground();
var ow2:Sprite = new owBackground();
var ow3:Sprite = new owBackground();
var ow4:Sprite = new owBackground();
var ow5:Sprite = new owBackground();
var ow6:Sprite = new owBackground();
var ltContainer:Sprite = new Sprite();
var rtContainer:Sprite = new Sprite();
var rightTab0:Sprite = new Sprite();
var leftTab0:Sprite = new Sprite();
var rightTab1:Sprite = new Sprite();
var leftTab1:Sprite = new Sprite();
var rightTab2:Sprite = new Sprite();
var leftTab2:Sprite = new Sprite();
var rightTab3:Sprite = new Sprite();
var leftTab3:Sprite = new Sprite();
var rightTab4:Sprite = new Sprite();
var leftTab4:Sprite = new Sprite();
var rightTab5:Sprite = new Sprite();
var leftTab5:Sprite = new Sprite();
var rightTab6:Sprite = new Sprite();
var leftTab6:Sprite = new Sprite();
var owlt0:TextField = new TextField();
var owrt0:TextField = new TextField();
var owbody0:TextField = new TextField();
var owrt1:TextField = new TextField();
var owlt1:TextField = new TextField();
var owbody1:TextField = new TextField();
var owrt2:TextField = new TextField();
var owlt2:TextField = new TextField();
var owbody2:TextField = new TextField();
var owrt3:TextField =new TextField();
var owlt3:TextField = new TextField();
var owbody3:TextField = new TextField();
var owrt4:TextField = new TextField();
var owlt4:TextField = new TextField();
var owbody4:TextField = new TextField();
var owrt5:TextField = new TextField();
var owlt5:TextField = new TextField();
var owbody5:TextField = new TextField ();
var owrt6:TextField = new TextField();
var owlt6:TextField= new TextField();
var owbody6:TextField = new TextField();
var f:Font = new Arial();
var mytf:TextFormat = new TextFormat();
mytf.font = f.fontName;
var myMatrix:Matrix = new Matrix();
var myMatrix2:Matrix = new Matrix();
myMatrix.createGradientBox(30, 330, (90*Math.PI/180), 0, 0); //ow0.height
myMatrix2.createGradientBox(30, 420,(270*Math.PI/180), 0, 0); //ow0.height
var colors:Array = [0x4D77B9, 0x486ba6, 0x3e5987];
var colors2:Array = [0x4D77B9, 0x486ba6,0x3e5987];
var alphas:Array = [100, 100, 100];
var ratios:Array = [0, 150, 0xFF];
var storeHeight:Number = 100;
var shrinkSize:Number = .5;
var dimension:Array = [250, 213, 228, 220, 190];
function setOW(){
for(var qq:int=0; qq< 1; qq++){
this["ow"+qq].addChild(this["rightTab"+qq]);
this["ow"+qq].addChild(this["leftTab"+qq]);
this["ow"+qq].addChild(this["owbody"+qq]);
this["ow"+qq].addChild(this["owrt"+qq]);
this["ow"+qq].addChild(this["owlt" + qq]);
this["owrt"+qq].embedFonts = true;
this["owrt"+qq].antiAliasType = AntiAliasType.ADVANCED
this["owlt"+qq].antiAliasType = AntiAliasType.ADVANCED
this["owlt"+qq].embedFonts = true;
this["owrt"+qq].defaultTextFormat = mytf;
this["owlt"+qq].defaultTextFormat = mytf;
this["owrt"+qq].autoSize = TextFieldAutoSize.LEFT;
this["owlt"+qq].autoSize = TextFieldAutoSize.LEFT;
this["owbody"+qq].autoSize = TextFieldAutoSize.LEFT;
this["owrt"+qq].multiline = false;
this["owlt"+qq].multiline = false;
this["owbody"+qq].multiline = true;
this["owrt"+qq].wordWrap = false;
this["owlt"+qq].wordWrap = false;
this["owbody"+qq].wordWrap = true;
this["owrt"+qq].type = TextFieldType.DYNAMIC;
this["owlt"+qq].type = TextFieldType.DYNAMIC;
this["owbody"+qq].type = TextFieldType.DYNAMIC;
//this["owrt"+qq].styleSheet = style;
//this["owlt"+qq].styleSheet = style;
this["owbody"+qq].styleSheet = style;
this["owbody"+qq].width = this["ow"+qq].width - 50;
this["owbody"+qq].x = -375;
this["owbody"+qq].y = 175;
this["owrt"+qq].y = 50;
this["owrt"+qq].htmlText = '<p class="tabTitle">'+xml.ourWork.slide[qq].title.toString()+"</p>";
this["owlt" + qq].htmlText = '<p class="tabTitle">' + xml.ourWork.slide[qq].title.toString()+"</p>";
this["owbody"+qq].htmlText = '<p class="owBody">'+xml.ourWork.slide[qq].body.toString()+'</p>';
this["owrt"+qq].rotation += 90;
this["owlt"+ qq].rotation -= 90;
dimension[4] = this["owrt"+qq].width;
dimension[3] = dimension[4] +30;
dimension[2] = dimension[3] + 8;
dimension[1] = dimension[4] + 23;
dimension[0] = dimension[4] + 60;
this["rightTab"+qq].graphics.beginGradientFill(GradientType.LINEAR, colors2, alphas, ratios, myMatrix);
this["leftTab"+qq].rotation = 180;
this["leftTab"+qq].graphics.beginGradientFill(GradientType.LINEAR, colors2, alphas, ratios, myMatrix2);
this["rightTab"+qq].graphics.moveTo(0, 0);//, 300, 200);
this["leftTab"+qq].graphics.moveTo(0, 0);
this["rightTab"+qq].graphics.lineTo(0, dimension[0]);
this["leftTab"+qq].graphics.lineTo(0, dimension[0]);
this["rightTab"+qq].graphics.curveTo(3, dimension[2], 15, dimension[3]);
this["leftTab"+qq].graphics.curveTo(3, dimension[2], 15, dimension[3]);
this["rightTab"+qq].graphics.curveTo(27, dimension[1], 30, dimension[4]);
this["leftTab"+qq].graphics.curveTo(27, dimension[1], 30, dimension[4]);
this["rightTab"+qq].graphics.lineTo(30, 0);
this["leftTab"+qq].graphics.lineTo(30, 0);
this["rightTab"+qq].graphics.lineTo(0, 0);
this["leftTab"+qq].graphics.lineTo(0, 0);
this["rightTab"+qq].graphics.endFill();
this["leftTab"+qq].graphics.endFill();
containerOW.addChild(this["ow"+qq]);
if(qq == 0){
this["ow"+qq].x = stage.stageWidth/2;
this["ow"+qq].y = 250;//stage.stageHeight/2;
}else if(qq >=1 && qq <4){
this["ow"+qq].x = 200;
this["ow"+qq].scaleX = shrinkSize;
this["ow"+qq].scaleY = shrinkSize;
}else if(qq >= 4){
this["ow"+qq].x = 700;//stage.stageWidth;// + this["ow"+qq].width/2 - 50;
this["ow"+qq].scaleX = shrinkSize;
this["ow"+qq].scaleY = shrinkSize
}
if(this["ow"+(qq - 1)] != undefined && qq < 4){
this["ow"+qq].y = storeHeight;// + this["rightTab"+(qq-1)].height; )].height;
storeHeight += this["rightTab"+qq].height;
}else if(qq > 3){
this["ow"+qq].y = storeHeight;// + this["leftTab"+(qq-1)].height;
storeHeight += this["leftTab"+qq].height;
}
if(qq == 3)
storeHeight = 100;
if(qq == 0){
this["rightTab"+qq].x = this["ow"+qq].width/2;
this["rightTab"+qq].y = 0;
this["leftTab"+qq].x = (-1* this["ow"+qq].width/2) + 20;
this["leftTab"+qq].y = this["ow"+qq].height - this["leftTab"+qq].height;
}
else{
this["rightTab"+qq].x = this["ow"+qq].width/2 + 240;
this["rightTab"+qq].y = 0;
this["leftTab"+qq].x = (-1* this["ow"+qq].width/2) - 233;
this["leftTab"+qq].y = this["ow"+qq].height + 117;// - this["leftTab"+qq].height;
}
}
}
by the way, this code sample is a portion of a much larger 1800 line program, so certainly this code will not be sufficient in itself. I
This post has been edited by GarrettChristopherson: 13 Jun, 2008 - 08:47 PM