Patrick Meehan Patrick Meehan - 10 months ago 69
ActionScript Question

Actionscript 2 " ')' expected" errors

I'm in a basic flash class where we have to use AS2 and my teacher is out of school for the next week, can anyone help me figure out the syntax errors this code is throwing?

var startX:Number = flashMan_mc._x;
var startY:Number = flashMan_mc._y;
var endX:Number = 450;
var endY:Number = 300;

flashMan_mc.onEnterFrame = function()
{
if (flashMan_mc._x < endX && endY)
{
flashMan_mc._x += ((endX – startX)/30);
}
if (flashMan_mc._y < endX && endY)
{
flashMan_mc._y += ((endY – startY)/30);
}
}


This is throwing these errors:

Scene=Scene 1, layer=actions, frame=1, Line 10 ')' expected
Scene=Scene 1, layer=actions, frame=1, Line 14 ')' expected
Scene=Scene 1, layer=actions, frame=1, Line 15 Unexpected '}' encountered

Answer Source

Check for the '-' signs you have added on line 10 and 15. They are this '–' and not usual '-' signs.

Try deleting those signs and typing again.

var startX:Number = flashMan_mc._x;
var startY:Number = flashMan_mc._y;
var endX:Number = 450;
var endY:Number = 300;

flashMan_mc.onEnterFrame = function()
{
    if (flashMan_mc._x < endX && endY)
        {
            flashMan_mc._x += ((endX - startX)/30);
        }
    if (flashMan_mc._y < endX && endY)
        {
            flashMan_mc._y += ((endY - startY)/30);
        }
}
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download