Is that possible to do that without creating class? I need very simple task: movie in the library with timeline animation, I add this movie on the stage, play animation, change variable on the main timeline. Is that possible without creating two new classes?
2010/4/15 Kerry Thompson <[email protected]>: > natalia Vikhtinskaya wrote: > >> In clip_mc I have timeline animation. When it finished I should change >> countN++ on main timeline. >> I tested as you suggested. I created ClipClass.as (just added import >> flash.display.MovieClip; ) >> >> on main timeline I have code >> var clip_mc:MovieClip=new ClipClass(); // linkage with name ClipClass >> in library >> addChild(clip_mc); >> >> Now that does not work >> 1017: The definition of base class MovieClip was not found. >> 5000: The class 'ClipClass' must subclass 'flash.display.MovieClip' >> since it is linked to a library symbol of that type. > > There are a couple of issues. The first is the easiest: include this > line in your ClipClass.as: > > import flash.display.MovieClip; > > Now, take all your code off the main timeline and put it into a file > called Main.as. Add the package and class declarations (and a > constructor if you want, though it's not required), and set Main as > your document class. > > ActionScript 3 really doesn't want to be programmed like AS2. It's a > new paradigm. You can get by with AS2-style timeline programming, but > you're likely to end up with hard-to-maintain spaghetti code. > > I'd recommend you take a step back and acquaint yourself with Object > Oriented principals. I call it sharpening your axe. Sure, it takes > time to sharpen an axe, and you can chop wood with a dull axe. But, if > you take time to sharpen it, at the end of the day you will have a > much larger pile of chopped wood. > > Cordially, > > Kerry Thompson > > _______________________________________________ > Flashcoders mailing list > [email protected] > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > _______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

