mardi 31 janvier 2017

AS3 - Flash - CS6 Create Nested MovieClip on the fly and add it to the stage

ball:Ball is a MovieClip
trail:Trail is a MovieClip

ball = new Ball(speedX, speedY);

trail, contains a ball. trail, is a defined sized of stage. ball, inside trail, has a Tween that follows a Defined path.

//The problem
trail = new Trail();

ArgumentError: Error #1063: Argument count mismatch on Ball(). Expected 2, got 0. at flash.display::Sprite/constructChildren()

It took me a while to consider. I am creating a new instance of Trail, and inside of Trial is a Ball already. Isn't the Ball already created inside Trail when I designed the nested MovieClip Trail? Thus the error and not knowing how to resolve it; as the Ball inside is already in place and Tweening.

Setup: Nothing on stage. No MovieClips. It's all created and added to the stage at run-time. Balls are already on stage before this error adding an instance of Trail at run-time.

Aucun commentaire:

Enregistrer un commentaire