00:00
00:00
Newgrounds Background Image Theme

Our goal is for Newgrounds to be ad free for everyone! Become a Supporter today and help make this dream a reality!

AS3 gotoAndStop

960 Views | 38 Replies
New Topic Respond to this Topic

Response to AS3 gotoAndStop 2020-12-03 20:23:09


At 12/3/20 08:05 PM, Gimmick wrote:
At 12/3/20 07:59 PM, Spudzy wrote:
At 12/3/20 07:56 PM, Gimmick wrote:
At 12/3/20 03:35 PM, Spudzy wrote:
At 12/3/20 02:39 PM, Gimmick wrote:
At 12/2/20 08:48 AM, Spudzy wrote:
At 12/1/20 08:02 PM, Gimmick wrote:
At 11/30/20 08:01 AM, Spudzy wrote:
At 11/29/20 07:04 PM, Gimmick wrote:
At 11/29/20 04:40 PM, Spudzy wrote:
At 11/29/20 03:55 PM, Gimmick wrote: At 11/28/20 03:56 PM, Spudzy wrote:
I tried tracing it, it just comes up with an error

D'oh. Silly me. Fixed, try running this:

At 11/28/20 04:01 PM, Spudzy wrote:
hey i've just got progress... I tried trace(MovieClip(_player));

and it's outputting [object Player] now ?

Ah, so it's visible to the document.

Try

i'm getting
Okay, I feel like this is a really basic question that should've been asked before, but do you have a frame labelled "walk" in player? Can you show a screenshot? (Select the frame and show the properties panel or wherever it is you set the frame label)
I have the 2nd frame labelled as "walk" inside the player MC. Inside the player MC there's a stop(); called at the first frame
So what happens when you try _player.gotoAndStop(2) instead? Does it go to that frame?

If it does, try renaming the "walk" frame to something else, maybe player_walk. There might be a conflict in the name and scene which might cause the error.
I've also tried MovieClip(Player).gotoAndStop("player_walk"); but it comes up with
TypeError: Error #1034: Type Coercion failed: cannot convert Player$ to flash.display.MovieClip.
at Main/enterFrameHandler()
The "linkage" is not the same thing as the variable name. The linkage is actually the Class name - so your class would be called Player, but the instance name of the Player object should be "_player".

