Adding blank space at the end of string

Hi,

I need help with adding blank space at the end of string. I tried to append text " ", but it doesn’t work. Blank space always gets trimmed if it’s at the end of string. So, how do I work this around?

Thank you.

Were do you want to add it? To a textfield in Flash? In HTML? To you dogs tail? Please provide a bit more informations as we cannot read your mind.

To my dogs tail, obviously.

Textfield, of course. Flash/AS3

You are going to have to describe your problem in more detail.

Do you have any code examples to share?

How do you know that the space has been stripped?

I am afraid, that‘s what I expected.

No seriouse. I do that in code. Sometimes that is needed, as the font has a weird spacing and get cut of. I is possible, that the client trims it, so you should add the space inside the template. Can you post your .fla and .as file (not the .ft)?

Ok, sorry. I definitely need to provide you with more information.

I have created a text field in Flash, which is being filled from the client (Caspar Client). To the text that I’m entering from the client, I need to add blank space, at the end of it, using ActionScript. So what I need to get is: “text” + " " = "text ".

This is what I have tried so far:

textfield.text += " ";

textfield.appendText(" ");

var blankspace:String = " ";
textfield.appendText(blankspace);

I’ve even tried adding blank space from Unicode:

textfield.appendText(32);
textfield.appendText(160);

Every time the blank space at the end of the text gets trimmed. Same thing happens when I enter a text with the blank space at the end in the Client.

Were is that code residing? Are you sure, that the texfield has it‘s text set before your code runs?

The code is in the external AS3 class.

package
{
import flash.display.MovieClip;
import se.svt.caspar.ICommunicationManager;
import se.svt.caspar.IRegisteredDataSharer;
import se.svt.caspar.template.CasparTemplate;

public class testblanko extends CasparTemplate
{
	override public function SetData(xmlData:XML):void
	{
		super.SetData(xmlData);
		for each (var element:XML in xmlData.children())
		{
			if (element. @ id == "tekst")
			{
				var pom:String = String.fromCharCode(160);
				tekst.appendText(pom);
			}
	    }
		
	}
}

}

Try this:

public class testblanko extends CasparTemplate
{
	override public function SetData(xmlData:XML):void
	{
		super.SetData(xmlData);
		for each (var element:XML in xmlData.children())
		{
			if (element.@id == "tekst")
			{
				tekst.text = element.data.@value.toString() + " ";
			}
	    }
		
	}
}

Tried it. Same thing. Still trims it. I think the problem is not the syntax, but some kind of s setting in the Client or on the Server that automatically trims blank space at the end of the text, cause even when I enter "text " (with the blank space at the end) for the value of the textfield in the Client it still gets trimmed.

…and you are sure, that you added the class in your .fla file, so that it finds the .as file? Because doing it that way must work.
Grab2

In the red circle goes the name of the class in your case testblanko.

Of course.testblanko1

Can you upload the two files somewhere?