Skip navigation
Currently Being Moderated

OOP and movie clips in arrays

May 14, 2013 2:09 PM

I have a number of movieclips in a game that needs to all appear at a certain x;y co-ordinate at the same alpha value and move at a dynamically produced path and basically have the same behaviour up to a point. Flash has created links to .as files for eachEach movie clip.

 

I want to put them all in an array to code once. My question - Must this array be in the main class .as file or can I have a seperate .as file written especially for this array.

 

Thanks

Charine

 

Facebook: buggoop

 
Replies
  • kglad
    72,260 posts
    Jul 21, 2002
    Currently Being Moderated
    May 14, 2013 3:16 PM   in reply to Charine -FB buggoop

    you can use a seperate class.

     

    it will need a displayobject reference so you might need to pass it one from some other class.

     
    |
    Mark as:
  • kglad
    72,260 posts
    Jul 21, 2002
    Currently Being Moderated
    May 14, 2013 5:35 PM   in reply to Charine -FB buggoop

    you can pass a reference from your main class to your array class. eg,

     

    // in document class

    var arrayClass:ArrayClass=new ArrayClass(stage);

     

    // ArrayClass

     

    package{

     

    public class ArrayClass{

    private var _stage:Stage;

    public function ArrayClass(s:Stage){

    _stage=stage;

    dowhatever();

    }

    private function dowhatever():void{

    .

    .

    }

    }

    }

     
    |
    Mark as:
  • kglad
    72,260 posts
    Jul 21, 2002
    Currently Being Moderated
    May 15, 2013 6:13 AM   in reply to Charine -FB buggoop

    you're welcome.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points