Skip to main content
Participating Frequently
June 21, 2010
Answered

Errors with TextConverter with Configuration

  • June 21, 2010
  • 1 reply
  • 1362 views

Hello

I try to use newest flex sdk (4.1.0.16032) but cannot solve this:

var conf:Configuration=new Configuration()


var linkNormalFormat:TextLayoutFormat=new TextLayoutFormat()

conf.defaultLinkNormalFormat=linkNormalFormat;


textFlow=TextConverter.importToFlow(value,TextConverter.TEXT_LAYOUT_FORMAT,conf);


trace(textFlow) // null

Why it is null??

When I use textFlowInitialFormat:

conf.textFlowInitialFormat=format;          

textFlow is not null and everything works fine.

When I use defaultLinkHoverFormat:

conf.defaultLinkHoverFormat=linkNormalFormat;

textFlow is correctly created bu I get error on roll over:

TypeError: Error #1034: Type Coercion failed: cannot convert flashx.textLayout.formats::TextLayoutFormat@1423e881 to flashx.textLayout.formats.TextLayoutFormatValueHolder.
    at flashx.textLayout.elements::LinkElement/computeLinkFormat()
    at flashx.textLayout.elements::LinkElement/get http://ns.adobe.com/textLayout/internal/2008::effectiveLinkElementTextLayoutFormat()
    at flashx.textLayout.elements::LinkElement/setToState()
    at flashx.textLayout.elements::LinkElement/mouseOverHandler()

Is this a bug?

This topic has been closed for replies.
Correct answer rdermer

Hi,

That reads like 1.1 bug to me.  Try replacing:

var linkNormalFormat:TextLayoutFormat=new TextLayoutFormat()

with

import flashx.textLayout.formats.TextLayoutFormatValueHolder;

var linkNormalFormat:TextLayoutFormat=new TextLayoutFormatValueHolder();

Just FYI:  TextLayoutFormatValueHolder class is hidden in 1.1 (tagged with ExcludeClass metadata).  FWIW in 2.0 it replaces TextLayoutFormat.  It's a much more efficient representation of the formats when only a few are set.

Hope that helps,

Richard

1 reply

Adobe Employee
June 21, 2010

I think the most likely reason the textFlow would be null after a call to the TextConverter is that

something in the value is not quite right. What value are you passing to importToFlow? You could also try instead of calling importToFlow directly, call TextConverter.getImporter, and then you can use the importer to do the import, and after the import you can look at the errors property to see if anything was reported.

rdermerCorrect answer
Adobe Employee
June 21, 2010

Hi,

That reads like 1.1 bug to me.  Try replacing:

var linkNormalFormat:TextLayoutFormat=new TextLayoutFormat()

with

import flashx.textLayout.formats.TextLayoutFormatValueHolder;

var linkNormalFormat:TextLayoutFormat=new TextLayoutFormatValueHolder();

Just FYI:  TextLayoutFormatValueHolder class is hidden in 1.1 (tagged with ExcludeClass metadata).  FWIW in 2.0 it replaces TextLayoutFormat.  It's a much more efficient representation of the formats when only a few are set.

Hope that helps,

Richard

Participating Frequently
June 21, 2010

rdermer you are right. thank you.