| 
                        
                        
                          
                            
                    
                    
                      
                         | 
                        
                    
                                             
                      
                    
                    AS1 OOP: Custom Classes with MovieClips 
                             
                    by senocular                      
                    Object.registerClass Issues 
                    Object.registerClass, however, is not without its problems. 
                    
                      - Movieclips on the timeline 
                      are technically created in frames before code is run. 
                      Because of this, using Object.registerClass in a frame 
                      won’t work on movieclips created in that same frame on the 
                      timeline. This can be a speed bump since, unless you 
                      dynamically create your movieclips with Actionscript, you 
                      would need to declare Object.registerClass at least one 
                      frame prior to the desired movieclips appear on the 
                      screen. 
 
                         
                      - If you have 2 instances of the same symbol appearing 
                      on screen through the timeline on the same frame but want 
                      one of those movieclips to have a different class 
                      association than the other, Object.registerClass won’t be 
                      able to differentiate from the two. This goes back to 
                      number 1 where, because the movieclips are created in a 
                      frame before the code is run, you really have no 
                      opportunity to be able to have it run between two separate 
                      clip initializations.
 
                         
                      - Object.registerClass can’t be used with existing 
                      movieclips. Registering a class to a movieclip symbol only 
                      effects movieclips created after that association is made. 
                      Object.registerClass won’t effect any movieclip currently 
                      on the screen.
 
                         
                      - It won’t work with createEmptyMovieClip. Because 
                      createEmptyMovieClip creates a completely dynamic empty 
                      movieclip with no pre-defined symbol association (or 
                      library presence), Object.registerClass has no way of 
                      targeting such a movieclip prior to its creation. To get 
                      around this, you could easily just have an empty movieclip 
                      in your library and use attachMovie to attach it when 
                      needed with the appropriate class registration to your 
                      liking.
 
                         
                      - And lastly, due to the nature of how movieclips are 
                      made and how the constructor is run for movieclip 
                      instances separately, you have no means of directly 
                      passing arguments to your class constructor calls for 
                      movieclip instances as you are capable of doing with other 
                      objects. No doubt a formidable problem, though there are 
                      ways to handle it.
 
                     
                      
                        
                         | 
                       
 
 | 
                           
                         
                         | 
                       
                     
                     |