Only one instance of custom class functions properly at runtime


[COLOR=#000000][FONT=verdana]So I have a function in my side-scroller game that is designed to scroll the background while the character remains in the center of the stage.[/FONT][/COLOR]

[COLOR=#000000][FONT=verdana]My ScrollHandler class is written so that I can instantiate the class in my DocumentMain and then pass four values into its constructor - the name of the background object, the name of the character, the horizontal scroll modifier (to reduce or increase the scrolling factor to simulate depth as required) and the vertical scroll modifier.[/FONT][/COLOR]

[COLOR=#000000][FONT=verdana]I found that because I was also defining my character and background object in my DocumentMain (instantiated by dragging to stage) I couldn’t instantiate the ScrollHandler in the DocMain class; I had to put it in the constructor of the DocMain.[/FONT][/COLOR]

[COLOR=#000000][FONT=verdana]The issue I’m running into is that when I have two instances of my ScrollHandler for two seperate background MovieClips, only one of them makes any adjustments to the coordinates of its designated object.[/FONT][/COLOR]

[COLOR=#000000][FONT=verdana]I’ve run traces and found that while the correct values are being passed into each ScrollHandler instance, only one of them makes any changes to the coordinates of its designated object.[/FONT][/COLOR]

[COLOR=#000000][FONT=verdana]I’m stumped![/FONT][/COLOR]

[COLOR=#000000][FONT=verdana]Here’s the code;[/FONT][/COLOR]



//DocumentMain class

		import classes.worldinteract.ScrollWorld_c;
		import classes.worldinteract.Triggertest_c;
		import classes.worldinteract.FanSteam1_c;
		import classes.character.Character_c;
		import classes.worldinteract.WorldCollision_c;

public function DocumentMain()
				var Scroll0:ScrollWorld_c = new ScrollWorld_c(Static0, char);				
				var ANewScroll:ScrollWorld_c = new ScrollWorld_c(FanSteam1, char);	



package classes.worldinteract {
        import flash.display.MovieClip;
    public class ScrollWorld_c extends MovieClip{
                private var ScrollObj:MovieClip = new MovieClip;
                private var StillObj:MovieClip = new MovieClip;
                private var ScrollModY:Number
                private var ScrollModX:Number

        public function ScrollWorld_c($ScrollObj:MovieClip, $StillObj:MovieClip, $ScrollModX:Number = 1, $ScrollModY:Number = 1)
                ScrollObj = $ScrollObj;
                StillObj = $StillObj;
                ScrollModX = $ScrollModX;
                ScrollModY = $ScrollModY;    
                this.addEventListener(Event.ENTER_FRAME, enterFrameHandler);    
        private function enterFrameHandler(e:Event)
                ScrollObj.x += ((550 * 0.5) - (StillObj.x)) * ScrollModX;                                                             
                StillObj.x = 550 * 0.5;
                //550 = stage.stageWidth, can't access stage from this class
                //ScrollObj.y += (440 * 0.5) - (StillObj.y) * ScrollModY;                                                             
                //StillObj.y = 440 * 0.5;


[COLOR=#000000][FONT=verdana]What do you guys think?[/FONT][/COLOR]