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 4251204
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T04:37:49+00:00 2026-05-21T04:37:49+00:00

I’m trying to create the following component: Just for information, the blank space will

  • 0

I’m trying to create the following component:

enter image description here

Just for information, the blank space will contain a text control, and I’m creating a component that represents the black corner with the (i) icon and the “promotion” text.
The part I’m having issues with is this component representing the black corner with the diagonal text. The text has to be able to hold 2 lines. And the black corner has to be able to adjust to the text’s size.
What’s more, the text has a rotation…

I’m having some doubts on how to do this:

  • Should I have different controls for each text line?
  • Should I draw the text in the shape (after doing the rotation) or should I just overlap both components? [When I talk about drawing the text in the shape, I mean in the same way as asked in this question]
  • Is there any way to get the proper size of the triangle shape without doing some extravagant calculations?

And… do you have any “easier” ways to do this ?

A big thanks for any help you can provide 🙂 I’m a little bit lost with this little component 🙂

Regards.
BS_C3


Edit 1:

  • The triangle may have 2 sizes: 1 size that will fit 1 line, and another size to fit 2 lines of text.
  • The text will be sent as a single string, so it will have to be automatically divided in two lines if needed
  • I was thinking of using graphics to draw the triangle shape and then use a mask to create the rounded corner –> This is because the same component will be used in other places of the application without the rounded corner
  • 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-05-21T04:37:49+00:00Added an answer on May 21, 2026 at 4:37 am

    Well, I finally wrote the class and this is the result:

    public class Corner extends Canvas
    {
        private var infoIcon:Image;
        private var text:Text;
        private var triangle:Shape;
        private var bgColor:uint;
    
        public function Corner()
        {
            super();
    
            infoIcon = new Image;
    
            text = new Text;
            text.rotation = -45;
            text.width = 75;
            text.maxHeight = 30;
            text.setStyle('color', '0xffffff');
            text.setStyle('textAlign', 'center');
            text.y = 53;
    
            this.addChild(infoIcon);
            this.addChild(text);
    
            triangle = new Shape;
        }
    
        public function build(bgColor:uint = 0x61113D):void{
            this.bgColor = bgColor;
    
            // info icon data
    
            // set text     
            text.addEventListener(FlexEvent.UPDATE_COMPLETE, textHandler);
            text.text = 'blabla';
            text.validateNow();
        }
    
        /**
         * 
         */
        private function textHandler(e:FlexEvent):void{
            switch(e.type){
                case FlexEvent.UPDATE_COMPLETE:
                    text.removeEventListener(FlexEvent.UPDATE_COMPLETE, textHandler);
                    drawTriangle();
                    break;
            }
        }
    
        /**
         * 
         */
        private function drawTriangle():void{
            var h:int = 80;
            // check if the text has 1 or 2 lines
            if(text.height > 20)
                h = 95;
    
            // remove the triangle shape if it exists
            if(this.rawChildren.contains(triangle))
                this.rawChildren.removeChild(triangle);
    
            // draw triangle
            triangle = new Shape; 
            triangle.graphics.moveTo(0, 0);
            triangle.graphics.beginFill(bgColor);
            triangle.graphics.lineTo(h, 0);
            triangle.graphics.lineTo(0, h);
            triangle.graphics.lineTo(0, 0);
            triangle.graphics.endFill();
    
            this.rawChildren.addChildAt(triangle,0);
    
            dispatchEvent(new MyEvent(MyEvent.CORNER_UPDATED));
        }
    
        ...
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.