Text problem while using masked animations and autosize script


#1

Hello, I’m trying to create a text with a mask animation, it works, but when I try to use a AutoSize Script the text disappears.

Any type of help is welcome! :slight_smile:

Files: https://drive.google.com/open?id=1B1-2uEhc2nPyPzYXJ8qVaTq_IMWqHtSp


#2

Try with this code:

		private static function ScaleDownTextField(Input:String, Field:TextField, initialFieldWidth:int, initialFieldX:int, align:int):void
		{
			var wi:int = initialFieldWidth;
		    Field.autoSize = TextFieldAutoSize.LEFT;
			Field.scaleX = 1;
		    Field.text = Input;
			if (wi < Field.width)
			{
		    	Field.scaleX = wi / Field.width;
			}
		
			if (align == 0)  //left
			{
				Field.x = initialFieldX;
			}
			if (align == 1)  //center
			{
				Field.x = initialFieldX + (initialFieldWidth - Field.width) / 2;
			}
			if (align == 2)  //right
			{
				Field.x = initialFieldX + initialFieldWidth - Field.width;
			}
		}

Arguments:

  • Input: the text (element.data.@value).
  • Field: The instance name of the textfield
  • initialFieldWidth: Maximal width the field should have
  • initialFieldX: The x-coordinate of the field
  • align: 0=Left, 1=Center, 2=Right

#3

Hi didikunz!
Your code is working for me, but when my mask reach the last frame of the animation the text changes to the text I’ve written on Adobe Flash.

Prints: https://imgur.com/a/XjawTXA

Files: https://drive.google.com/open?id=1Mb_RUn7VYylJYdbaR27GUwajsBGserG7

Thanks!


#4

Make sure, that the tween of the text is in one piece, use a motion tween.


#5

Worked using a motion tween on the text’s mask!

Thanks for the help didikunz!