Skip to main content
Participating Frequently
Jun 21, 2010 11:33 AM UTC
Answered

Errors with TextConverter with Configuration

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 is closed to new replies. Start a new post to keep the conversation going.
rdermerCorrect answer
Inspiring
Jun 21, 2010 4:56 PM UTC

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

5 replies

Adobe Employee
Jun 21, 2010 4:48 PM UTC

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.

Translate
rdermerCorrect answer
Inspiring
Jun 21, 2010 4:56 PM UTC

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

Translate
Participating Frequently
Jun 21, 2010 5:06 PM UTC

rdermer you are right. thank you.

Translate