0
\$\begingroup\$

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];

        q.plusEquals(r.axes[i].mult(dist));
    }
    return q;
}
\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

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.

\$\endgroup\$
5
  • \$\begingroup\$ 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. \$\endgroup\$ Commented Sep 30, 2011 at 6:44
  • 1
    \$\begingroup\$ @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. \$\endgroup\$
    – bummzack
    Commented Sep 30, 2011 at 6:53
  • \$\begingroup\$ 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. \$\endgroup\$ Commented Sep 30, 2011 at 7:05
  • 1
    \$\begingroup\$ @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. \$\endgroup\$
    – bummzack
    Commented Sep 30, 2011 at 7:10
  • \$\begingroup\$ 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. \$\endgroup\$ Commented Sep 30, 2011 at 12:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .