Creative COW SIGN IN :: SPONSORS :: ABOUT US :: CONTACT US
ADOBE FLASH: Adobe Flash ForumAdobe Flash TutorialsAdobe Flash Video TutorialsWeb Streaming ForumAdobe Flash

random flash motion error

Cow Forums : Adobe Flash
random flash motion error
by blackflame1991 on Jan 21, 2006 at 8:26:10 pm

i did the flash random motion video and every time i test the movie i get Scene=Scene 1, Layer=actions, Frame=1: Line 2: Unexpected '!' encountered
var t = this.attachMovie("ball","ball"+i,i);

Scene=Scene 1, Layer=actions, Frame=1: Line 5: ')' or ',' expected
t.dx = Math.round(Math.random()*450;

Scene=Scene 1, Layer=actions, Frame=1: Line 6: ')' or ',' expected
t.dy = Math.round(Math.random()*400;

Scene=Scene 1, Layer=actions, Frame=1: Line 10: Unexpected ')' encountered
)
error can any one help me

Respond to this post   •   Return to posts index

Re: random flash motion error
by lajoiet on Jan 21, 2006 at 10:13:59 pm

Frame=1: Line 2: Unexpected '!' encountered
var t = this.attachMovie("ball","ball"+i,i);

I don't see any exclamation points in that line, and I don't remember them being anywhere else in the code. Check the line before or after that and see if something is off.

Scene=Scene 1, Layer=actions, Frame=1: Line 5: ')' or ',' expected
t.dx = Math.round(Math.random()*450;

You forgot the closing parentheses:
t.dx = Math.round(Math.random()*450);

Scene=Scene 1, Layer=actions, Frame=1: Line 6: ')' or ',' expected
t.dy = Math.round(Math.random()*400;

Same thing:

t.dy = Math.round(Math.random()*400);

Scene=Scene 1, Layer=actions, Frame=1: Line 10: Unexpected ')' encountered
)

My only guess on this one is that Line 10 in Lee's tutorial closes the for loop, so line 10 SHOULD be simply "}" (CURLIE BRACES not standard parentheses.)

Respond to this post   •   Return to posts index

now i get this
by blackflame1991 on Jan 24, 2006 at 12:52:50 am

now i get this




Scene=Scene 1, Layer=actions, Frame=1: Line 2: Unexpected '!' encountered
var t = this.attachMovie("ball","ball"+i,i);

Scene=Scene 1, Layer=actions, Frame=1: Line 10: Unexpected ')' encountered
)





And this is my script







for (i=0;i<70;i++) (
var t = this.attachMovie("ball","ball"+i,i);
t._x = Math.random()*450;
t._y = Math.random()*400;
t.dx = Math.round(Math.random()*450);
t.dy = Math.round(Math.random()*400);
t._xscale = Math.random()*300+40;
t._yscale = t._xscale;
t.onEnterFrame = mover;
)

functione mover() (
this._x += (this.dx-this._x)/5;
this._y += (this.dx-this._y)/5;
if(Math.round(this._x) == this.dx) (
this.dx = Math.round(Math.random()*450);
this.dy = Math.round(Math.random()*400);
)
)






Respond to this post   •   Return to posts index


Re: now i get this
by LeeBrimelow on Jan 24, 2006 at 12:55:27 am

You are using parenthesis instead of curly braces for your functions and loops. For example you put...

for (i=0;i<70;i++) (

It should be...

for (i=0;i<70;i++) {

Lee

Respond to this post   •   Return to posts index

Re: now i get this
by blackflame1991 on Jan 24, 2006 at 1:09:32 am

can you just type the code out for my please

Respond to this post   •   Return to posts index

Re: now i get this
by blackflame1991 on Jan 24, 2006 at 1:53:38 am

its ok i got it thanks

Respond to this post   •   Return to posts index


Re: random flash motion error
by LeeBrimelow on Jan 21, 2006 at 10:17:27 pm

The problem is that you are missing the closing parethesis on your random number generations. You currently have...

t.dx = Math.round(Math.random()*450;

It should be...

t.dx = Math.round(Math.random()*450);

Lee

Respond to this post   •   Return to posts index

<< PREVIOUS THREAD   •   VIEW ALL THREADS   •   PRINT   •   NEXT THREAD >>


FORUMSTUTORIALSMAGAZINEDVDsBOOKSPODCASTSEVENTSSERVICESNEWSLETTERNEWSBLOGS

© CreativeCOW.net All rights are reserved.

[Top]