Skip to main content
Participant
January 16, 2012
Answered

UIScrollBar.scrollTarget=TLFTextField gets compiler error in Flash CS5

  • January 16, 2012
  • 1 reply
  • 1223 views

Hello,

I would add a scrollbar to a TLFTextField, I know that should be possible because in the official documentation scrollTarget is DisplayObject.

When I try to do that, Flash CS5 gets compiler error telling me that scrollTarget only accepts standard TextField.

Code:

var txt:TLFTextField=new TLFTextField();

var scrollBar:UIScrollBar=new UIScrollBar();

scrollBar.scrollTarget=txt; //error

Many thanks,

F.

This topic has been closed for replies.
Correct answer FFBB

that error's not from the code you showed.

click file/publish settings/flash and tick "permit debugging".  retest.  the line number of the problematic code will be in the error message.  check that code.


I'm sorry but when I do what you suggest I go to that line of code... more if I comment that line the compiling goes well.

I konw it's really strange for me too.

Anyway, I will check... many thanks for your support.

EDIT: SOLVED

the flash file has been made using Flash CS4 , and the UIScrollBar referenced from the library was probably a CS4 UiScrollBar because if I replace it taking a new one from Window / Components / UIScrollBar all works fine!

1 reply

kglad
Community Expert
Community Expert
January 16, 2012

well, it won't scroll a displayobject (like a movieclip) but it will scroll a tlftextfield.  copy and paste your two import statements and the error message.

FFBBAuthor
Participant
January 16, 2012

import fl.text.TLFTextField;

import fl.controls.UIScrollBar;

Error:


1067: Implicit coercion of a value of type fl.text:TLFTextField to an unrelated type flash.text:TextField

Thank you for your really quick reply!

kglad
Community Expert
Community Expert
January 16, 2012

that error's not from the code you showed.

click file/publish settings/flash and tick "permit debugging".  retest.  the line number of the problematic code will be in the error message.  check that code.