Skip to main content
Known Participant
January 29, 2022
Question

Errors 2108 and 2007

  • January 29, 2022
  • 2 replies
  • 163 views

Hello, I am trying to make a drag and drop game in which 3 objects will drag and drop to the same target. One of them is the right one so when the two of them drop into the target it will go to another ''Try again' scene. If the right one is dropped into the target it will go to the 'Well Done' scene. Furthemore i ran into some errors. So far i have created the code for one item. Everyting is fine until the next scene appears and the object (table) remains in the scene, i can even move it around.

 

The errors are th following:

 

 

 

ArgumentError: Error #2108: Scene was not found.
at flash.display::MovieClip/gotoAndPlay()
at Untitled_fla::MainTimeline/frame328()
at flash.display::MovieClip/gotoAndPlay()
at Untitled_fla::MainTimeline/dropIt()


TypeError: Error #2007: Parameter hitTestObject must be non-null.
at flash.display::DisplayObject/_hitTest()
at flash.display::DisplayObject/hitTestObject()
at Untitled_fla::MainTimeline/dropIt()

 

p.s.: The first TypeError appears when the 'Try again' scene is shown up.

The second TypeError appears when i move the object arround at the 'Try again; scene.

Also i dont think any 'scene' exists in my code as it appears on the first TypeError.

 

The code is the following:

 

{
trap.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
trap.addEventListener(MouseEvent.MOUSE_UP, dropIt);
trap.startX = trap.x;
trap.startY = trap.y;
}

function pickUp(event:MouseEvent):void
{

event.target.startDrag(true);
event.target.parent.addChild(event.target);

}
function dropIt(event:MouseEvent):void
{

event.target.stopDrag();
if(event.target.hitTestObject(target1)){
MovieClip(root).gotoAndPlay(1,"xana1");

}
else
{

event.target.x = event.target.startX;
event.target.y = event.target.startY;
event.target.buttonMode = true;

}
}

 

Also I attach a picture of the error

 

Thank you so much in advance!

    This topic has been closed for replies.

    2 replies

    Sofia5FCDAuthor
    Known Participant
    January 29, 2022

    I fixed the second TYPEERROR

    by writting

     if (MovieClip(root))gotoAndPlay(1,"xana1") ;{
    removeChild(trap); }

    below  the if code.

    now the table dissapears on the next scene and thats what i want.

    Furthemore the first TypeError still appears :

    ArgumentError: Error #2108: Scene was not found.
    at flash.display::MovieClip/gotoAndPlay()
    at Untitled_fla::MainTimeline/frame328()
    at flash.display::MovieClip/gotoAndPlay()
    at Untitled_fla::MainTimeline/dropIt()

     

    why? there's no scene in my code. how do i get rid of it?

    Sofia5FCDAuthor
    Known Participant
    January 29, 2022

    I forgot to add that the instance name for table is 'tra'

    and i wrote the code to as3

    Sofia5FCDAuthor
    Known Participant
    January 29, 2022

    'trap' no 'tra'