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

Where have all my children gone?

New Here ,
Jun 05, 2016 Jun 05, 2016

Hope this is a relatively simple answer to a less-than-intelligent question that's a consequence of how I learn things when not doing them for work. In this case I started a game about 3 years ago in AS3 as I was familiar with js at least and had also worked with shockwave back in the day. Anyway, when learning something offline like this I tend to learn just what I need to know to do what I need to do next, and can sometimes get pretty far into one area while missing something obvious and simple because I just haven't crossed that case yet.

We have a playing field and playing pieces. Those playing pieces (sailing ships) you see below are complex objects with dozens of properties and several children including graphics and text fields that change depending on the state of the ship. It's WEGO where each side plots moves, those moves are then executed one ship at a time alternatively between the two sides, then we have gun combat, etc. All that is there and works fine, a few thousand lines of code.

My current problem is that when a player clicks on a ship to select it, I unhide a yellow border to indicate which ship is selected and draw the complex ship detail screen you see top left, but for a long time I've wanted to change the background color of the playing piece as well.

After a long layoff I started working on this again and decided to start there. So I made new counters, added them as keyframes to the already existing symbol/class that contains all of the country default backgrounds, and modified the code. It works fine in that the background is changed to the correct highlighted version, and then goes back to default when deselected.

In the image the currently-selected ship is in the center, USS Constitution, its detail/info screen is also displayed. You can see the problem, all the children are gone on the playing piece. And they don't come back when you go back to the original default background.

At first I thought it was a z order problem but it isn't, I walked the selected ship playing piece background in the z index until they disappeared behind the ocean background, there was just open ocean where the ship playing piece used to be.

My best guess is that maybe the children have to be instanced on each frame of the parent's timeline each time you change the parent's frame but if so I'm not finding reference to or explanation of that. That and that seems really unwieldy way of doing things, I was completely caught off guard by the idea of the children caring what frame its parent is on unless there was coded logic telling it to.

Somehow even though I have thousands of lines of complex dialogs and screens displaying multiple dynamic children I have never changed the base background in any of those cases.

Also tried to google this, but had little luck. I couldn't even figure out a relatively simple question to ask.

I'll be happy to paste code but I don't seem to have a code problem but an understanding problem.screenshot_new_counter_problem.jpg

TOPICS
ActionScript
236
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 ,
Jun 06, 2016 Jun 06, 2016
LATEST

If the parent changes its internal frames then the children that live within its timeline need to be present in those frames (unless you create them dynamically within the parent)

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