• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Wrap a text around

Community Beginner ,
Sep 14, 2012 Sep 14, 2012

Copy link to clipboard

Copied

Hi I am using adobe flash pro CS6, and i was wondering how to make a text go around like in a circle, like it is on a coin... I don't know how to, thanks

TOPICS
ActionScript

Views

1.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 14, 2012 Sep 14, 2012

Copy link to clipboard

Copied

Normally I'd use Illiustrator for that and copy the text from there.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 15, 2012 Sep 15, 2012

Copy link to clipboard

Copied

LATEST

Here is one of the ways to do that.

Note that you need to embed fonts. In the code below fonts are embedded from the same folder as your fla.

The main idea is in the function placeLetters() in the for...each loop.

Just make this class your document class.

package

{

    import flash.display.Graphics;

    import flash.display.Sprite;

    import flash.text.Font;

    import flash.text.TextField;

    import flash.text.TextFormat;

   

    public class TextAround extends Sprite

    {

        private var text:String;

        private var container:Sprite;

        [Embed(source="ARIAL.TTF",fontName='_arial',mimeType="application/x-font",embedAsCFF='false',fontWeight='normal')]

        private var FONT:Class;

        private var radius:Number = 100;

       

        public function TextAround()

        {

            init();

        }

       

        private function init():void

        {

            text = "This is the text that goes around!!!";

            placeLetters();

        }

       

        private function placeLetters():void

        {

            var angle:Number = -90;

            container = new Sprite();

            container.x = stage.stageWidth * .5;

            container.y = stage.stageHeight * .5;

            var textField:TextField;

           

            for each (var s:String in text.split(""))

            {

                textField = new TextField();

                textField.defaultTextFormat = new TextFormat("_arial", 12);

                textField.embedFonts = true;

                textField.autoSize = "center";

                textField.wordWrap = textField.multiline = false;

                textField.text = s;

                textField.rotation = angle + 90;

                textField.x = radius * Math.cos(angle * Math.PI / 180);

                textField.y = radius * Math.sin(angle * Math.PI / 180);

                container.addChild(textField);

                angle += 6;

            }

           

            // draw circle

            var g:Graphics = container.graphics;

            g.beginFill(0xFF8040);

            g.drawCircle(0, 0, radius);

           

            addChild(container);

       

        }

   

    }

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines