1

I am new to ActionScript 3, but I have a pretty good idea how to jump frames. However, I have nested frames inside a movieclip symbol and my code cannot find them. I am making a simple platforming game.

 ArgumentError: Error #2109: Frame label Stand Front Frame not found in 
scene Stand Front Frame.
at flash.display::MovieClip/gotoAndStop()
at menutest_fla::MainTimeline/frame813()
at flash.display::MovieClip/gotoAndPlay()
at menutest_fla::MainTimeline/fl_ClickToGoToScene_3()

Here is my code, it is pretty simple. There are no typing errors that I have noticed. I cannot figure out why it is not working. Any help would be deeply appreciated, thanks!

stop();
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
import flash.display.MovieClip;
import flash.events.Event;
import flash.display.Stage;


var upPressed:Boolean = false;
var downPressed:Boolean = false;
var leftPressed:Boolean = false;
var rightPressed:Boolean = false;

movieClip_5.addEventListener(Event.ENTER_FRAME, fl_MoveInDirectionOfKey_3);
stage.addEventListener(KeyboardEvent.KEY_DOWN, fl_SetKeyPressed_3);
stage.addEventListener(KeyboardEvent.KEY_UP, fl_UnsetKeyPressed_3);



movieClip_5.gotoAndStop("Stand Front Frame")

 function fl_MoveInDirectionOfKey_3(event:Event)
{
    if (upPressed)
    {
        movieClip_5.y -= 0;
    }
    if (downPressed)
    {
        movieClip_5.y += 0;
    }
    if (leftPressed)
    {
        movieClip_5.x -= 5;

    }
    if (rightPressed)
    {
        movieClip_5.x += 5;
    }
}

function fl_SetKeyPressed_3(event:KeyboardEvent):void
{
    switch (event.keyCode)
    {
        case Keyboard.UP:
        {
            upPressed = true;
            break;
        }
        case Keyboard.DOWN:
        {
            downPressed = true;
            break;
        }
        case Keyboard.LEFT:
        {
            leftPressed = true;
            movieClip_5.gotoAndPlay("Walk Forward Frame");
            break;
        }
        case Keyboard.RIGHT:
        {
            rightPressed = true;
            movieClip_5.gotoAndPlay("Walk Backwards Frame");
            break;
        }
    }
}

function fl_UnsetKeyPressed_3(event:KeyboardEvent):void
{
    switch (event.keyCode)
    {
        case Keyboard.UP:
        {
            upPressed = false;
            break;
        }
        case Keyboard.DOWN:
        {
            downPressed = false;
            break;
        }
        case Keyboard.LEFT:
        {
            leftPressed = false;
            movieClip_5.gotoAndPlay("Walk Backwards Frame");
            break;
        }
        case Keyboard.RIGHT:
        {
            rightPressed = false;
            movieClip_5.gotoAndPlay("Walk Forward Frame");
            break;
        }
    }
}

import flash.events.Event;
import flash.geom.Rectangle;
stage.addEventListener(Event.ENTER_FRAME, cameraFollowCharacter);
function cameraFollowCharacter(evt:Event){
 root.scrollRect = new Rectangle(movieClip_5.x - stage.stageWidth/3, movieClip_5.y - stage.stageHeight/1.5, stage.stageWidth, stage.stageHeight);
}
Mary Kate
  • 67
  • 1
  • 6
  • Put this code right *above* your `movieClip_5.gotoAndStop("Stand Front Frame");` line of code: `import flash.display.FrameLabel; var labels:Array = mc1.currentLabels; for (var i:uint = 0; i < labels.length; i++) { var label:FrameLabel = labels[i]; trace("frame " + label.frame + ": " + label.name); } ` See what that traces out, and if one of them is the label your are expecting – BadFeelingAboutThis Feb 27 '18 at 00:54
  • What did the above code trace out? Most likely your issue is one of scope and you are either in the wrong scene, or are targeting the wrong timeline. – BadFeelingAboutThis Feb 27 '18 at 16:40
  • Thank you sir! Using this I was able to figure out that the scope was wrong. I appreciate it. – Mary Kate Feb 27 '18 at 20:43
  • If my answer (about scope and how to figure out if that's the problem) led to the solution of your question, please mark it as accepted. – BadFeelingAboutThis Aug 01 '18 at 20:39

3 Answers3

0

Remove your spaces from your frame label (both in your code and the MovieClip's frame label).

and if not solved, try it once again with your frame number instead of label.

leftPressed = true;
movieClip_5.gotoAndPlay(23);
break;
MESepehr
  • 758
  • 6
  • 19
0

Most of the time with this error, if you are certain there is not a typo in your frame label, the issue is one of scope.

Either the Timeline assigned to the variable/instance name movieClip_5 isn't the one you think it is, or you are in the wrong scene.

To double check it's not a typo, and to see all the frame labels of movieClip_5, do the following (example code from the documentation):

import flash.display.FrameLabel;

var labels:Array = movieClip_5.currentLabels;

for (var i:uint = 0; i < labels.length; i++) {
    var label:FrameLabel = labels[i];
    trace("frame " + label.frame + ": " + label.name);
}

This writes to the output window every frame label from movieClip_5's current scene. If you don't see what you expect, it means when this code runs, you are not in the scene you expect, or movieClip_5 is not the timeline you think it is (perhaps you want a child of movieClip_5 like movieClip_5.someChildsInstanceName.gotoAndPlay("Walk Forward Frame")).

BadFeelingAboutThis
  • 14,445
  • 2
  • 33
  • 40
0

Thank you for your feedback!

It ended up being a symbol issue, where I did not have the frames nested properly within the symbol I was calling on. And it was not ultimately the code. I appreciate your help!

Mary Kate
  • 67
  • 1
  • 6