• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 287
  • Last Modified:

1084: Syntax Error

Hi all,

I have a piece of code written in Actionscript. When I checked syntax, I got the following error message;

"1084: Syntax error: expecting rightparen before add."

duplicateMovieClip(tremble, "tremble" add c, c) code leads to the above error.

Additionally, I am using actionscript 3 and also tremble is an instance name of movieclip

How can I fix this problem?

Thanks in advance,

a = 3;
b = 6;
c = 9;
duplicateMovieClip(tremble, "tremble" add c, c);
tremble._x = random(a);
tremble._y = random(b);
tremble._alpha = random(45);
tremble._rotation = random(a);

Open in new window

1 Solution
that won't work in actionscript 3

you cant use "add" in AS3 - you have to use "+"

_rotation, _x and _y are now just rotation, x and y (no underscore), but otherwise work the same

_alpha is now just alpha (again, no underscore), and uses a 0 - 1 range, rather than 0 to 100 (e.g., 0.2 in AS3 is the same as 20 in AS2)

most importantly, there is no duplicateMovieClip method in AS3.  there is no equivalent.  instead, create the clip you want to use repeatedly as a Class, and instantiate it using the "new" operator, e.g.,

// if you made a class previously called "MyClass"

var myClass:MyClass = new MyClass();

AS3 is very different from AS2 (and AS1), so plan on spending some time learning the new stuff and forgetting the older stuff : )
DelidumrulAuthor Commented:
it is a very quick and helpful solution.

Thanks a lot,

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now