Rename a file using onSaveEntry event
You probably just confused the entry model and the asset model, see if the code below works for you.
I guess the entries.onBeforeSaveEntry event is a better match in this case, and I also added some conditionals to
only do something for a specific entry section and type, and if there's exactly one asset selected. I hope this helps (code is untested)!

craft()-&gt;on('entries.beforeSaveEntry', function(Event $event)
{
    $entry = $event-&gt;params['entry'];

    if (($entry-&gt;section['handle'] == 'friends') &amp;&amp; ($entry-&gt;type['handle'] == 'friends'))
    {
        $title = $entry-&gt;slug;
        $assets = $entry-&gt;imgdir;

        if (count($assets) != 1)
        {
            $event-&gt;params['entry']-&gt;addError('imgdir', Craft::t('Exactly 1 asset has to be selected.'));
            $event-&gt;performAction = false;
        }
        else
        {
            $filename = $title.'.'.$assets[0]-&gt;getExtension();

            craft()-&gt;assets-&gt;renameFile($assets[0], $filename);
            craft()-&gt;assets-&gt;storeFile($assets[0]);
        }
    }
});