View Full Version : Can't stop loop errors

02-15-2010, 04:29 PM
#1009: Cannot access a property or method of a null object reference.

I get this error every time and I try to rearrange these codes...I have them in seperate layers and set them next to each other so that when one play it goes to the next set of frames with the new actionscript in place

stop(); var i:int; symbol1_btn.y - 130;
// place scrollBtn_btn here or on the stage at 50 y
symbol1_btn.addEventListener(MouseEvent.MOUSE_DOWN , onStartDrag1);
symbol1_btn.stage.addEventListener(MouseEvent.MOUS E_UP, onStopDrag1);

var rectangle1:Rectangle = new Rectangle(604,0,0,345);
addEventListener(Event.ENTER_FRAME, loopY);
function loopY(event:Event):void {

i = symbol1_btn.y - 10;
function onStartDrag1(event:MouseEvent):void {
symbol1_btn.startDrag(false, rectangle1);
} function onStopDrag1(event:MouseEvent):void {
symbol1_btn.stopDrag(); }


stop(); var j:int; symbol2_btn.x - 200;

symbol2_btn.addEventListener(MouseEvent.MOUSE_DOWN , onStartDrag2);
symbol2_btn.stage.addEventListener(MouseEvent.MOUS E_UP, onStopDrag2);

var rectangle2:Rectangle = new Rectangle(10,100,345,0);
addEventListener(Event.ENTER_FRAME, loopX);
function loopX(event:Event):void {

j = symbol2_btn.x - 600;

function onStartDrag2(event:MouseEvent):void {
symbol2_btn.startDrag(false, rectangle2);
} function onStopDrag2(event:MouseEvent):void {
symbol2_btn.stopDrag(); }

These are related to 2 separate buttons that I want to move after I finished clicking and dragging when It goes to the next button and start to continue the animation piece I am creating. Any idea how to combine these 2 codes together without making the errors?