2 Replies Latest reply on Apr 7, 2008 10:32 AM by asdfhabsaf

    MovieClip coding questions

    asdfhabsaf Level 1
      I'm only a few days into Flash 8, and I'm a little confused about conceptually what "MovieClips" should be, and was hoping to get a few quick answers:

      1) I was looking through the sample code and it looks like they are creating new graphical items through this.attachMovie(), and I'm not sure what "this" is since the code is just written in the actions panel in frame 1. (I know what "this" means from a programming standpoint; I'm just not sure what object scope the code that's running there is in). What object am I "in" in code that's just sitting around at frame 1 of the main scene timeline?

      2) It says I can make a subclass of a MovieClip, which is what I want to do to make little animated controllable characters (e.g. "class Car extends MovieClip", but I don't understand how to instantiate them within actionscript. According to the docs, you don't use constructor methods to make MovieClips, but instead use attachMovie() or createEmptyMovieClip() or duplicateMovieClip(). So how do I make an object of class Car? attachMovie() returns a MovieClip, and I can't cast that to a Car class.

      3) Just curious how people generally organize their code (and Symbols) with respect to MovieClips, in the case of, say a moving car in a game application. Do MovieClips tend to represent single animations (e.g. one MovieClip of a car with the wheels rotating left, one where the wheels rotate right, one where it crashes, and they get created and destroyed every time the car's state changes)? or single objects (e.g. one MovieClip containing many short animations along the timeline: one rolling left, one right, one crashing, with labels and "goto" action scripts to loop animation, etc.)?

      4) What is the purpose of empty movie clips? Do people use them like I would use a transform node in Maya or a null node in Lightwave (e.g. just a pivot to stack transformations?)?


      Thanks, and pardon the screen name - I was having issues choosing a screenname with Firefox and tried a gibberish test in IE and oops, it worked, and I can't figure out how to change it to a real screenname. So apparently I am stuck as "asdfhabsaf".

      --
      Ken