Skip to main content
Participant
Aug 31, 2009 4:23 PM UTC
Answered

Error while attempting to use the CSSFormatResolver Class in Flash CS4

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.

This topic is closed to new replies. Start a new post to keep the conversation going.
rdermerCorrect answer
Inspiring
Sep 1, 2009 5:48 PM UTC

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

6 replies

H_mike1Author
Participant
Sep 1, 2009 10:55 AM UTC

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...

Translate
rdermerCorrect answer
Inspiring
Sep 1, 2009 5:48 PM UTC

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

Translate
H_mike1Author
Participant
Sep 2, 2009 7:50 AM UTC

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.

Translate