• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 291
  • 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

0
Delidumrul
Asked:
Delidumrul
1 Solution
 
moagriusCommented:
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();
addChild(myClass);

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

Thanks a lot,
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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