4 Replies Latest reply on Sep 11, 2012 6:33 AM by sinious

    TLF + SWC = huge mess

    Joseph_Saade Level 1

      The scenario is simple, have an SWC that contains some TLF.

      include the SWC in an fla and try to create an object of a class in the SWC, it will blow up.


      TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::MovieClip@22486f21 to fl.text.TCMText.

          at flash.display::Sprite/constructChildren()

          at flash.display::Sprite()

          at flash.display::MovieClip()


      Currently there are no real solutions I can find that will help.

        • 1. Re: TLF + SWC = huge mess
          Ugly Computer

          same issue, seeking input:


          created simple asset FLA, added TLF field to exported asset, published SWC


          when i try to instantiate that asset from the main FLA doc class, get same error:

          cannot convert flash.display::MovieClip@6afc1351 to fl.text.TLFTextField.

          (specifies TLFTextField not TCMText because field is named)


          reviewed following thread, fail to see solution:


          • 2. Re: TLF + SWC = huge mess
            sinious Most Valuable Participant

            During export of the SWC did you select to merge the textLayout.swc? Otherwise it exports a "runtime shared" swz file that it might be expecting to load.


            Example image:


            • 3. Re: TLF + SWC = huge mess
              Ugly Computer Level 1

              yep, textLayout is set as merged in both the swc and the parent. (for good measure?)

              simple test with this setup still fails.

              • 4. Re: TLF + SWC = huge mess
                sinious Most Valuable Participant

                Have you verified the base class of the library item is fl.text.TLFTextField? Flash seems to think it's flash.display.MovieClip. Go to the properties of the item in the library and double check that the base class is correct. If you just put a TLFTextField on screen and converted it to a symbol (MovieClip for example) and you're trying to make a reference to it, you'll need to reference it as the symbols base class type, so MovieClip (that contains a TLFTextField).


                If you want to make a TLFTextField in your library then draw one on the stage, convert it to a symbol and in the base class simply put in fl.text.TLFTextField. You'll notice the symbol color is green in the library. You should be able to directly instantiate that as a TLFTextField.