Okay, given this I think I have enough info to say what's happening. I know this could've been resolved much quicker if I had Animate, but can you show a screenshot of the stage? (In the screenshot earlier it shows the Player MC, but not the stage itself. Is the player MC on the stage? What's the variable/instance name in the properties panel?)
That's not the main stage, or if it is, I don't see the player character anywhere. Can you click the arrow beside "player"?
It is the main stage and the player is generated on the stage by code
Can you include whatever code you're using?


If you scroll up you can find the script of the player class

Response to AS3 gotoAndStop 2020-12-03 20:52:09


At 12/3/20 08:23 PM, Spudzy wrote:
At 12/3/20 08:05 PM, Gimmick wrote:
At 12/3/20 07:59 PM, Spudzy wrote:
At 12/3/20 07:56 PM, Gimmick wrote:
At 12/3/20 03:35 PM, Spudzy wrote:
At 12/3/20 02:39 PM, Gimmick wrote:
At 12/2/20 08:48 AM, Spudzy wrote:
At 12/1/20 08:02 PM, Gimmick wrote:
At 11/30/20 08:01 AM, Spudzy wrote:
At 11/29/20 07:04 PM, Gimmick wrote:
At 11/29/20 04:40 PM, Spudzy wrote: At 11/29/20 03:55 PM, Gimmick wrote: At 11/28/20 03:56 PM, Spudzy wrote:
I tried tracing it, it just comes up with an error

D'oh. Silly me. Fixed, try running this:

At 11/28/20 04:01 PM, Spudzy wrote:
hey i've just got progress... I tried trace(MovieClip(_player));

and it's outputting [object Player] now ?

Ah, so it's visible to the document.

Try

i'm getting
Okay, I feel like this is a really basic question that should've been asked before, but do you have a frame labelled "walk" in player? Can you show a screenshot? (Select the frame and show the properties panel or wherever it is you set the frame label)
I have the 2nd frame labelled as "walk" inside the player MC. Inside the player MC there's a stop(); called at the first frame
So what happens when you try _player.gotoAndStop(2) instead? Does it go to that frame?

If it does, try renaming the "walk" frame to something else, maybe player_walk. There might be a conflict in the name and scene which might cause the error.
I've also tried MovieClip(Player).gotoAndStop("player_walk"); but it comes up with
TypeError: Error #1034: Type Coercion failed: cannot convert Player$ to flash.display.MovieClip.
at Main/enterFrameHandler()
The "linkage" is not the same thing as the variable name. The linkage is actually the Class name - so your class would be called Player, but the instance name of the Player object should be "_player".

Okay, given this I think I have enough info to say what's happening. I know this could've been resolved much quicker if I had Animate, but can you show a screenshot of the stage? (In the screenshot earlier it shows the Player MC, but not the stage itself. Is the player MC on the stage? What's the variable/instance name in the properties panel?)
That's not the main stage, or if it is, I don't see the player character anywhere. Can you click the arrow beside "player"?
It is the main stage and the player is generated on the stage by code
Can you include whatever code you're using?
If you scroll up you can find the script of the player class


Hmm, nothing particularly strange in there either. So just to recap...


  • _player has a frame labelled "walk"
  • _player.gotoAndStop("walk") throws an error
  • _player.gotoAndStop(2) (aka the walk frame) throws an error or does not work


What does scene "walk" contain?


Slint approves of me! | "This is Newgrounds.com, not Disney.com" - WadeFulp

"Sit look rub panda" - Alan Davies

BBS Signature

Response to AS3 gotoAndStop 2020-12-03 20:56:13


At 12/3/20 08:52 PM, Gimmick wrote:
At 12/3/20 08:23 PM, Spudzy wrote:
At 12/3/20 08:05 PM, Gimmick wrote:
At 12/3/20 07:59 PM, Spudzy wrote:
At 12/3/20 07:56 PM, Gimmick wrote:
At 12/3/20 03:35 PM, Spudzy wrote:
At 12/3/20 02:39 PM, Gimmick wrote:
At 12/2/20 08:48 AM, Spudzy wrote:
At 12/1/20 08:02 PM, Gimmick wrote:
At 11/30/20 08:01 AM, Spudzy wrote:
At 11/29/20 07:04 PM, Gimmick wrote: At 11/29/20 04:40 PM, Spudzy wrote: At 11/29/20 03:55 PM, Gimmick wrote: At 11/28/20 03:56 PM, Spudzy wrote:
I tried tracing it, it just comes up with an error

D'oh. Silly me. Fixed, try running this:

At 11/28/20 04:01 PM, Spudzy wrote:
hey i've just got progress... I tried trace(MovieClip(_player));

and it's outputting [object Player] now ?

Ah, so it's visible to the document.

Try

i'm getting
Okay, I feel like this is a really basic question that should've been asked before, but do you have a frame labelled "walk" in player? Can you show a screenshot? (Select the frame and show the properties panel or wherever it is you set the frame label)

I have the 2nd frame labelled as "walk" inside the player MC. Inside the player MC there's a stop(); called at the first frame
So what happens when you try _player.gotoAndStop(2) instead? Does it go to that frame?

If it does, try renaming the "walk" frame to something else, maybe player_walk. There might be a conflict in the name and scene which might cause the error.
I've also tried MovieClip(Player).gotoAndStop("player_walk"); but it comes up with
TypeError: Error #1034: Type Coercion failed: cannot convert Player$ to flash.display.MovieClip.
at Main/enterFrameHandler()
The "linkage" is not the same thing as the variable name. The linkage is actually the Class name - so your class would be called Player, but the instance name of the Player object should be "_player".

Okay, given this I think I have enough info to say what's happening. I know this could've been resolved much quicker if I had Animate, but can you show a screenshot of the stage? (In the screenshot earlier it shows the Player MC, but not the stage itself. Is the player MC on the stage? What's the variable/instance name in the properties panel?)
That's not the main stage, or if it is, I don't see the player character anywhere. Can you click the arrow beside "player"?
It is the main stage and the player is generated on the stage by code
Can you include whatever code you're using?
If you scroll up you can find the script of the player class
Hmm, nothing particularly strange in there either. So just to recap...

What does scene "walk" contain?


There is no scene called "walk" this is what bugs me

Response to AS3 gotoAndStop 2020-12-04 14:38:06


At 12/3/20 08:56 PM, Spudzy wrote:
At 12/3/20 08:52 PM, Gimmick wrote:
At 12/3/20 08:23 PM, Spudzy wrote:
At 12/3/20 08:05 PM, Gimmick wrote:
At 12/3/20 07:59 PM, Spudzy wrote:
At 12/3/20 07:56 PM, Gimmick wrote:
At 12/3/20 03:35 PM, Spudzy wrote:
At 12/3/20 02:39 PM, Gimmick wrote:
At 12/2/20 08:48 AM, Spudzy wrote:
At 12/1/20 08:02 PM, Gimmick wrote:
At 11/30/20 08:01 AM, Spudzy wrote: At 11/29/20 07:04 PM, Gimmick wrote: At 11/29/20 04:40 PM, Spudzy wrote: At 11/29/20 03:55 PM, Gimmick wrote: At 11/28/20 03:56 PM, Spudzy wrote:
I tried tracing it, it just comes up with an error

D'oh. Silly me. Fixed, try running this:

At 11/28/20 04:01 PM, Spudzy wrote:
hey i've just got progress... I tried trace(MovieClip(_player));

and it's outputting [object Player] now ?

Ah, so it's visible to the document.

Try

i'm getting
Okay, I feel like this is a really basic question that should've been asked before, but do you have a frame labelled "walk" in player? Can you show a screenshot? (Select the frame and show the properties panel or wherever it is you set the frame label)

I have the 2nd frame labelled as "walk" inside the player MC. Inside the player MC there's a stop(); called at the first frame

So what happens when you try _player.gotoAndStop(2) instead? Does it go to that frame?

If it does, try renaming the "walk" frame to something else, maybe player_walk. There might be a conflict in the name and scene which might cause the error.
I've also tried MovieClip(Player).gotoAndStop("player_walk"); but it comes up with
TypeError: Error #1034: Type Coercion failed: cannot convert Player$ to flash.display.MovieClip.
at Main/enterFrameHandler()
The "linkage" is not the same thing as the variable name. The linkage is actually the Class name - so your class would be called Player, but the instance name of the Player object should be "_player".

Okay, given this I think I have enough info to say what's happening. I know this could've been resolved much quicker if I had Animate, but can you show a screenshot of the stage? (In the screenshot earlier it shows the Player MC, but not the stage itself. Is the player MC on the stage? What's the variable/instance name in the properties panel?)
That's not the main stage, or if it is, I don't see the player character anywhere. Can you click the arrow beside "player"?
It is the main stage and the player is generated on the stage by code
Can you include whatever code you're using?
If you scroll up you can find the script of the player class
Hmm, nothing particularly strange in there either. So just to recap...

What does scene "walk" contain?
There is no scene called "walk" this is what bugs me


Is this where the error occurs? (Assuming the code is uncommented)


if (!_movingRight && !_movingLeft) { 
  /*_player.gotoAndStop("stand");*/
}

Because I don't see any reference to "walk" anywhere in the code.


Slint approves of me! | "This is Newgrounds.com, not Disney.com" - WadeFulp

"Sit look rub panda" - Alan Davies

BBS Signature

Response to AS3 gotoAndStop 2020-12-04 15:49:13


At 12/4/20 02:38 PM, Gimmick wrote:
At 12/3/20 08:56 PM, Spudzy wrote:
At 12/3/20 08:52 PM, Gimmick wrote:
At 12/3/20 08:23 PM, Spudzy wrote:
At 12/3/20 08:05 PM, Gimmick wrote:
At 12/3/20 07:59 PM, Spudzy wrote:
At 12/3/20 07:56 PM, Gimmick wrote:
At 12/3/20 03:35 PM, Spudzy wrote:
At 12/3/20 02:39 PM, Gimmick wrote:
At 12/2/20 08:48 AM, Spudzy wrote:
At 12/1/20 08:02 PM, Gimmick wrote: At 11/30/20 08:01 AM, Spudzy wrote: At 11/29/20 07:04 PM, Gimmick wrote: At 11/29/20 04:40 PM, Spudzy wrote: At 11/29/20 03:55 PM, Gimmick wrote: At 11/28/20 03:56 PM, Spudzy wrote:
I tried tracing it, it just comes up with an error

D'oh. Silly me. Fixed, try running this:

At 11/28/20 04:01 PM, Spudzy wrote:
hey i've just got progress... I tried trace(MovieClip(_player));

and it's outputting [object Player] now ?

Ah, so it's visible to the document.

Try

i'm getting
Okay, I feel like this is a really basic question that should've been asked before, but do you have a frame labelled "walk" in player? Can you show a screenshot? (Select the frame and show the properties panel or wherever it is you set the frame label)

I have the 2nd frame labelled as "walk" inside the player MC. Inside the player MC there's a stop(); called at the first frame

So what happens when you try _player.gotoAndStop(2) instead? Does it go to that frame?

If it does, try renaming the "walk" frame to something else, maybe player_walk. There might be a conflict in the name and scene which might cause the error.

I've also tried MovieClip(Player).gotoAndStop("player_walk"); but it comes up with
TypeError: Error #1034: Type Coercion failed: cannot convert Player$ to flash.display.MovieClip.
at Main/enterFrameHandler()
The "linkage" is not the same thing as the variable name. The linkage is actually the Class name - so your class would be called Player, but the instance name of the Player object should be "_player".

Okay, given this I think I have enough info to say what's happening. I know this could've been resolved much quicker if I had Animate, but can you show a screenshot of the stage? (In the screenshot earlier it shows the Player MC, but not the stage itself. Is the player MC on the stage? What's the variable/instance name in the properties panel?)
That's not the main stage, or if it is, I don't see the player character anywhere. Can you click the arrow beside "player"?
It is the main stage and the player is generated on the stage by code
Can you include whatever code you're using?
If you scroll up you can find the script of the player class
Hmm, nothing particularly strange in there either. So just to recap...

What does scene "walk" contain?
There is no scene called "walk" this is what bugs me
Is this where the error occurs? (Assuming the code is uncommented)

Because I don't see any reference to "walk" anywhere in the code.


I don't get it either

Response to AS3 gotoAndStop 2020-12-04 15:52:42


At 12/4/20 02:38 PM, Gimmick wrote:
At 12/3/20 08:56 PM, Spudzy wrote:
At 12/3/20 08:52 PM, Gimmick wrote:
At 12/3/20 08:23 PM, Spudzy wrote:
At 12/3/20 08:05 PM, Gimmick wrote:
At 12/3/20 07:59 PM, Spudzy wrote:
At 12/3/20 07:56 PM, Gimmick wrote:
At 12/3/20 03:35 PM, Spudzy wrote:
At 12/3/20 02:39 PM, Gimmick wrote:
At 12/2/20 08:48 AM, Spudzy wrote:
At 12/1/20 08:02 PM, Gimmick wrote: At 11/30/20 08:01 AM, Spudzy wrote: At 11/29/20 07:04 PM, Gimmick wrote: At 11/29/20 04:40 PM, Spudzy wrote: At 11/29/20 03:55 PM, Gimmick wrote: At 11/28/20 03:56 PM, Spudzy wrote:
I tried tracing it, it just comes up with an error

D'oh. Silly me. Fixed, try running this:

At 11/28/20 04:01 PM, Spudzy wrote:
hey i've just got progress... I tried trace(MovieClip(_player));

and it's outputting [object Player] now ?

Ah, so it's visible to the document.

Try

i'm getting
Okay, I feel like this is a really basic question that should've been asked before, but do you have a frame labelled "walk" in player? Can you show a screenshot? (Select the frame and show the properties panel or wherever it is you set the frame label)

I have the 2nd frame labelled as "walk" inside the player MC. Inside the player MC there's a stop(); called at the first frame

So what happens when you try _player.gotoAndStop(2) instead? Does it go to that frame?

If it does, try renaming the "walk" frame to something else, maybe player_walk. There might be a conflict in the name and scene which might cause the error.

I've also tried MovieClip(Player).gotoAndStop("player_walk"); but it comes up with
TypeError: Error #1034: Type Coercion failed: cannot convert Player$ to flash.display.MovieClip.
at Main/enterFrameHandler()
The "linkage" is not the same thing as the variable name. The linkage is actually the Class name - so your class would be called Player, but the instance name of the Player object should be "_player".

Okay, given this I think I have enough info to say what's happening. I know this could've been resolved much quicker if I had Animate, but can you show a screenshot of the stage? (In the screenshot earlier it shows the Player MC, but not the stage itself. Is the player MC on the stage? What's the variable/instance name in the properties panel?)
That's not the main stage, or if it is, I don't see the player character anywhere. Can you click the arrow beside "player"?
It is the main stage and the player is generated on the stage by code
Can you include whatever code you're using?
If you scroll up you can find the script of the player class
Hmm, nothing particularly strange in there either. So just to recap...

What does scene "walk" contain?
There is no scene called "walk" this is what bugs me
Is this where the error occurs? (Assuming the code is uncommented)

Because I don't see any reference to "walk" anywhere in the code.


I'm working in Game Maker Studio now anyway

Response to AS3 gotoAndStop 2020-12-04 19:03:46


At 12/4/20 03:52 PM, Spudzy wrote:
At 12/4/20 02:38 PM, Gimmick wrote:
At 12/3/20 08:56 PM, Spudzy wrote:
At 12/3/20 08:52 PM, Gimmick wrote:
At 12/3/20 08:23 PM, Spudzy wrote:
At 12/3/20 08:05 PM, Gimmick wrote:
At 12/3/20 07:59 PM, Spudzy wrote:
At 12/3/20 07:56 PM, Gimmick wrote:
At 12/3/20 03:35 PM, Spudzy wrote:
At 12/3/20 02:39 PM, Gimmick wrote:
At 12/2/20 08:48 AM, Spudzy wrote: At 12/1/20 08:02 PM, Gimmick wrote: At 11/30/20 08:01 AM, Spudzy wrote: At 11/29/20 07:04 PM, Gimmick wrote: At 11/29/20 04:40 PM, Spudzy wrote: At 11/29/20 03:55 PM, Gimmick wrote: At 11/28/20 03:56 PM, Spudzy wrote:
I tried tracing it, it just comes up with an error

D'oh. Silly me. Fixed, try running this:

At 11/28/20 04:01 PM, Spudzy wrote:
hey i've just got progress... I tried trace(MovieClip(_player));

and it's outputting [object Player] now ?

Ah, so it's visible to the document.

Try

i'm getting
Okay, I feel like this is a really basic question that should've been asked before, but do you have a frame labelled "walk" in player? Can you show a screenshot? (Select the frame and show the properties panel or wherever it is you set the frame label)

I have the 2nd frame labelled as "walk" inside the player MC. Inside the player MC there's a stop(); called at the first frame

So what happens when you try _player.gotoAndStop(2) instead? Does it go to that frame?

If it does, try renaming the "walk" frame to something else, maybe player_walk. There might be a conflict in the name and scene which might cause the error.

I've also tried MovieClip(Player).gotoAndStop("player_walk"); but it comes up with
TypeError: Error #1034: Type Coercion failed: cannot convert Player$ to flash.display.MovieClip.
at Main/enterFrameHandler()

The "linkage" is not the same thing as the variable name. The linkage is actually the Class name - so your class would be called Player, but the instance name of the Player object should be "_player".

Okay, given this I think I have enough info to say what's happening. I know this could've been resolved much quicker if I had Animate, but can you show a screenshot of the stage? (In the screenshot earlier it shows the Player MC, but not the stage itself. Is the player MC on the stage? What's the variable/instance name in the properties panel?)
That's not the main stage, or if it is, I don't see the player character anywhere. Can you click the arrow beside "player"?
It is the main stage and the player is generated on the stage by code
Can you include whatever code you're using?
If you scroll up you can find the script of the player class
Hmm, nothing particularly strange in there either. So just to recap...

What does scene "walk" contain?
There is no scene called "walk" this is what bugs me
Is this where the error occurs? (Assuming the code is uncommented)

Because I don't see any reference to "walk" anywhere in the code.
I'm working in Game Maker Studio now anyway


Oh, I see. Sorry for not being able to help; I hope GMS is better to work with!


Slint approves of me! | "This is Newgrounds.com, not Disney.com" - WadeFulp

"Sit look rub panda" - Alan Davies

BBS Signature

Response to AS3 gotoAndStop 2020-12-05 14:25:03


At 12/4/20 07:03 PM, Gimmick wrote:
At 12/4/20 03:52 PM, Spudzy wrote:
At 12/4/20 02:38 PM, Gimmick wrote:
At 12/3/20 08:56 PM, Spudzy wrote:
At 12/3/20 08:52 PM, Gimmick wrote:
At 12/3/20 08:23 PM, Spudzy wrote:
At 12/3/20 08:05 PM, Gimmick wrote:
At 12/3/20 07:59 PM, Spudzy wrote:
At 12/3/20 07:56 PM, Gimmick wrote:
At 12/3/20 03:35 PM, Spudzy wrote:
At 12/3/20 02:39 PM, Gimmick wrote: At 12/2/20 08:48 AM, Spudzy wrote: At 12/1/20 08:02 PM, Gimmick wrote: At 11/30/20 08:01 AM, Spudzy wrote: At 11/29/20 07:04 PM, Gimmick wrote: At 11/29/20 04:40 PM, Spudzy wrote: At 11/29/20 03:55 PM, Gimmick wrote: At 11/28/20 03:56 PM, Spudzy wrote:
I tried tracing it, it just comes up with an error

D'oh. Silly me. Fixed, try running this:

At 11/28/20 04:01 PM, Spudzy wrote:
hey i've just got progress... I tried trace(MovieClip(_player));

and it's outputting [object Player] now ?

Ah, so it's visible to the document.

Try

i'm getting
Okay, I feel like this is a really basic question that should've been asked before, but do you have a frame labelled "walk" in player? Can you show a screenshot? (Select the frame and show the properties panel or wherever it is you set the frame label)

I have the 2nd frame labelled as "walk" inside the player MC. Inside the player MC there's a stop(); called at the first frame

So what happens when you try _player.gotoAndStop(2) instead? Does it go to that frame?

If it does, try renaming the "walk" frame to something else, maybe player_walk. There might be a conflict in the name and scene which might cause the error.

I've also tried MovieClip(Player).gotoAndStop("player_walk"); but it comes up with
TypeError: Error #1034: Type Coercion failed: cannot convert Player$ to flash.display.MovieClip.
at Main/enterFrameHandler()

The "linkage" is not the same thing as the variable name. The linkage is actually the Class name - so your class would be called Player, but the instance name of the Player object should be "_player".

Okay, given this I think I have enough info to say what's happening. I know this could've been resolved much quicker if I had Animate, but can you show a screenshot of the stage? (In the screenshot earlier it shows the Player MC, but not the stage itself. Is the player MC on the stage? What's the variable/instance name in the properties panel?)
That's not the main stage, or if it is, I don't see the player character anywhere. Can you click the arrow beside "player"?
It is the main stage and the player is generated on the stage by code
Can you include whatever code you're using?
If you scroll up you can find the script of the player class
Hmm, nothing particularly strange in there either. So just to recap...

What does scene "walk" contain?
There is no scene called "walk" this is what bugs me
Is this where the error occurs? (Assuming the code is uncommented)

Because I don't see any reference to "walk" anywhere in the code.
I'm working in Game Maker Studio now anyway
Oh, I see. Sorry for not being able to help; I hope GMS is better to work with!


Yeah it should, I've been using Game Maker simce I was 12 years old!

Response to AS3 gotoAndStop 2021-02-19 14:15:59 (edited 2021-02-19 14:17:53)


This is well over 2 months old but I finally got Flash CS6 recently for the animation jam and I figured it out.


The problem's not with the code. It's your library. In hindsight, I should've noticed the problem earlier but I guess I overlooked the incongruency between Player_walk and Player's AS linkage.


"Player" refers to "Player_stand" in the library. Except the problem clearly is that Player_stand has no frame label called walk:

iu_244308_2555669.png


Change the AS Linkage for "player" to Player and remove Player_stand's AS linkage, like so:


iu_244309_2555669.png


And it works perfectly now:

iu_244310_2555669.png


In short, make sure your AS linkage refers to the correct movieclip.


Slint approves of me! | "This is Newgrounds.com, not Disney.com" - WadeFulp

"Sit look rub panda" - Alan Davies

BBS Signature