Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to Ensure Symbol State Persists?

New Here ,
Jul 01, 2013 Jul 01, 2013

Okay, so I have a symbol that I want to show/hide; it's a named MovieClip with two labelled frames ("show" and "hide" in that order), the default is to be shown, and both frames have a stop() command.

This seems fine however at one point in my animation I trigger the symbol to hide via foo.gotoAndStop("hide"), but when the animation loops the symbol reappears (or rather, returns to the "show" frame).

Now, obviously this is annoying, but other symbols that function in the exact same way appear to be working as expected, so I'm at a complete loss as to why this one symbol in particular seems to be resetting? Is there some characteristic of the animation that might be causing Flash to see the symbol as if it were a new instance? I've checked that the symbol's name is constant throughout the animation, and I'm really only using classic tweens; certainly nothing that stands out as different in way compared to the other, working symbols.

Aside from completely re-creating the animation for that symbol I'm not sure what else I can try, so any suggestions are welcomed!

TOPICS
ActionScript
639
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 01, 2013 Jul 01, 2013

If the object exists in multiple keyframes then it can reset when you move to a new one.  If that's the case you should have this object in its own layer and have only one keyframe for it in that layer.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 01, 2013 Jul 01, 2013

I'm afraid that's not really an option as the object needs to move as part of the animation, but I also need to be able to show and hide it as required. It also wouldn't explain why other symbols work fine, as they are also part of keyframed animations and show/hide exactly as expected.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jul 01, 2013 Jul 01, 2013

Just put the animation to move the movieclip around within another movieclip. To set the visibility of a movieclip through code, give it an identifier name and type:

movieclipNameHere._visible = false; (or true).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 01, 2013 Jul 01, 2013

While that seems like it would work, it involves syncing everything in the main timeline with the separated piece, which I'm not sure is much of an option either as if I want to add frames or tweak anything then I need to move any changes into the separate symbol, I'd also need to sync up script actions in the main timeline that affect the symbol (e.g - looping, skipping forward/back etc.).

It's something at least, but it still doesn't explain why this particular symbol isn't staying hidden when other symbols, hidden in the same way and also animated, are working perfectly.

Also for clarity, I'm not using ._visible because I'm not actually hiding the symbol in its entirety, it folds away. It probably doesn't matter though; like I say other symbols are working fine.

Actually though, the only difference I can think of is between the symbols is that the one I'm having trouble with has a mask, but is that likely to affect anything?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 01, 2013 Jul 01, 2013
LATEST

Okay, I'm going to try to highlight what I'm seeing by taking a snapshot of the timeline where the problem occurs:

https://dl.dropboxusercontent.com/u/7999266/Temporary/FlashSymbolIssue.png

The selected layer has the problem symbol, the layer immediately above is the mask layer. The blue circle indicates the frame at which the symbol is hidden (or shown) by a script further up in the timeline. The symbol displays as expected for the duration of the blue tween. At the green circle, a new tween begins but the symbol remains unchanged, continuing to be shown or hidden as expected for the during of that tween. The red circle however is where the symbol apparently resets to the default (showing) frame, and loses any other state assigned to it (e.g - if I were to set a variable upon it such as foo.bar = "foobar").

Why would the symbol retain state through the green circle, but not the red one? It seems that at the green circle the symbol is still the same instance, but at the red circle it is not, even though nothing seems to be happening any differently.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines