Copy link to clipboard
Copied
I have been getting the error and I cant seem to get rid of it.
Here is the errors with the debugger on.
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at dragtomatch_fla::MainTimeline/fl_ReleaseToDrop()[dragtomatch_fla.MainTimeline::frame12:18]
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at dragtomatch_fla::MainTimeline/fl_ReleaseToDrop_2()[dragtomatch_fla.MainTimeline::frame12:37]
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at dragtomatch_fla::MainTimeline/fl_ReleaseToDrop_3()[dragtomatch_fla.MainTimeline::frame12:54]
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at dragtomatch_fla::MainTimeline/fl_ReleaseToDrop_4()[dragtomatch_fla.MainTimeline::frame12:71]
Line 18,37,54,71 are what comes up as being the issue, this is where itt says Basketballbtn.stopdrag(); Baseballbtn.stopdrag(); Footballbtn.stopdrag(); Soccerballbtn.stopdrag();
Here is the code.
stop();
Welcome.text = "Let's Do This " + myName;
/* Drag and Drop
Makes the specified symbol instance moveable with drag and drop.
*/
Basketballbtn.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag);
function fl_ClickToDrag(event:MouseEvent):void
{
Basketballbtn.startDrag();
}
stage.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop);
function fl_ReleaseToDrop(event:MouseEvent):void
{
Basketballbtn.stopDrag();
}
/* Drag and Drop
Makes the specified symbol instance moveable with drag and drop.
*/
Baseballbtn.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag_2);
function fl_ClickToDrag_2(event:MouseEvent):void
{
Baseballbtn.startDrag();
}
stage.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop_2);
function fl_ReleaseToDrop_2(event:MouseEvent):void
{
Baseballbtn.stopDrag();
}
/* Drag and Drop
Makes the specified symbol instance moveable with drag and drop.
*/
Footballbtn.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag_3);
function fl_ClickToDrag_3(event:MouseEvent):void
{
Footballbtn.startDrag();
}
stage.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop_3);
function fl_ReleaseToDrop_3(event:MouseEvent):void
{
Footballbtn.stopDrag();
}
/* Drag and Drop
Makes the specified symbol instance moveable with drag and drop.
*/
Soccerballbtn.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag_4);
function fl_ClickToDrag_4(event:MouseEvent):void
{
Soccerballbtn.startDrag();
}
stage.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop_4);
function fl_ReleaseToDrop_4(event:MouseEvent):void
{
Soccerballbtn.stopDrag();
}
/* Click to Go to Frame and Play
Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and continues playback from that frame.
Can be used on the main timeline or on movie clip timelines.
Instructions:
1. Replace the number 5 in the code below with the frame number you would like the playhead to move to when the symbol instance is clicked.
*/
replaybtn.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame);
function fl_ClickToGoToAndPlayFromFrame(event:MouseEvent):void
{
gotoAndPlay(1);
}
/* Click to Go to Frame and Stop
Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and stops the movie.
Can be used on the main timeline or on movie clip timelines.
Instructions:
1. Replace the number 5 in the code below with the frame number you would like the playhead to move to when the symbol instance is clicked.
*/
answersbtn.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_3);
function fl_ClickToGoToAndStopAtFrame_3(event:MouseEvent):void
{
gotoAndStop(15);
}
Copy link to clipboard
Copied
that means those 4 objects (Basketballbtn Baseballbtn Footballbtn Soccerballbtn) do not exist when those lines of code execute.
most likely your timeline (that contains those objects) is changing and that's causing the problem.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now