Custom cursor causing glitches

Hi, people. I’ve been designing a website for my first time in Flash Pro 5.5, so I am a complete beginner with no background in any code whatsoever and have basically been leeching off tutorials all over the internet to get the effects I’m looking for; it makes sense that I’d run into an error sooner or later…

My website so far uses no coding other than Actionscript 3, and I’ve designed a custom crosshair cursor with a movieclip that follows it around. I’ve hidden the default cursor. I also have dynamic text at the corner of the page, displaying X and Y coordinates. The problems:

-when I test the preview the cursor occasionally leaves behind a “stamped” copy of itself on the page while I’m clicking or moving it around.

-after navigating through my website via clicking buttons either after one or several times, the buttons stop working and become unclickable. Currently my web site has one main page with multiple buttons on it, with those leading to five other pages, each with only one button: the ‘return to home’ button. That is the button that stops working, and consequently I can’t return to the main page.

-the buttons on the homepage have rollover animations. When I wave the cursor around on top of them, the animations flicker between the ‘animations starting’ state and the usual ‘up’ state.

Note: If I take out the custom crosshair cursor, then the flickering stops. If I take out both the custom cursor and the movie clip that follows it around, then all of the above problems go away.

Here is the code I’ve been using:

stop();


stage.addChild(pluscursor);
pluscursor.mouseEnabled = false;
pluscursor.addEventListener(Event.ENTER_FRAME, fl_CustomMouseCursor);


function fl_CustomMouseCursor(event:Event)
{
    pluscursor.x = stage.mouseX;
    pluscursor.y = stage.mouseY;
}

//displays X and Y coordinates in dynamic text

stage.addEventListener(MouseEvent.MOUSE_MOVE, mousePosition);


function mousePosition(event:MouseEvent) {
    xstage_txt.text= "X Stage: " + String(mouseX);
    ystage_txt.text= "Y Stage: " + String(mouseY);
}

Mouse.hide();

//the movie clip that follows the cursor around

stage.addEventListener(Event.ENTER_FRAME,followBall);


function followBall(event:Event):void {
    var dx:int = follower.x - mouseX;
    var dy:int = follower.y - mouseY;
    follower.x -= dx / 4;
    follower.y -= dy /4;
}

//rollover animations

import flash.events.MouseEvent;


aboutbutton.buttonMode = true;
aboutbutton.addEventListener(MouseEvent.ROLL_OVER,onButtonOver);
aboutbutton.addEventListener(MouseEvent.ROLL_OUT,onButtonOut);


function onButtonOver(e:MouseEvent):void
{
    e.currentTarget.gotoAndPlay("over");
}


function onButtonOut(e:MouseEvent):void
{
    e.currentTarget.gotoAndPlay("out");
}


import flash.events.MouseEvent;




function black_clicked(e:MouseEvent):void
{
    gotoAndPlay("blackcontactstart");
}


function thicken_clicked(e:MouseEvent):void
{
    gotoAndPlay("thickensupstart");
}


function aboutbutton_clicked(e:MouseEvent):void
{
    gotoAndPlay("growaboutstart");
}


function darken_clicked(e:MouseEvent):void
{
    gotoAndPlay("darkenlinksstart");
}


function strip_clicked(e:MouseEvent):void
{
    gotoAndPlay("worksshrink");
}




black.addEventListener(MouseEvent.CLICK, black_clicked);
thicken.addEventListener(MouseEvent.CLICK, thicken_clicked);
aboutbutton.addEventListener(MouseEvent.CLICK, aboutbutton_clicked);
darken.addEventListener(MouseEvent.CLICK, darken_clicked);
strip.addEventListener(MouseEvent.CLICK, strip_clicked);




Edit: And while I’m at it, I might as well post an error that I’ve been getting, too, although it’s unrelated to the cursor.

One of my pages scrolls in both X and Y directions based on mouse movement:

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


var workspageTween:Tween


stage.addEventListener(MouseEvent.MOUSE_MOVE,mouseMoved)


function mouseMoved(e){
    var xPercent = mouseX / stage.stageWidth;
    var yPercent = mouseY / stage.stageHeight;
    var newXPos = (stage.stageWidth - workspage.width) * xPercent;
    workspageTween = new Tween(workspage, "x", Circular.easeOut, workspage.x, newXPos, 1, true);
    var newYPos = (stage.stageHeight - workspage.height) * yPercent;
    workspageTween = new Tween(workspage, "y", Circular.easeOut, workspage.y, newYPos, 1, true);
}



But I’ve been getting this output error: Cannot access a property or method of a null object reference. at allbuttons1920EXP_fla::MainTimeline/mouseMoved()

And, of course, I don’t know why.