It is currently 28 Mar 2017, 11:04



Troubles using TLF text fields

Videos, graphics, Flash templates – how to create and play them using CasparCG

Moderators: Macey, Jonas Hummelstrand, didikunz

Troubles using TLF text fields

Postby Ultravibe » 16 Oct 2016, 19:36

Hello guys! Here is the issue:
I have some text field inside the movie clip. And if its width greater than specific amount - i need to squeeze the text field horisontally to fit some fixed area. My multiple tries doesn't give an effect: FullClip.width = 300 doesn't change the WIDTH of text, but change the visible area of this text.
Later i tried TLF tex field and the command FullClip.width = 300 affects correctlly. Text field fits up to area 300 px wide. And then goes troubles...
After that i compile template into .FT and uses it with CasparCG. Error is: Could not set data on layer 10. The method setData was not found. Why is it so? How can TLFTextField can affect on setData?
When i use TextField instead of TLFTextField - everything is OK, like it was before, but .width property does not affect on width of text field. What am i gonna do?
User avatar
Ultravibe
 
Posts: 275
Joined: 11 Jan 2015, 09:05

Re: Troubles using TLF text fields

Postby didikunz » 16 Oct 2016, 19:41

Use dynamic textfields and scale with the scaleX property.
Didi Kunz
CasparCG Client-Programmer, Template Maker & Live CG-Operator
Media Support, CH-5722 Gränichen, Switzerland http://mediasupport.ch/
Problems? Guide to posting Bug reports & Feature requests
User avatar
didikunz
 
Posts: 3401
Joined: 10 May 2010, 09:08
Location: Aarau, Switzerland

Re: Troubles using TLF text fields

Postby Ultravibe » 16 Oct 2016, 19:50

Hello Didi! I tried this way, but .scaleX property affects on bitmap data, graphics (like drawRect etc. ) but doesn't affect on width of text. Why i can't operate with TLF?
User avatar
Ultravibe
 
Posts: 275
Joined: 11 Jan 2015, 09:05

Re: Troubles using TLF text fields

Postby Ultravibe » 16 Oct 2016, 20:27

Here is examples
Attachments
right.jpg
That's how it should look if .width property will affects
right.jpg (65.78 KiB) Viewed 730 times
wrong.jpg
That's how it looks like now
wrong.jpg (66.31 KiB) Viewed 730 times
User avatar
Ultravibe
 
Posts: 275
Joined: 11 Jan 2015, 09:05

Re: Troubles using TLF text fields

Postby didikunz » 16 Oct 2016, 20:48

I use this routine to scale the text, for many years now:

Code: Select all
private static function ScaleDownTextField(Input:String, Field:TextField, initialFieldWidth: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;
   }
}

You give it the input text, the dynamic textfield and the with of the field as it should be (the parameter is called initialTextWidth, but it's the width it should have in the end).
Didi Kunz
CasparCG Client-Programmer, Template Maker & Live CG-Operator
Media Support, CH-5722 Gränichen, Switzerland http://mediasupport.ch/
Problems? Guide to posting Bug reports & Feature requests
User avatar
didikunz
 
Posts: 3401
Joined: 10 May 2010, 09:08
Location: Aarau, Switzerland

Re: Troubles using TLF text fields

Postby Ultravibe » 16 Oct 2016, 20:58

It looks proper. But in my case Field.scaleX doesn't work. May be it's because my class extends Sprite, not MovieClip?
User avatar
Ultravibe
 
Posts: 275
Joined: 11 Jan 2015, 09:05

Re: Troubles using TLF text fields

Postby didikunz » 16 Oct 2016, 21:16

Ultravibe wrote:It looks proper. But in my case Field.scaleX doesn't work. May be it's because my class extends Sprite, not MovieClip?


Probably.
Didi Kunz
CasparCG Client-Programmer, Template Maker & Live CG-Operator
Media Support, CH-5722 Gränichen, Switzerland http://mediasupport.ch/
Problems? Guide to posting Bug reports & Feature requests
User avatar
didikunz
 
Posts: 3401
Joined: 10 May 2010, 09:08
Location: Aarau, Switzerland

Re: Troubles using TLF text fields

Postby Ultravibe » 17 Oct 2016, 00:32

I decide to use TLFTextField, but absolutely nessesary to "Embedd the code" in ActionScript setting))))
this solves the problem
User avatar
Ultravibe
 
Posts: 275
Joined: 11 Jan 2015, 09:05


Return to Content

Who is online

Users browsing this forum: No registered users and 2 guests