Q:

Refering to components by id[0], id[1], id[2] (probably by using Repeater or DataGroup)

I'm trying to port a game from pure AS3 to Flex4.
At first I'd like to make as little changes in my code as possible.
So I have a playing field with 3 user avatars:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
   xmlns:s="library://ns.adobe.com/flex/spark" 
   xmlns:mx="library://ns.adobe.com/flex/mx" 
   xmlns:comps="*">

    <comps:User id="user0" x="20" y="20"/>
    <comps:User id="user1" x="250" y="20"/>
    <comps:User id="user2" x="125" y="250"/>

</s:Application>

It works ok, but I have the following problem:
I'd prefer to refer to those custom components by user[ 0 ], user[ 1 ], user[ 2 ].
And not by user0, user1, user2 as it is in the code above.
How to achieve this? I probably need to use Repeater or DataGroup (what's the difference), but how do I handle the differing coordinates?
Should I introduce an array (or ArrayCollection? or ArrayList? this confuses me in Flex) of coordinates and somehow use it?
UPDATE:
I've tried the following:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
   xmlns:s="library://ns.adobe.com/flex/spark" 
   xmlns:mx="library://ns.adobe.com/flex/mx" 
   xmlns:comps="*">

    <fx:Declarations> 
        <s:ArrayCollection id="myAC" source="{myDP}"/>
    </fx:Declarations> 

    <fx:Script>
        <![CDATA[
            [Bindable]
            public var myDP:Array = [ 
                { x: 20, y: 20 },
                { x: 250, y: 20 },
                { x: 120, y: 250 },
            ];
        ]]>
    </fx:Script>

    <mx:VBox>
        <mx:Repeater id="r" dataProvider="{myAC}">
            <comps:User id="user" x="{r.currentItem.x}" y="{r.currentItem.y}"/>
        </mx:Repeater>
    </mx:VBox>
</s:Application>

but the components are drawn at wrong positions (in a vertical row)...

A:

How to achieve this?

You should create an array, or ArrayCollection, of user elements; conceptually something like this:
var user : Array = new Array();
// create user1
var user1 : userType = new userType();
// set properties on user1
// .....
user.push(user1);

// create user2
var user2 : userType = new userType();
// set properties on user2
// .....
user.push(user2);

// create user3
var user3 : userType = new userType();
// set properties on user3
// .....
user.push(user3);

You can write whatever logic you need to create the user objects.  This is, conceptually, exactly what I do with the Flextras Calendar to create the days.  Based on the calendar month that is being displayed, we decide how many days to create, and create them and store them in an array.  You can use whatever logic to create your users that is appropriate to your game.  
I probably need to use Repeater or DataGroup (what's the difference), but how do I handle the differing coordinates?

Neither a Repeater, nor a DataGroup, are arrays.  They won't create an array, or dataProvider, for you, and would not allow you to access your elements as if they were an array.  
A repeater is basically the MXML version of a loop and I believe they should be avoided at all costs.  MXML is just not a good language for looping.  
A DataGroup is intended to display things based on the data you specify (dataProvider) and it's layout class (Vertical, or Horizontal, or Tile).  It sounds to me like you want a custom layout; so I'm not sure I'd recommend using a DataGroup for display.  
Should I introduce an array (or ArrayCollection? or ArrayList? this confuses me in Flex) of coordinates and somehow use it?

Yes, I would use an array.  An ArrayCollection is just a wrapper for an array that provides APIs to filter and sort the data. An ArrayList is just an array that implements the IList interface so it can be used as a dataProvider to a DataGroup or other ListBase classes, such as the DataGrid.  
The code you posted isn't an approach I'd recommend.  You'll have much more granular control over the component's positioning and layout if you do this in ActionScript.  You may benefit from reading up on the Flex Component LifeCycle. to understand how the UIComponents draw themselves on the screen; and how you can hook into that to "make stuff work."  In this case, the "make stuff work relates to your positioning.  

I'm trying to port a game from pure AS3 to Flex4.

I know you said this at the beginning of your post and not at the end, but I wanted o ask the question "Why?"  Flex wasn't designed for games; and I'm not sure I'd recommend sing it as a game engine.  I can see where it may benefit you if you want to create menus or high score lists.  But, you should be able to use your AS3 code and Flex code side by side easily enough w/o having to re-write/rework the game.

