It's not that difficult if you do it right. First, I'm not a fan of timeline code except for defining sections, such as stop on a keyframe, and minor control commands like gotoAndStop and gotoAndPlay. The rest I like to do in an external ActionScript file.
I haven't used the Flash IDE in 3-4 years--I use Flex and FlashBuilder almost exclusively now--but let's see what I can remember. First, when you create the movie clip, click "Export for ActionScript". Let's say your mc is called movingSprite. It will have a class name of movingSprite. You can change that if you want. If you already have the mc in the library, right-click and choose properties. That will bring up the same dialog--check Export for ActionScript. In the Properties tab (often called the Property Inspector), declare a document class. That just means the class that will run when you launch the movie. Let's call it myDocClass. Now create the document class. Choose File -> New... and choose ActionScript Class. Name it myDocClass, and Flash will create a new actionScript class file. Create another class file and name it movingSprite.as. Now you can create an instance of the movie clip and assign it variables. I wouldn't do that in the document class, though. I would declare them in the class file. Cordially, Kerry Thompson On Fri, Aug 15, 2014 at 2:23 PM, Ted Lehr <t...@qvine.com> wrote: > How can I create a variable in a dynamic object? > > For example, if I had a movie clip in the library, I could open it up and > on the first frame I could give it: > > var velocityX:Number = Math.random()*10-10; > > I could then refer to mc.velocityX; > > How can I create that variable on an object create in actionscript? > > _______________________________________________ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders