Creating my own object

Hey guys,

I've been trying to create my own object with vertices... So far unsuccessfully. Using the following code:
Code:
var vertices:Vector.<b2Vec2> = new Vector.<b2Vec2>();
         with (vertices){
            var size:int = 1;
            push(new b2Vec2(0,0));
            push(new b2Vec2(0,size));
            push(new b2Vec2(size,size));
            push(new b2Vec2(size,0));            

         }
         type = b2Body.b2_dynamicBody;
         shape = b2PolygonShape.AsVector(vertices,vertices.length);
         

The squares I create do appear, but when a dynamic square hits another one, it falls through (it does slow down and for two seconds it gets stuck, but then it falls through with high speed)...

It was working when i just used
Code:
shape = b2PolygonShape.AsBox(0.5,0.5);


But obviously I want to create more complicated objects than a Box...

Any help is appreciated,

Cheers guys!
you need to list your vertices in counterclockwise order
My god, why is the solution always so simple... 😛

Thank you so much Vitalee, that probably saved me hours of frustration!

Original thread: https://box2d.org/forum/viewtopic.php?t=6456