dcsimg
A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: [v7] info.waterlijn classes

  1. #1
    Senior Member
    Join Date
    Dec 2002
    Location
    Netherlands
    Posts
    1,632

    [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/

  2. #2
    Senior Member
    Join Date
    Dec 2002
    Location
    Netherlands
    Posts
    1,632
    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

  3. #3
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    You might consider clarifying the lines

    TextShape.MULTI_POINT

    and

    TextShape.RECTANGLE

  4. #4
    Senior Member
    Join Date
    Dec 2002
    Location
    Netherlands
    Posts
    1,632
    Did you look at the docs Bret ?
    http://www.waterlijn.info/as3docs/in...addContainer()
    I'm not sure how to explain it better.

  5. #5
    up to my .as in code Chris_Seahorn's Avatar
    Join Date
    Dec 2004
    Posts
    4,389
    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

  6. #6
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    Doh, missed it... Sorry...

    I understood it, but was mostly concerned with other users not understanding it. Thanks for the well documented class Wilbert.

  7. #7
    That web bloke Stoke Laurie's Avatar
    Join Date
    Jan 2006
    Location
    England
    Posts
    869
    Quote 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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center