2 Replies Latest reply on May 15, 2013 6:01 PM by Charine -FB buggoop

    Building an array of movie clips

    Charine -FB buggoop Level 1

      Hi

      I have a main document class and an array class (amongst others).

       

      I am not sure how to build the array though. Below is my attempt up to now. But I get the following error code.

       

      TypeError: Error #1009: Cannot access a property or method of a null object reference.

          at LetterArray/initLetters()

          at LetterArray()

          at BugGoopFSGame() //This is my main document class.

       

      What am I doing wrong?

       

      Thanks

      Charine

       

       

      //in main document class

      public var letterArray:LetterArray = new LetterArray(stage);

       

      //in array class

      package

      {

          import flash.display.MovieClip;

          import flash.events.Event;

          import flash.events.MouseEvent;

          import flash.display.Stage;

       

       

          public class LetterArray extends MovieClip

          {

              private var _stage:Stage;

             

              /*The following are movie clips that need to go into an array so that they can be manipulated togehter.

              Their classes A, F, G, H, I, N, O, S  and T were all dynamically created by flash.*/

       

      //Do I even need these here?

       

              public var a:A;

              public var f:F;

              public var g:G;

              public var h:H;

              public var i:I;

              public var n:N;

              public var o:O;

              public var s:S;

              public var t:T;

       

               public function LetterArray(s:Stage)

              {

                  _stage = stage;

                  initLetters();

              }

       

              private function initLetters():void

              {

                  var LetterArray:Array = new Array[a,f,g,h,i,n,o,s,t];

       

       

       

       

              }

       

                   

      //rest not relevant

       

          }

       

      }