Dynamic Text with multi line (AS) disappearing on stop command


#1

Hi i have built a template that is using an alpha layer to animate the text on and off, the animate on works perfectly fine but as soon as i push the stop() command the Text is disappearing. .

here is the AS i am using… would anyone know why?

package
{
import flash.display.MovieClip;
import flash.text.TextFieldAutoSize;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.events.Event;
import se.svt.caspar.ICommunicationManager;
import se.svt.caspar.IRegisteredDataSharer;
import se.svt.caspar.template.CasparTemplate;
import caurina.transitions.Tweener;

public class MultilineBaseline extends CasparTemplate
{
	
	private const customParameterDescription:XML = 	
	<parameters>
   		<parameter id="f0" type="string" info="textfield" />
	</parameters>;
	
	private var init:Boolean = false;
	private var initialWidth;
	private var initialX;
	private var lines:Array;
	private var lineNum = 0;
	private var align;
	
		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;
		}
	}
	override public function Next():void 
	{
		if (this.lineNum < this.lines.length) {
			ScaleDownTextField(this.lines[this.lineNum], F0.f0, this.initialWidth, this.initialX, this.align );
			this.lineNum ++
		}
	}
		
	override public function SetData(xmlData:XML):void 
	{	
		if (! this.init) {
			this.initialWidth = F0.f0.width;
			this.initialX = F0.f0.x;
			this.init = true;
		}
		

	   for each (var element:XML in xmlData.children())
	   {  
		  if (element.@id == "f0") 		
		  {
			  this.lines = element.data.@value.split("\n");
			  this.lineNum = 0;
			  this.Next()			  
		  }
	   }

	}
}

}


#2

I think I had a similar problem, are you using Classic Tween or Motion Tween?

When I’ve started using Motion Tween my problem was solved.