9 Replies Latest reply on May 24, 2009 6:38 PM by MediaMackenzie.com

    Copying Arrays - Instance Variables - Multiple Animations

    MediaMackenzie.com Level 1

      Hi All!

       

      Thanks so much, in advance, as always, for your assistance!

       

      So, here's a site I'm working on:

       

      http://www.mediamackenzie.com/cmix/cmix10.html

       

      I have 3 quick questions:

       

      - I tried, when I first started making this site, to load all of the artwork images into an array and then copy the array before resizing them for their specific functions (being seen as thumbnails or as full size pics.) Unfortunately, I ran into the well known issue of Array cloning only creating a pointer to the same group of items. I tried the newArray = oldArray.slice() trick, but it didn't seem to work. Finally, I just loaded the images twice into two separate arrays, and it works, but I hate this solution. Anyone got a better one?

       

      - I'm trying to maintain some sort of connection between the two sets of Arrays so that, for example, when someone clicks on Thumbnail 15, Fullsize Image 15 will open up but I couldn't find anything that worked. Renaming the Instance Name dynamically didn't seem to work and adding an Instance Variable dynamically doesn't seem possible either as I can't make the Class I am working with (Sprite, in this case) dynamic ahead of time. I'm sure there's a simple method for this. Any suggestions?

       

      - Lastly, notice how when the site opens up, the different animations seem to interfere with each other and slow each other down (they also seem to get interference from the time taken to load the image Arrays.) Anyone got any high level suggestions for how to avoid this?

       

      Thanks So Much!

      and Be Well

      Graham

        • 1. Re: Copying Arrays - Instance Variables - Multiple Animations
          kglad Adobe Community Professional & MVP

          1.  array.slice() works.  what problem do you see.

           

          2.  if the arrays are correlated so the nth element in both arrays are related, you can use the array index for each element to find the corresponding element in the other array.

           

          3.  you have errors in your coding.  the compiler should be informing you of that.

          1 person found this helpful
          • 2. Re: Copying Arrays - Instance Variables - Multiple Animations
            MediaMackenzie.com Level 1

            Hey Kglad

             

            Thanks, as always, for your assistance. Here are my answer to your questions:

             

            1.  array.slice() works.  what problem do you see.

             

            It was still behaving as though the 2nd array was a pointer to the same set of objects. When I made a change to the second array after using the slice function, it would have an effect on the first array.

             

            2.  if the arrays are correlated so the nth element in both arrays are related, you can use the array index for each element to find the corresponding element in the other array.

             

            Oh! yeah, good suggestion. They are definitely correlated that way. I tend to forget about the original arrays as an organizing device once I've added their elements as to the display list. What function exactly should I use for this purpose?

             

            3.  you have errors in your coding.  the compiler should be informing you of that.


            I always address errors that my compiler throws. This happens (the dual animation latency) without any errors being thrown, which is why it makes me assume it's a processing resource issue. I was just hoping someone would have some hints about speeding up any simultaneous animations.

            I look forward to your responses!

            Thanks!
            Graham
            • 3. Re: Copying Arrays - Instance Variables - Multiple Animations
              kglad Adobe Community Professional & MVP

              1.  show a sample of code that uses the slice() method to create a copy and changing the copy changes the original.

               

              2.  if you're using as3 (and it looks like you are), you can use the indexOf() method of arrays.

               

              if you were using as2, you could write your own function to return the index of an array element:

               

              function indexOfA(element:*,a:Array):Number{

              for(var i=0;i<a.length;i++){

              if(element == a[i]){

              return i;

              }

              }

              return -1;

              }

               

              3.  i saw errors when checking your link.  i still see:

               

              TypeError: Error #1009: Cannot access a property or method of a null object reference.      at Texty/frame30()

              1 person found this helpful
              • 4. Re: Copying Arrays - Instance Variables - Multiple Animations
                MediaMackenzie.com Level 1

                Hi Kglad

                 

                Thanks again. Location for newest iteration of this project is:http://www.mediamackenzie.com/cmix/cmix11.html

                 

                My responses to yrs:

                 

                1.  show a sample of code that uses the slice() method to create a copy and changing the copy changes the original.

                 

                This seems to be working now, thanks. Not sure what the pblm was before.

                 

                2.  if you're using as3 (and it looks like you are), you can use the indexOf() method of arrays.

                 

                Thank you for the method suggestion and custom AS2 code. Yes, I am using AS3. I'm sorry, I *do* understand how the indexOf() method works, but I don't see how to use it in conjunction with the MouseEvent Listener I am attaching to my thumbnails. The pseudocode should obviously be something like, "When user clicks on thumbnail, the MouseEvent handler should load the full size image associated with that same array index" but I frankly don't know how to do this. Thanks for any more help u can provide.

                 

                3.  i saw errors when checking your link.  i still see: TypeError: Error #1009: Cannot access a property or method of a null object reference.      at Texty/frame30()

                 

                Huh. That is weird, since I see no errors and I am compiling in Strict mode. Any idea how this might be happening?

                 

                Thanks!

                Graham

                • 5. Re: Copying Arrays - Instance Variables - Multiple Animations
                  kglad Adobe Community Professional & MVP

                  1.  done.

                  2.  you can use:

                   

                  thumb.addEventListener(MouseEvent.CLICK,f);

                  function f(e:MouseEvent){

                  imageAssociatedWithThumb = imageArray[thumbArray.indexOf(e.currentTarget)];

                  }

                   

                  3.  here's what i see at your website today (5/20/09):

                   

                   

                  thumbComplete
                  thumbComplete
                  thumbComplete
                  thumbComplete
                  thumbComplete
                  thumbComplete
                  thumbComplete
                  thumbComplete
                  thumbComplete
                  thumbComplete
                  thumbComplete
                  thumbComplete
                  thumbComplete
                  thumbComplete
                  thumbComplete
                  thumbComplete
                  thumbComplete
                  thumbComplete
                  thumbComplete
                  thumbComplete
                  thumbComplete
                  thumbComplete
                  thumbComplete
                  thumbComplete
                  thumbComplete
                  thumbComplete
                  Warning: Not a known player download type, http://www.mediamackenzie.com/404.html
                  thumbError
                  [object Loader],[object Loader],[object Loader],[object Loader],[object Loader],[object Loader],[object Loader],[object Loader],[object Loader],[object Loader],[object Loader],[object Loader],[object Loader],[object Loader],[object Loader],[object Loader],[object Loader],[object Loader],[object Loader],[object Loader],[object Loader],[object Loader],[object Loader],[object Loader],[object Loader],[object Loader]
                  batches = 4
                  batch 0
                  row 0
                  col 0
                  thumb 0
                  scaler1 = 0.2125
                  image width:170
                  image height:111.75
                  thumby.name 0
                  col 1
                  thumb 1
                  scaler3 = 1.0625
                  image width:170
                  image height:117.95
                  thumby.name 1
                  col 2
                  thumb 2
                  scaler3 = 1.0625
                  image width:170
                  image height:123.25
                  thumby.name 2
                  col 3
                  thumb 3
                  scaler3 = 1.0625
                  image width:170
                  image height:96.7
                  thumby.name 3
                  row 1
                  col 0
                  thumb 4
                  scaler1 = 0.10572139303482588
                  image width:170
                  image height:144.2
                  thumby.name 4
                  col 1
                  thumb 5
                  scaler1 = 0.2125
                  image width:170
                  image height:111.15
                  thumby.name 5
                  col 2
                  thumb 6
                  scaler3 = 1.0625
                  image width:170
                  image height:124.3
                  thumby.name 6
                  col 3
                  thumb 7
                  scaler2 = 0.2951388888888889
                  image width:118.65
                  image height:170
                  thumby.name 7
                  batch 1
                  row 0
                  col 0
                  thumb 8
                  scaler1 = 0.2361111111111111
                  image width:170
                  image height:131.75
                  thumby.name 8
                  col 1
                  thumb 9
                  scaler3 = 1.0625
                  image width:170
                  image height:124.3
                  thumby.name 9
                  col 2
                  thumb 10
                  scaler3 = 1.0625
                  image width:170
                  image height:127.5
                  thumby.name 10
                  col 3
                  thumb 11
                  scaler2 = 0.2951388888888889
                  image width:132.8
                  image height:170
                  thumby.name 11
                  row 1
                  col 0
                  thumb 12
                  scaler1 = 0.166015625
                  image width:170
                  image height:81.85
                  thumby.name 12
                  col 1
                  thumb 13
                  scaler1 = 0.166015625
                  image width:170
                  image height:95.95
                  thumby.name 13
                  col 2
                  thumb 14
                  scaler1 = 0.2361111111111111
                  image width:170
                  image height:128.65
                  thumby.name 14
                  col 3
                  thumb 15
                  scaler2 = 0.2951388888888889
                  image width:144.05
                  image height:170
                  thumby.name 15
                  batch 2
                  row 0
                  col 0
                  thumb 16
                  scaler2 = 0.2951388888888889
                  image width:127.5
                  image height:170
                  thumby.name 16
                  col 1
                  thumb 17
                  scaler1 = 0.166015625
                  image width:170
                  image height:93.65
                  thumby.name 17
                  col 2
                  thumb 18
                  scaler2 = 0.2951388888888889
                  image width:109.5
                  image height:170
                  thumby.name 18
                  col 3
                  thumb 19
                  scaler1 = 0.265625
                  image width:170
                  image height:151.65
                  thumby.name 19
                  row 1
                  col 0
                  thumb 20
                  scaler2 = 0.2951388888888889
                  image width:116.85
                  image height:170
                  thumby.name 20
                  col 1
                  thumb 21
                  scaler1 = 0.2361111111111111
                  image width:170
                  image height:126.55
                  thumby.name 21
                  col 2
                  thumb 22
                  scaler2 = 0.2951388888888889
                  image width:121.3
                  image height:170
                  thumby.name 22
                  col 3
                  thumb 23
                  scaler2 = 0.2951388888888889
                  image width:126
                  image height:170
                  thumby.name 23
                  batch 3
                  row 0
                  col 0
                  thumb 24
                  scaler1 = 0.2361111111111111
                  image width:170
                  image height:134.6
                  thumby.name 24
                  col 1
                  thumb 25
                  scaler1 = 0.2361111111111111
                  image width:170
                  image height:134.6
                  thumby.name 25
                  col 2
                  thumb 26
                  TypeError: Error #1010: A term is undefined and has no properties.
                  at Gallery/thumbResize()
                  at Gallery/thumbError()
                  
                  • 6. Re: Copying Arrays - Instance Variables - Multiple Animations
                    MediaMackenzie.com Level 1

                    2.  you can use:

                     

                    thumb.addEventListener(MouseEvent.CLICK,f);

                    function f(e:MouseEvent){

                    imageAssociatedWithThumb = imageArray[thumbArray.indexOf(e.currentTarget)];

                    }

                     

                    Ok, here's what I did:

                     

                    function enLarge(event:MouseEvent):void {

                     

                        darkStage = new Sprite();
                        darkStage.graphics.beginFill(0x000000, .75);
                        darkStage.graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight);
                        darkStage.addEventListener(MouseEvent.CLICK, reMove);
                        darkStage.buttonMode = true;
                        darkStage.useHandCursor = true;
                        parent.addChild(darkStage);

                     

                        loadSprite = new Sprite();
                        bigLoad = new Loader();
                        bigLoad = loadArray[thumbArray.indexOf(event.currentTarget)];
                        loadSprite.addChild(bigLoad);
                        loadSprite.x = (stage.stageWidth / 2);
                        loadSprite.y = (stage.stageHeight / 2);
                        loadSprite.addEventListener(MouseEvent.CLICK, reMove);
                        loadSprite.buttonMode = true;
                        loadSprite.useHandCursor = true;
                        parent.addChild(loadSprite);
                    }

                     

                    function reMove(event:MouseEvent):void {
                        parent.removeChild(darkStage);
                        parent.removeChild(loadSprite);

                     

                    }

                     

                    but I get the following errors:

                     

                    TypeError: Error #2007: Parameter child must be non-null.
                        at flash.display::DisplayObjectContainer/addChild()
                        at Gallery/enLarge()
                    ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
                        at flash.display::DisplayObjectContainer/removeChild()
                        at Gallery/reMove()

                     

                    Any idea what I'm doing wrong here?

                     

                    3.  here's what i see at your website today (5/20/09):

                     

                    TypeError: Error #1010: A term is undefined and has no properties.
                    at Gallery/thumbResize()
                    at Gallery/thumbError()

                    Ah, yes, that. I believe that happens because of the way I am loading my images. Here is that process:

                    var thumb = 0;

                    this[thumb] = new Loader();
                    this[thumb].contentLoaderInfo.addEventListener(Event.COMPLETE, thumbComplete);
                    this[thumb].load(new URLRequest("images/0.png"));
                    thumbArray.push(this[thumb]);

                    function thumbComplete(e:Event):void {
                         trace("thumbComplete");
                         thumb++;
                         this[thumb] = new Loader();
                         this[thumb].load(new URLRequest("images/" + thumb + ".png"));
                         thumbArray.push(this[thumb]);
                         this[thumb].contentLoaderInfo.addEventListener(Event.COMPLETE, thumbComplete);
                         this[thumb].contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, thumbError);
                    }

                    function thumbError(e:IOErrorEvent):void {
                         trace("thumbError");
                         thumbArray.pop();
                         loadArray = thumbArray.slice();
                         thumb = 0;
                         addArrows();
                         thumbResize();
                    }

                    What I was trying to do here was devise a way to load as many images as are on the server without needing to hardcode a limit (that way the user could add and remove images at will and the program would respond in a flexible manner.) But, since the IOErrorEvent telling us that the last attempt to load an image failed is asynchronous, thumbResize() and/or thumbError() both get flagged for errors in the last go around (or, at least, that's what I think is happening. It never affected performance so I never bothered to track it down.) What do you think is going on? and please share if you know a way to fix this.

                     

                    One other thing with this: I was using the this[thumb] doohickey as an attempt to name the Loader instances 0, 1, 2, etc so that I could do the Array index reference trick, but now that I'm using indexOf() to do that, using this[thumb] is no longer necessary, right?

                     

                    Thanks!

                    Graham

                    • 7. Re: Copying Arrays - Instance Variables - Multiple Animations
                      kglad Adobe Community Professional & MVP

                      what's loadArray and what's thumbArray?

                      • 8. Re: Copying Arrays - Instance Variables - Multiple Animations
                        MediaMackenzie.com Level 1

                        thumbArray is the initial Array of Loaders which are then resized as thumbnails.

                         

                        loadArray is the new Array that I use thumbArray.slice() on (before the resize).

                        • 9. Re: Copying Arrays - Instance Variables - Multiple Animations
                          MediaMackenzie.com Level 1

                          I'm still stuck, but close, I think. The URL: http://www.mediamackenzie.com/cmix/cmix11.html

                           

                          Here is the code from frame 1 of my Gallery MovieClip (an instance of which is created dynamically in the main timeline):

                           

                          -------------------------------------------------------------------

                           

                          stop();

                           

                          import fl.transitions.Tween;
                          import fl.transitions.easing.*;

                           

                          var idealH = 120;
                          var idealW = idealH + 50;

                           

                          var loadH = 300;
                          var loadW = loadH * 2;

                           

                          var thumb = 0;
                          var loadNum = 0;

                           

                          var thumby:Sprite;
                          var darkStage:Sprite;
                          var loadSprite:Sprite;

                           

                          var thumbArray:Array = new Array();
                          var loadArray:Array = new Array();

                           

                          var bigLoad:Loader;

                           

                          var reSized:Boolean = false;

                           

                          this[thumb] = new Loader();
                          this[thumb].contentLoaderInfo.addEventListener(Event.COMPLETE, thumbComplete);
                          this[thumb].load(new URLRequest("images/0.png"));
                          thumbArray.push(this[thumb]);

                           

                          function thumbComplete(e:Event):void {
                              trace("thumbComplete");
                              thumb++;
                              this[thumb] = new Loader();
                              this[thumb].load(new URLRequest("images/" + thumb + ".png"));
                              thumbArray.push(this[thumb]);
                              this[thumb].contentLoaderInfo.addEventListener(Event.COMPLETE, thumbComplete);
                              this[thumb].contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, thumbError);
                          }

                           

                          function thumbError(e:IOErrorEvent):void {
                              trace("thumbError");
                              thumb = 0;
                              thumbArray.pop();
                              loadArray = thumbArray.slice();
                              gotoAndStop(2);
                          }

                           

                          ----------------------------------------------------------------------------

                          Now, here is the code from frame 2:

                           

                          //stop();

                           

                          addArrows();
                          thumbResize();
                          loadResize();

                           

                          function thumbResize():void {
                             
                          trace("thumbResize");

                           


                              for (var batch = 0; batch < Math.ceil(thumbArray.length / 8); batch++) {
                                  trace("batch " + batch);

                           

                                  var batchSprite: Sprite = new Sprite();
                                  batchSprite.x = (batchSprite.x + (idealW / 1.5) + (batch * 800));
                                  //batchSprite.mouseEnabled = false;
                                  addChild(batchSprite);

                           

                                  for (var row = 0; row < 2; row++) {
                                      trace("     row " + row);
                                      for (var col = 0; col < 4; col++) {
                                          trace("          col " + col);
                                          trace("               thumb " + thumb);

                           

                                          //If the width of the image is greater than the ideal width, OR the height is greater than the ideal height...
                                          if ( thumbArray[thumb].content.width > idealW || thumbArray[thumb].content.height > idealH) {
                                              //And if the width of the image is greater than the height, apply Scaler 1...
                                              if ( thumbArray[thumb].content.width > thumbArray[thumb].content.height ) {
                                                  //Scaler 1 is the ratio of the ideal width to the image width
                                                  var scaler1 = idealW / thumbArray[thumb].content.width;
                                                  trace("               scaler1 = " + scaler1);
                                                  //Apply Scaler 1 to both the width and height of the image
                                                  thumbArray[thumb].content.scaleX = thumbArray[thumb].content.scaleY = scaler1;
                                                  trace("               image width:" + thumbArray[thumb].content.width);
                                                  trace("               image height:" + thumbArray[thumb].content.height);
                                                  //Otherwise, apply Scaler 2
                                              } else {
                                                  //Scaler 2 is the ratio of the ideal width to the image height
                                                  var scaler2 = idealW / thumbArray[thumb].content.height;
                                                  trace("               scaler2 = " + scaler2);
                                                  //Apply Scaler 2 to both the width and height of the image
                                                  thumbArray[thumb].content.scaleX = thumbArray[thumb].content.scaleY = scaler2;
                                                  trace("               image width:" + thumbArray[thumb].content.width);
                                                  trace("               image height:" + thumbArray[thumb].content.height);
                                              }
                                              //Otherwise... (that is, the image width and height are in both cases less than the ideal)
                                          } else {
                                              //And if the width of the image is greater than the heigh, apply Scaler 3
                                              if ( thumbArray[thumb].content.width > thumbArray[thumb].content.height ) {
                                                  //Scaler 3 is the ratio of the ideal width to the image width
                                                  var scaler3 = idealW / thumbArray[thumb].content.width;
                                                  trace("               scaler3 = " + scaler3);
                                                  //Apply Scaler 3 to both the width and height of the image
                                                  thumbArray[thumb].content.scaleX = thumbArray[thumb].content.scaleY = scaler3;
                                                  trace("               image width:" + thumbArray[thumb].content.width);
                                                  trace("               image height:" + thumbArray[thumb].content.height);
                                              } else {
                                                  //Scaler 4 is the ratio of the ideal width to the image height
                                                  var scaler4 = idealW / thumbArray[thumb].content.height;
                                                  trace("               scaler4 = " + scaler4);
                                                  //Apply Scaler 4 to both the width and height of the image
                                                  thumbArray[thumb].content.scaleX = thumbArray[thumb].content.scaleY = scaler4;
                                                  trace("               image width:" + thumbArray[thumb].content.width);
                                                  trace("               image height:" + thumbArray[thumb].content.height);
                                              }
                                          }
                                          thumbArray[thumb].content.x = - (thumbArray[thumb].content.width / 2);
                                          thumbArray[thumb].content.y = - (thumbArray[thumb].content.height / 2);

                           

                                          thumby = new Sprite();
                                          thumby.addChild(thumbArray[thumb]);
                                          thumby.y = (row * (idealW + (idealW / 8)));
                                          thumby.x = (col * (idealW + (idealW / 8)));
                                          thumby.buttonMode = true;
                                          thumby.useHandCursor = true;
                                          thumby.addEventListener(MouseEvent.CLICK, enLarge);

                           


                                          batchSprite.addChild(thumby);
                                          thumb++;
                                      }
                                  }
                              }

                           

                          }

                           

                          function loadResize():void {

                           

                              trace("loadResize");

                           

                              for (var ex = 0; ex < loadArray.length; ex++) {

                           

                                  //If the width of the image is greater than the ideal width, OR the height is greater than the ideal height...
                                  if ( loadArray[loadNum].content.width > loadW || loadArray[loadNum].content.height > loadH) {
                                      //And if the width of the image is greater than the height, apply Scaler 1...
                                      if ( loadArray[loadNum].content.width > loadArray[loadNum].content.height ) {
                                          //Scaler 1 is the ratio of the ideal width to the image width
                                          var scaler1 = loadW / loadArray[loadNum].content.width;
                                          //Apply Scaler 1 to both the width and height of the image
                                          loadArray[loadNum].content.scaleX = loadArray[loadNum].content.scaleY = scaler1;
                                          //Otherwise, apply Scaler 2
                                      } else {
                                          //Scaler 2 is the ratio of the ideal width to the image height
                                          var scaler2 = loadW / loadArray[loadNum].content.height;
                                          //Apply Scaler 2 to both the width and height of the image
                                          loadArray[loadNum].content.scaleX = loadArray[loadNum].content.scaleY = scaler2;
                                      }
                                      //Otherwise... (that is, the image width and height are in both cases less than the ideal)
                                  } else {
                                      //And if the width of the image is greater than the heigh, apply Scaler 3
                                      if ( loadArray[loadNum].content.width > loadArray[loadNum].content.height ) {
                                          //Scaler 3 is the ratio of the ideal width to the image width
                                          var scaler3 = loadW / loadArray[loadNum].content.width;
                                          //Apply Scaler 3 to both the width and height of the image
                                          loadArray[loadNum].content.scaleX = loadArray[loadNum].content.scaleY = scaler3;
                                      } else {
                                          //Scaler 4 is the ratio of the ideal width to the image height
                                          var scaler4 = loadW / loadArray[loadNum].content.height;
                                          //Apply Scaler 4 to both the width and height of the image
                                          loadArray[loadNum].content.scaleX = loadArray[loadNum].content.scaleY = scaler4;
                                      }
                                  }
                                  loadArray[loadNum].content.x = - (loadArray[loadNum].content.width / 2);
                                  loadArray[loadNum].content.y = - (loadArray[loadNum].content.height / 2);

                           

                                  loadNum++;

                           

                              }
                          }

                           

                          function addArrows():void {
                             
                              trace("addArrows");
                             
                              var batches =  Math.ceil(thumbArray.length / 8);
                              var m = 0;

                           

                              trace("batches = " + batches);
                              if (batches > 1) {
                                  for (var k = 1; k < batches; k++) {
                                      var triW = 20;
                                      var startX = (((800 - triW) * k) + (triW * m));
                                      var startY = (idealW / 2);

                           

                                      var tri:Sprite = new Sprite();
                                      tri.graphics.beginFill(0xFFFFFF);
                                      tri.graphics.moveTo(startX, startY);
                                      tri.graphics.lineTo(startX, (startY + triW));
                                      tri.graphics.lineTo((startX + triW), (startY + (triW/2)));
                                      tri.graphics.lineTo(startX, startY);
                                      tri.graphics.endFill();
                                      tri.buttonMode = true;
                                      tri.useHandCursor = true;
                                      tri.addEventListener(MouseEvent.CLICK, moveLeft);
                                      addChild(tri);

                           

                                      var tri2:Sprite = new Sprite();
                                      var startX2 = (startX + (triW * 2));
                                      tri2.graphics.beginFill(0xFFFFFF);
                                      tri2.graphics.moveTo(startX2, startY);
                                      tri2.graphics.lineTo(startX2, (startY + triW));
                                      tri2.graphics.lineTo((startX2 - triW), (startY + (triW / 2)));
                                      tri2.graphics.lineTo(startX2, startY);
                                      tri2.graphics.endFill();
                                      tri2.buttonMode = true;
                                      tri2.useHandCursor = true;
                                      tri2.addEventListener(MouseEvent.CLICK, moveRight);
                                      addChild(tri2);

                           

                                      m++;
                                  }
                              }
                          }

                           

                          function moveLeft(event:MouseEvent):void {
                              var leftTween:Tween = new Tween(this, "x", Regular.easeOut, this.x, (this.x - 800), .5, true);
                          }

                           

                          function moveRight(event:MouseEvent):void {
                              var rightTween:Tween = new Tween(this, "x", Regular.easeOut, this.x, (this.x + 800), .5, true);
                          }

                           

                          function enLarge(event:MouseEvent):void {
                             
                              darkStage = new Sprite();
                              darkStage.graphics.beginFill(0x000000, .75);
                              darkStage.graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight);
                              darkStage.addEventListener(MouseEvent.CLICK, reMove);
                              darkStage.buttonMode = true;
                              darkStage.useHandCursor = true;
                              parent.addChild(darkStage);

                           

                              var nmbr = thumbArray.indexOf(event.currentTarget);
                              bigLoad = new Loader();
                              bigLoad = loadArray[nmbr];
                              trace("bigLoad: " + bigLoad);
                              loadSprite = new Sprite();
                              loadSprite.addChild(bigLoad);
                              loadSprite.x = (stage.stageWidth / 2);
                              loadSprite.y = (stage.stageHeight / 2);
                              loadSprite.addEventListener(MouseEvent.CLICK, reMove);
                              loadSprite.buttonMode = true;
                              loadSprite.useHandCursor = true;
                              parent.addChild(loadSprite);

                           

                           

                          }

                           

                          function reMove(event:MouseEvent):void {
                              parent.removeChild(darkStage);
                              parent.removeChild(loadSprite);

                           

                          }

                           

                          -----------------------------------------------------------

                           

                          The function enLarge is the source of the issue (I want the enlarged image to show up and it's not.)

                           

                          Please help if you can!

                           

                          Thanks,

                          Graham