| Flashscript classes (ActionScript 3) | Home | MX | MX 2004 | Flash 8 | Flash 9 |Flash 10 |PHP |Components | Snippets | Contact | |
CurveText |
|
|
See also
| Property | Defined By |
|---|---|
|
horiZontal
: Boolean
Create vertical or horizontal text. |
CurveText |
|
setAngleFactor
: Number
This determines the distribution of the letters. |
CurveText |
| Method | Defined By |
|---|---|
|
CurveText()
Creates a new instance of the CurveText class. |
CurveText |
|
createCurve(_string:String, pathWidth:int=150, pathHeight:int=150, radius:int=0, _textSpace:int=2, fontsSize:int=12, textColors:uint=0x000000, myFont:String="Arial")
This is the main function to create the arched text. |
CurveText |
| Event | Defined By |
|---|---|
| All inherited events for the Sprite class. | N/A |
| Property Detail |
|---|
|
horiZontal
property
horiZontal:Boolean [read-write] Create vertical or horizontal text. Implementationpublic function get horiZontal():Booleanpublic function set horiZontal(value:Boolean):void |
|
setAngleFactor
property
horiZontal:Number [read-write] This determines the distribution of the letters. Implementationpublic function get setAngleFactor():Numberpublic function set setAngleFactor(value:Number):void |
| Constructor Detail |
|---|
|
CurveText () Constructor
public function CurveText() |
| Intializes a new CurveText instance. |
| Method Detail |
|---|
|
createCurve() method
This is the main function to create the arched text. |
Parameters
|
| Event Detail |
|---|
|
All Events are inherited from the Sprite class. |
| Examples |
|---|
Create a new fla file and name it CurveText.fla. Place the fla in the same folder as the biz folder. Put ComboBox components, one TextInput component and one Button component on the stage, name them according to the script. Then create an Actionscript file, name it Curvetext.as and place this script.
package
{
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import biz.flashscript.text.CurveText;
public class Curvetext extends Sprite
{
private var ms:String = "Initial Text";
private var pathWidth:int = 150;
private var pathHeight:int = 150;
private var _textSpace:int = 40;
private var radius:int = 180;
private var angle:Number = 1;
private var fontsSize:int = 14;
private var textColors:uint = 0x000000;
private var myFont:String = "Arial";
private var ct:CurveText;
public function Curvetext ():void
{
createNewCurve ();
ct.createCurve (ms, pathWidth, pathHeight, radius,_textSpace, fontsSize, textColors, myFont);
submitBut.width = 125;
submitBut.label = "Create new text";
submitBut.addEventListener (MouseEvent.CLICK, it);
fontSelection.addItem ({label:"Helvetica"});
fontSelection.addItem ({label:"Impact"});
fontSelection.addItem ({label:"Arial"});
fontSelection.addItem ({label:"Courier"});
fontSelection.addEventListener (Event.CHANGE, fs);
colorSelection.addItem ({label:0x000000});
colorSelection.addItem ({label:0xFF0000});
colorSelection.addItem ({label:0x0000FF});
colorSelection.addItem ({label:0x00FF00});
colorSelection.addEventListener (Event.CHANGE, cos);
circleRadius.addItem ({label:90});
circleRadius.addItem ({label:180});
circleRadius.addItem ({label:270});
circleRadius.addItem ({label:360});
circleRadius.addEventListener (Event.CHANGE, cr);
fSize.addItem ({label:12});
fSize.addItem ({label:14});
fSize.addItem ({label:16});
fSize.addItem ({label:18});
fSize.addEventListener (Event.CHANGE, fos);
pWidth.addItem ({label:50});
pWidth.addItem ({label:100});
pWidth.addItem ({label:150});
pWidth.addItem ({label:200});
pWidth.addEventListener (Event.CHANGE, pw);
pHeight.addItem ({label:50});
pHeight.addItem ({label:100});
pHeight.addItem ({label:150});
pHeight.addItem ({label:200});
pHeight.addEventListener (Event.CHANGE, ph);
}
private function createNewCurve ():void
{
if (ct != null)
{
removeChild (ct);
ct = null;
}
ct = new CurveText();
ct.x = 300;
ct.y = 300;
addChild (ct);
}
private function it (e:MouseEvent):void
{
createNewCurve ();
ms = insertText.text;
ct.createCurve (ms, pathWidth, pathHeight, radius,_textSpace, fontsSize, textColors, myFont);
}
private function fs (e:Event):void
{
createNewCurve ();
myFont = e.currentTarget.selectedItem.label as String;
ct.createCurve (ms, pathWidth, pathHeight, radius,_textSpace, fontsSize, textColors, myFont);
}
private function cr (e:Event):void
{
createNewCurve ();
radius = e.currentTarget.selectedItem.label as int;
ct.createCurve (ms, pathWidth, pathHeight, radius,_textSpace, fontsSize, textColors, myFont);
}
private function fos (e:Event):void
{
createNewCurve ();
fontsSize = e.currentTarget.selectedItem.label as int;
ct.createCurve (ms, pathWidth, pathHeight, radius,_textSpace, fontsSize, textColors, myFont);
}
private function pw (e:Event):void
{
createNewCurve ();
pathWidth = e.currentTarget.selectedItem.label as int;
ct.createCurve (ms, pathWidth, pathHeight, radius,_textSpace, fontsSize, textColors, myFont);
}
private function ph (e:Event):void
{
createNewCurve ();
pathHeight = e.currentTarget.selectedItem.label as int;
ct.createCurve (ms, pathWidth, pathHeight, radius,_textSpace, fontsSize, textColors, myFont);
}
private function cos (e:Event):void
{
createNewCurve ();
textColors = e.currentTarget.selectedItem.label as uint;
ct.createCurve (ms, pathWidth, pathHeight, radius,_textSpace, fontsSize, textColors, myFont);
}
}
}
|