Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7847531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T17:55:44+00:00 2026-06-02T17:55:44+00:00

Please help to solve the geometric issue. I’m creating multiple sectors of the wheel.

  • 0

Please help to solve the geometric issue. I’m creating multiple sectors of the wheel. Now I need to be placed in every sector the text oriented from the center of the circle to the edge. But somehow, everything goes awry.

wheel

Here is the class of one sector:

package comps
{

    import flash.display.Shape;
    import flash.display.Sprite;
    import flash.filters.GlowFilter;
    import flash.geom.Matrix;
    import flash.geom.Point;
    import flash.geom.Vector3D;
    import flash.net.URLRequest;
    import flash.text.AntiAliasType;
    import flash.text.Font;
    import flash.text.TextField;
    import flash.text.TextFormat;
    import flash.text.TextFormatAlign;

    public class Sector extends Sprite
    {
        private var imageX1:Number;
        private var imageY1:Number;
        private var imageX2:Number;
        private var imageY2:Number;
        [Embed(source="font/SEGOEUIB.TTF", fontFamily="SegoeUI", mimeType="application/x-font", embedAsCFF="false", advancedAntiAliasing="true")]
        private var MoolEmbed:Class;

        public function Sector(tip:String, rot:Number, centerX:Number, centerY:Number, innerRadius:Number, outerRadius:Number, startAngle:Number, arcAngle:Number, val:Number, color:uint, alpha:Number, url:String, value:Number, steps:int=20)
        {
            Font.registerFont(MoolEmbed);

            var myArc:Sprite = new Sprite();
            myArc.graphics.lineStyle(2);
            myArc.graphics.beginFill(color, alpha);
            drawSolidArc (myArc,centerX, centerY, innerRadius, outerRadius, startAngle, arcAngle, url, steps);
            myArc.graphics.endFill();
            this.addChild(myArc);

                var myFormat:TextFormat = new TextFormat();
                myFormat.size = 20;
                myFormat.align = TextFormatAlign.CENTER;
                myFormat.font = 'SegoeUI';
                myFormat.bold = true;

                var myText:TextField = new TextField();
                myText.defaultTextFormat = myFormat;
                myText.setTextFormat(myFormat);
                myText.embedFonts = true;
                myText.antiAliasType = AntiAliasType.ADVANCED;
                myText.text = url;
                this.addChild(myText);

                myText.wordWrap = true;
                myText.width = outerRadius - innerRadius;
                myText.height = 20;
                var sectorsNum:Number = rot/360;
                textRotation(myText, rot*(sectorsNum-value) - rot*0.5, centerX, centerY);

                myText.x = imageX1 + 0 * (imageX2 - imageX1);
                myText.y = imageY1 + 0 * (imageY2 - imageY1);
                //trace (myText.x  + " " + myText.y);
                var myGlow:GlowFilter = new GlowFilter();
                myGlow.color = 0xFFFFFF; 
                myGlow.blurX = 20; 
                myGlow.blurY = 20; 
                myGlow.strength = 2;
                myText.filters = [myGlow];
            }
        }

        private function textRotation (target:TextField, angle:Number, centerX:Number, centerY:Number):void{
            var point:Point=new Point(centerX + target.width/2, centerY + target.height/2);

            var m:Matrix=target.transform.matrix;
            m.tx -= point.x;
            m.ty -= point.y;
            m.rotate (angle*(Math.PI/180));
            m.tx += point.x;
            m.ty += point.y;
            target.transform.matrix=m;
        }

        private function drawSolidArc (drawObj:Object, centerX:Number,centerY:Number,innerRadius:Number,outerRadius:Number,startAngle:Number,arcAngle:Number,url:String,steps:int=20):void {
            var twoPI:Number = 2 * Math.PI;
            var angleStep:Number = arcAngle/steps;
            var angle:Number, i:int, endAngle:Number;
            var xx:Number = centerX + Math.cos(startAngle * twoPI) * innerRadius;
            var yy:Number = centerY + Math.sin(startAngle * twoPI) * innerRadius;
            var xxInit:Number=xx;
            var yyInit:Number=yy;
            drawObj.graphics.moveTo(xx,yy);
            for(i=1; i<=steps; i++) {
                angle = (startAngle + i * angleStep) * twoPI;
                xx = centerX + Math.cos(angle) * innerRadius;
                yy = centerY + Math.sin(angle) * innerRadius;
                drawObj.graphics.lineTo(xx,yy);
                if (i==steps*0.5-1){
                    imageX1 = xx;
                    imageY1 = yy;
                }
            }
            endAngle = startAngle + arcAngle;
            for(i=0;i<=steps;i++) {
                angle = (endAngle - i * angleStep) * twoPI;
                xx = centerX + Math.cos(angle) * outerRadius;
                yy = centerY + Math.sin(angle) * outerRadius;
                drawObj.graphics.lineTo(xx,yy);
                if (i==steps*0.5){
                    imageX2 = xx;
                    imageY2 = yy;
                }
            }
            drawObj.graphics.lineTo(xxInit,yyInit);
        }
    }
}

And that’s creating all the wheel:

sectorsNum = tarotAC.length;
                for (var i:int = 0; i < sectorsNum; i++){
                    var arcAngle:Number = - 1/sectorsNum;
                    var startAngle:Number = arcAngle*i;
                    var arc:Sector = new Sector(FlexGlobals.topLevelApplication.mode, 360/sectorsNum, 0, 0, stageW*0.1, stageW*0.5, startAngle, arcAngle, Number(sectorsNum - i), tarotAC.getItemAt(i).color, 1, tarotAC.getItemAt(i).datas, tarotAC.getItemAt(i).url);

                    con.addChild(arc);
                }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T17:55:46+00:00Added an answer on June 2, 2026 at 5:55 pm

    By looking at it, I would say your TextFields need to be moved up by their height. TextFields are created from the top and the coordinates you give them would fit better with the baseline. Maybe you could put your TextField in a Sprite, set the TextField’s y to -height and then manipulate the container instead of the text itself:

    var container:Sprite = new Sprite();
    container.addChild(myText);
    this.addChild(container);
    myText.y = -myText.height;
    textRotation(container, rot*(sectorsNum-value) - rot*0.5, centerX, centerY);
    //you should of course modify textRotation's first parameter type
    container.x = imageX1 + 0 * (imageX2 - imageX1);
    container.y = imageY1 + 0 * (imageY2 - imageY1);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please help! I need to produce a Crystal Report with multiple data columns, but
please help me solve this issue. I have a client using WCF. I don't
Please help me solve my big problem. in my on-line shopping project i created
Can any one please help me solve this. I am resizing some flash object/embed
I have a long string, ex: Please help me to solve this problem. This
Please help to the newbie in WPF! I need to build a TreeView with
Was wondering if somebody could please help me solve this. I've follwed all steps
Could someone please help solve this problem?
Please help me solve this file path conflict: As you know, many HTML pages
Please help to solve this small problem: I try to decode incoming jpg data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.