• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Error while attempting to use the CSSFormatResolver Class in Flash CS4

New Here ,
Aug 31, 2009 Aug 31, 2009

Copy link to clipboard

Copied

Hello,

While trying to work with a revised version of the CSSFormatResolver class (created by timoisalive and posted on this thread) the compiler threw the following error:

1061: Call to a possibly undefined method getChildAtIndex through a reference with static type flashx.textLayout.elements:FlowGroupElement.

The method originates from within the invalidate() method of the CSSFormatResolver class.

public function invalidate(target:Object):void {       

     delete _textLayoutFormatCache[target];      

     var blockElem:FlowGroupElement = target as FlowGroupElement;      

     if(blockElem) {          

          for(var idx:int = 0; idx < blockElem.numChildren; idx++)                          invalidate(blockElem.getChildAtIndex(idx));          

          }      

}

If I comment the for loop I can get the example to run, but that seems to seriously affect the way the styles are interpreted...

The example files are attached below.

Any suggestions?

Thank you in advance.

TOPICS
Text layout framework

Views

2.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Employee , Sep 01, 2009 Sep 01, 2009

There is no FlowGroupElement.getChildAtIndex method.

There are these two:

Returns the FlowElement child at the specified index.
FlowGroupElement
Searches in children for the specified FlowElement object and returns its index position.
FlowGroupElement

I think you meant getChildAt.

Hope that helps,

Rich

Votes

Translate

Translate
New Here ,
Sep 01, 2009 Sep 01, 2009

Copy link to clipboard

Copied

Hi again,

I managed to get rid of the error by replacing the following line within the "invalidate" function:

invalidate(blockElem.getChildAtIndex(idx));

with

invalidate(blockElem['getChildAtIndex'](idx));

Replacing the way the method is referenced from dot syntax to square brackets circumvents the strict compile mode.

However, as explained here close to the end of the article, this does not good coding practice.

The core problem here would seem to be the fact that the FlowGroupElement class is not declared as dynamic...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Sep 01, 2009 Sep 01, 2009

Copy link to clipboard

Copied

There is no FlowGroupElement.getChildAtIndex method.

There are these two:

Returns the FlowElement child at the specified index.
FlowGroupElement
Searches in children for the specified FlowElement object and returns its index position.
FlowGroupElement

I think you meant getChildAt.

Hope that helps,

Rich

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 02, 2009 Sep 02, 2009

Copy link to clipboard

Copied

Yes, that did help. Thank you Rich.

It seems that the timoisalive version of the CSSFormatResolver class had a subtly different invalidate method than the original class found in the SimpleEditorWithCSS flex example.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 02, 2009 Sep 02, 2009

Copy link to clipboard

Copied

Hi guys,

I didn't actually modify the invalidate method in my version, Adobe's version refers to the getChildAtIndex method.

My version differs from Adobe's in the way that I am giving the resolver a StyleSheet object instead of having it use the Flex framework StyleManager class to resolve styles.

-Timo

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 02, 2009 Sep 02, 2009

Copy link to clipboard

Copied

Hi Timo,

First of all thank you for making the CSSFormatResolver class independent of the Flex framework.

Secondly, I feel the need to rephrase my last sentence:

It seems that the timoisalive version of the CSSFormatResolver class had a subtly slightly different invalidate method than the original CSSFormatResolver class currently found in the SimpleEditorWithCSS flex example.

Mike

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Sep 02, 2009 Sep 02, 2009

Copy link to clipboard

Copied

LATEST

There has been a lot of cleanup and renaming of APIs we do review them constantly to try and make them be consistent and have a natural feel to AS3 developers.  Please check the release notes when you pickup new textLayout.swc versions.  We make every effort to log changes in the release notes.  That said I'm sure there are omissions.

The most recent examples are posted here including an updated SimpleEditorWithCSS:

http://opensource.adobe.com/wiki/display/tlf/Text+Layout+Framework

Apologies for the confusion and thanks for putting up with the API shifts.  We really do appreciate your efforts and do want to support you. We're a tad short handed right now for various reasons - but that's all going to get fixed.  Soon I hope!

I'm especially pleased folks are using the IFormatResolve interface - it wasn't a feature request internally I added it because I thought it would be cool.  Really nice to see it getting leveraged.

Thanks,

Richard

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines