How to rotate a text box

Source: Internet
Author: User

Problem: Solution to disappear after dynamic text box rotation?
There is a button on the stage named btn. The first key frame in the code layer has the following statement:
_ Root. createTextFiled ("dy_txt", 999,100,100, 90,50 );
With (dy_txt ){
Border = true;
BorderColor = 0xff3388;
Background = true;
BackgroundColor = 0x111111;
Type = "dynamic"
Text = "I want to rotate"
}
Btn. onRelease = function (){
Dy_txt. _ rotation + = 10;
}

I want to rotate the dynamic text box by clicking the button. However, when the button is clicked, the dynamic text box disappears. Why? Please give me some advice. The source file is as follows:

Ywxgood answer:There are two ways to solve the problem of rotating text disappears:
1. Use the embedded font, that is, set the embedFonts attribute to true. For more information, see the help provided by flash.
2. Convert the text box to a bitmap.

The code is as follows:

//////////////////////////////////////// /////////////////////////////////
Import flash. display. BitmapData;
Import flash. geom. Matrix;
Import flash. geom. ColorTransform;
Import flash. geom. Rectangle;


_ Root. createTextField ("dy_txt", 1,100,200,100, 22 );

With (dy_txt ){
Border = true;
BorderColor = 0xff3388;
Background = true;
BackgroundColor = 0xff0000;
Type = "dynamic ";
Text = "Hello ";
TextColor = 0x000000;
}

Btn. onRelease = function (){
_ Mc. _ rotation + = 10;
};

// Create BitmapData with the same width and height as the text box
Var bp: BitmapData = new BitmapData (dy_txt. _ width, dy_txt. _ height, false );

// Display bitmap. The draw method of BitmapData is described in detail in this document.
This. createEmptyMovieClip ("_ mc", 2 );
Bp. draw (dy_txt, new Matrix (), new ColorTransform (), normal, new Rectangle (0, 0, dy_txt. _ width, dy_txt. _ height), true );

// If the rotation is not processed, you can directly use the following sentence to save the imported ColorTransform, Matrix, and Rectangle classes.
// Bp. draw (dy_txt );

_ Mc. attachBitmap (bp, 1 );

// Hide the original text box and set the location of bitmap editing
_ Mc. _ x = dy_txt. _ x;
_ Mc. _ y = dy_txt. _ y;
Dy_txt. _ visible = false;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.