I have some class that I created visually in Flash Professional CS5 by transferring drawn result into a MovieClip and extorting symbol into AS code. Now, I want to add some properties to the class. To be more specific, I’ve created Ball class and want to add to it variables that will represent vertical and horizontal speeds. How can I edit the class in order to do it? Also, when I wanted to add some visible external element to the class, at first I decided to add MovieClip property in the code itself, but then recalled method .addChild() that worked perfectly for me. Now, I can’t do the same with non-visible properties. So, what is the difference between adding visible elements using .addChild() and adding them in the code itself? And HOW can I actually add anything in the code itself?
I have some class that I created visually in Flash Professional CS5 by transferring
Share
You should probably avoid mixing physics with the actual visual representation. Try making a ball class which holds the
velocityX,velocityYand a reference to yourMovieClip. Make the Ball class hold anupdate(), which might look something like this:In your Main class you can use the
Event.ENTER_FRAME-event to callball.update();This way you can independently update you Ball graphics and the physics code.