Skip to main content
Participant
August 31, 2009
Answered

Error while attempting to use the CSSFormatResolver Class in Flash CS4

  • August 31, 2009
  • 1 reply
  • 2740 views

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 has been closed for replies.
Correct answer rdermer

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

1 reply

H_mike1Author
Participant
September 1, 2009

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

rdermerCorrect answer
Adobe Employee
September 1, 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

H_mike1Author
Participant
September 2, 2009

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.