//this is the event that fires every frame for thumbContainer's function scrollThumbs(e:Event):void { //we initialize the thumbContainer variable from the event data passed to this function var thumbContainer:Sprite = e.target as Sprite; if (thumbContainer.width>0) { //we scroll the thumbContainer by the amount specified at the top thumbContainer.x -= scrollAmount; trace(thumbContainer.width); // ALWAYS GIVES 510 //if the thumbContainer has scrolled past the mask, we no longer need it, so remove it and add a new group of thumbnails to the end of the main container if(thumbContainer.x <= -(thumbContainer.width)){ thumbContainer.parent.removeChild(thumbContainer); createThumbs(); } } } OUTPUT ------- 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 TypeError: Error #1009: Cannot access a property or method of a null object reference. at Untitled_fla::MainTimeline/scrollThumbs() 510 510 510 TypeError: Error #1009: Cannot access a property or method of a null object reference. at Untitled_fla::MainTimeline/scrollThumbs() 510 510 510 510 TypeError: Error #1009: Cannot access a property or method of a null object reference. at Untitled_fla::MainTimeline/scrollThumbs() 510 510 510