Strange AS error

Hi all,

I’m relatively new to Flash/AS2 and I have a strange problem with a bit of code:

private function GetLastFrameStrokes ():Array
{
    var lCount:Number = m_oFrames.length;
 
    if ( lCount > 0 )
    {
        var oFrame:FrameX = m_oFrames[lCount - 1];
 
        if ( oFrame.HasStrokes )
            **[COLOR=red]return ( oFrame.Strokes );[/COLOR]**
    }
 
    return ( null );
}

When I have the above code in an .as file, I get a compiler error (this function is not called in the code yet):

The expression returned must match the function's return type.
         return ( oFrame.Strokes );

When I change the red line to this:

return ( m_oFrames[lCount - 1].Strokes );

it works fine.

I don’t get this: all objects inside my m_oFrames (:Array) are of type FrameX, just like the local variable oFrame, so oFrame.Strokes and m_oFrames[lCount - 1].Strokes should both evaluate to the same type: Array (the type of the Strokes property.) Is there anything that I miss here?

Any help would be much appreciated!
xxbbcc