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:Can you include whatever code you're using?At 12/3/20 07:56 PM, Gimmick wrote:It is the main stage and the player is generated on the stage by codeAt 12/3/20 03:35 PM, Spudzy wrote: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"?At 12/3/20 02:39 PM, Gimmick wrote:At 12/2/20 08:48 AM, Spudzy wrote: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".At 12/1/20 08:02 PM, Gimmick wrote:I've also tried MovieClip(Player).gotoAndStop("player_walk"); but it comes up withAt 11/30/20 08:01 AM, Spudzy wrote:So what happens when you try _player.gotoAndStop(2) instead? Does it go to that frame?At 11/29/20 07:04 PM, Gimmick wrote:I have the 2nd frame labelled as "walk" inside the player MC. Inside the player MC there's a stop(); called at the first frameAt 11/29/20 04:40 PM, Spudzy wrote: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)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.
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.
TypeError: Error #1034: Type Coercion failed: cannot convert Player$ to flash.display.MovieClip.
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?)
If you scroll up you can find the script of the player class