Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am creating a flash game for iPhone using Flash CS5. Everything runs smoothly when creating the SWF via Ctrl+Enter. But when I am attaching the .p12 and provisioning profile files and publish the FLA to generate the .ipa there is an error thrown by the compiler that is:

"Incorrect number of arguments, Expected no more than 0"

private static function closestVertexOnOBB(p:Vector,r:RectangleParticle):Vector   
    var d:Vector = p.minus(r.samp);         
    var q:Vector= new Vector(r.samp.x, r.samp.y);

    for (var i:int = 0; i < 2; i++) 
        var dist:Number = d.dot(r.axes[i]);

        if (dist >= 0) dist = r.extents[i];
        else if (dist < 0) dist = -r.extents[i];

    return q;
share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

The Vector class is actually a native flash class since Flash Player 10 (API docs) and is therefore a class-name you should avoid for your classes.

If you wrote your 2d vector class yourself, you should be able to rename it to solve the ambiguity. If it's part of an external package, you could also use the fully qualified classname if you want to use the 2d Vector class.

Imagine the Vector class is in com.geom.Vector, your code should look like this:

private static function closestVertexOnOBB(p:com.geom.Vector,r:RectangleParticle):com.geom.Vector   
    var d:com.geom.Vector = p.minus(r.samp);         
    var q:com.geom.Vector= new com.geom.Vector(r.samp.x, r.samp.y);
    ... etc ...

I don't know why the code works if you test it locally though. It should produce the same error.

share|improve this answer
thanks @bummzack:I have also tried like this but got the error 1046: Type was not found or was not a compile-time constant: Vector. and my vector is not a custom class it is flash inbuilt class. –  Swati Singh Sep 30 '11 at 6:44
@SwatiSingh: Then you're misunderstanding the flash Vector class. It's not a 2d vector that provides operations like minus. It's a container class, much like an array. –  bummzack Sep 30 '11 at 6:53
yes i know, i have customizing the vector class and creating some functions according to my need. so now can you give me any suggestions that how i can use vector class. –  Swati Singh Sep 30 '11 at 7:05
@SwatiSingh: How did you customize the vector class? I can't imagine how this would be possible... Still: You're using the wrong class here. Vector is not a 2d vector. You want a 2d vector class. Here's a good 2d vector implementation if you don't want to implement it yourself. –  bummzack Sep 30 '11 at 7:10
yeah you are right i was searching in a wrong direction. there is a custom class in my engine with the samme name as Flash Doc API that's why there is a conflict between the class name. Now my problem is solved. Thanks a lot. –  Swati Singh Sep 30 '11 at 12:12
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.