how to resize dynamic text textfield to responsive if stage size change? AS3

Viewed 34

I'm working on a puzzle game using text to arrange, for the blocks themselves I create a children DisplayObject which contains a Texfield and I set the size of the texfield using a variable because each frame has a different font size, for example:

var sizeOfTF = 35;

var my_text_format: TextFormat = new TextFormat();
my_text_format.size = sizeOfTF ; // set size
puzzle.text.defaultTextFormat = my_text_format;
puzzle.text.setTextFormat(my_text_format);
puzzle.text.autoSize = TextFieldAutoSize.LEFT;
stage.addChild(DisplayObject(puzzle));

then I have a project with a stage size of 720x1280 and the text appears normally, when I change the stage to 390x 694 with content scale enabled, the children do not change and the text size remains the same as at 720x1280.

how to know the font-size difference if the stage changes? or how to make children responsive adjust the size of the stage?

Previously I used scaleX and scaleY to set the font size but it only worked in one frame.

0 Answers
Related