-
[v7] info.waterlijn classes
I decided to mention it in this thread when I create a class.
The zip file containing my classes can be found here
http://www.waterlijn.info/as3classes/classes.zip
The docs for my classes can be found here
http://www.waterlijn.info/as3docs/
The KM .fun examples here
http://www.waterlijn.info/as3examples/
-
The first class I created is a TextShape class to put text inside a custom container. The text is converted into a bitmap so some normal text options are not available.
It works like this ...
Code:
import info.waterlijn.display.*;
import flash.text.*;
var ts:TextShape = new TextShape();
addChild(ts);
var tf:TextFormat = new TextFormat('_sans', 12);
tf.align = TextFormatAlign.JUSTIFY;
ts.defaultTextFormat = tf;
ts.text = 'This is a text that will be placed inside the defined containers.';
ts.addContainer(TextShape.MULTI_POINT, [0, 0], [420, 0], [560, 70, 500, 140], [500, 210, 420, 280], [0, 280], [140, 210, 80, 140], [80, 70, 0, 0]);
ts.addContainer(TextShape.RECTANGLE, 80, 300, 450, 80);
ts.background = true;
ts.render();
Here are two examples ...
http://www.waterlijn.info/as3example...eExample1.html
http://www.waterlijn.info/as3example...eExample2.html
-
KoolMoves Moderator
You might consider clarifying the lines
TextShape.MULTI_POINT
and
TextShape.RECTANGLE
-
Did you look at the docs Bret ?
http://www.waterlijn.info/as3docs/in...addContainer()
I'm not sure how to explain it better.
-
up to my .as in code
Those constants are exposed in the class (see class file as always).
If type sent in via the constructor is:
TextShape.RECTANGLE or TextShape.ELLIPSE it expects four arguments which are then used with the graphics property (TextShape extends Sprite and therefore has a graphics property that is an instance of the flash.display.Graphics class) to draw either an ellipse or rectangle :
sContainers.graphics.beginFill(numContainers);
sContainers.graphics[type == 0 ? 'drawRect' : 'drawEllipse'](args[0], args[1], args[2], args[3]);
sContainers.graphics.endFill();
If TextShape.MULTI_POINT, it expects argument arrays (either two integers or four per ) and depending on the argument length (2 or 4) it either draws a line or a curve respectively (again...using the graphics property) and assuming you've worked out the points ahead of time the last point would be the starting point thereby closing the container.
Wilbert, please feel free to correct me as it is after all your creation
Last edited by Chris_Seahorn; 02-14-2009 at 02:29 PM.
-
KoolMoves Moderator
Doh, missed it... Sorry...
I understood it, but was mostly concerned with other users not understanding it. Thanks for the well documented class Wilbert.
-
That web bloke
Originally Posted by w.brants
Did you look at the docs Bret ?
I didn't know he'd been ill!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|