I need to be able to combine two or more dynamic text boxes in my flash template, based on information sent from the cgData when playing the template.
Information is sent in (i.e. first name in regular font & last name in bold font), and I would like based on the width of each text box to display the first name aligned left, and the last name immediately next to it, so as to appear as the full name.
I have managed to make the text boxes expandable so as to grow or shrink to the contents (by double clicking on the bottom right of the text boxes so as to unlock the fixed width handle).
I then inside an .as file assign the x position of the last_name to first_name.x + first_name.textWidth and works fine using dummy text inside the .fla.
When I try to call this template inserting it with cgData however, the calculations are wrong since it is still calculating based on the dummy text in the .fla, and not the width of the data that is sent in.
I know this is more of an actionscript question, but is there somewhere i.e. a function or something that I can override in Caspar, where I can call my resize methods after the data is sent in and the values are the ones sent in?
I have tried overriding the SetData method, but still no use:
public class Main extends CasparTemplate
override public function SetData(xmlData:XML):void
Text.last_name.x = Text.first_name.x + Text.first_name.textWidth + 10;
If I understood correctly you wish to have different styles in the same text box.
With Actionscript you can put HTML formatted text and so change styles in the middle of the text with tags.
Unfortunately I cannot find the working prototype, so I made a little search and should be something like this
var myText:String = "<p>This is <b>some</b> content to <i>render</i> as <u>HTML</u> text.</p>";
myTextBox.htmlText = myText;
well I do remember the .htmlText but not much more
I hope it helps
Thanks a lot for your prompt reply and the help, I finally figured it out, I forgot to import flash.textFieldAutoSize.
Now it’s working fine, but something is messing with the mask that I’ve added, when timeline reaches the first stop() action, when trying to play out animation, it just jumps to the last frame instead of playing all the frames. I’ll upload also the .fla file tomorrow .