# AS3 Parallax removal on other frame labels that are not meant to scroll - Help please

**URL:** <https://forum.kirupa.com/t/as3-parallax-removal-on-other-frame-labels-that-are-not-meant-to-scroll-help-please/318508>\
**Category:** flash\
**Created:** [January 22, 2011, 12:35am UTC](https://forum.kirupa.com/t/as3-parallax-removal-on-other-frame-labels-that-are-not-meant-to-scroll-help-please/318508 "2011-01-22T00:35:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sweetkanani1](https://avatars.discourse-cdn.com/v4/letter/s/ecd19e/32.png) [@sweetkanani1](https://forum.kirupa.com/u/sweetkanani1)\
**Post date:** [January 22, 2011, 12:35am UTC](https://forum.kirupa.com/t/as3-parallax-removal-on-other-frame-labels-that-are-not-meant-to-scroll-help-please/318508/1 "2011-01-22T00:35:49Z")

</div>

[FONT=Georgia]Hi ya,

Would anyone be able to offer me some support with a problem I am experiencing with AS3 Parallax scroller?

I have some frame labels set up not to have any scroll effect… But when I remove the frames that have a parralax I recieve this message as soon as I enter the label that contains the non-scrolling scene:  
“TypeError: Error #1009: Cannot access a property or method of a null object reference.  
at new\_22jan\_fla::MainTimeline/scroll\_front()”

My code on the frame label that has a scrolling parallax effect is as follows:

[COLOR=SeaGreen]stop();

var speed1:Number = 20;  
var speed2:Number = 10;

var mc2Width:Number = back\_mc.width;

var mc2X:Number = back\_mc.x;  
var stageWidth:Number = stage.stageWidth;  
/_trace("mc2Width = "+mc2Width);  
trace("stageWidth = "+stageWidth);  
trace("calc = "+(stageWidth-mc2Width));_/

back\_mc.addEventListener(Event.ENTER\_FRAME, scroll\_back);  
front\_mc.addEventListener(Event.ENTER\_FRAME, scroll\_front)

function scroll\_back(e:Event):void {  
var xdist:Number = stage.mouseX-(stageWidth/2);  
//trace("xdist = "+xdist);  
mc2X += -xdist/speed1;  
//trace("mc2X = "+mc2X);  
if (mc2X\>=0) {  
//trace(“0”);  
mc2X = 0;  
}  
if (mc2X\<=-1150.8) {  
//trace(stageWidth-mc2Width);  
mc2X = -1150.8;  
}  
back\_mc.x = mc2X;  
}

function scroll\_front(e:Event):void {  
var xdist:Number = stage.mouseX-(stageWidth/2);  
//trace("xdist = "+xdist);  
mc2X += -xdist/speed2;  
//trace("mc2X = "+mc2X);  
if (mc2X\>=0) {  
//trace(“0”);  
mc2X = 0;  
}  
if (mc2X\<=-1150.8) {  
//trace(stageWidth-mc2Width);  
mc2X = -1150.8;  
}  
front\_mc.x = mc2X;

}  
[/COLOR]

[COLOR=Black]Any assistance with resolving my problem would be appreciated, thank you.

[/COLOR][/FONT]
