A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: How to assign a custom class to multiple kinds of movieclips

Threaded View

  1. #1
    Senior Member
    Join Date
    Mar 2005
    Posts
    206

    resolved How to assign a custom class to multiple kinds of movieclips

    So on my stage and library, I have a movieclip for each state...named as STATE_AK, STATE_IA, STATE_NY, and so forth, inside the library...the clips are then placed on the stage

    I've created a class called State.as, and have linked each of the state movieclips to this class.


    How should I write the State class definition? So far, what I have is:

    Code:
    package{
    
    import flash.display.MovieClip;
    
        
    	public class State extends MovieClip{
    		...
                    public function State(){
                       ...
                    }
    
                    public function grow(){
                       this.scaleX = this.scaleY = 2.0;
                    }                
    
    	}
    }
    I'm not sure how to write the class so that it takes the existing movieclip as *the* movieclip, if that makes sense...so that the function "grow" doubles the size of the state.

    I get an error like this:

    TypeError: Error #1010: A term is undefined and has no properties.
    at State/size()
    at State$iinit()
    at flash.display::Sprite/flash.display:Sprite::constructChildren()
    at flash.display::Sprite$iinit()
    at flash.display::MovieClip$iinit()
    at US_BETA_fla::STATES_US_1$iinit()
    at flash.display::Sprite/flash.display:Sprite::constructChildren()
    at flash.display::Sprite$iinit()
    at flash.display::MovieClip$iinit()
    at US_BETA_fla::MainTimeline$iinit()
    Last edited by dcnguyen; 09-09-2008 at 12:09 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center