# Strange AS error

**URL:** <https://forum.kirupa.com/t/strange-as-error/226524>\
**Category:** Uncategorized\
**Created:** [May 22, 2007, 3:48am UTC](https://forum.kirupa.com/t/strange-as-error/226524 "2007-05-22T03:48:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![xxbbcc](https://avatars.discourse-cdn.com/v4/letter/x/6f9a4e/32.png) [@xxbbcc](https://forum.kirupa.com/u/xxbbcc)\
**Post date:** [May 22, 2007, 3:48am UTC](https://forum.kirupa.com/t/strange-as-error/226524/1 "2007-05-22T03:48:54Z")

</div>

Hi all,

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

```auto
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):

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

```

When I change the red line to this:

```auto
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
