Which button does this concern? What should it do that other buttons do? Have you tried putting a trace() function in the event handler function for the button to see if it reacts at all when it is used? Where is the code located relative to the button?
I looked at your file. I'm guessing that the problem is with the goToAsylum_btn that is labeled "Next". When I test the movie, I get a 1009 error. In looking through the code on frame 1 everything "seems" to be in order. Look at the items in the ButtonPlaceholder layer. In the first frame, you have four "Next" buttons. In the subsequent keyframes, there are only 3.
That was what my teacher said the problem was but even when I put the buttons on the first frame they still don't work.
It concerns the Next button on the Warrior page, frame 121.
It should send you to the Asylum page, frame 151.
I put a trace command in and it doesn't respond. In fact it doesn't even register the click because the button doesn't even go to it's "Hit" color.
The code is all on frame 1. I've updated it some since I uploaded it so it doesn't have the trace command but the relavent lines are on Actions Frame 1 Lines 22-25
1 person found this helpful
You will know better than myself, but I think the problem stems from you not having the buttons continuous along the timeline. What I mean is that you appear to have left the next button on the Warrior page out of all the sections that precede it except frame 1's section. In doing that you have disconnected the code in frame 1 from the button in the warrior section. The code has to be assigned to the button and if it disappears from the timeline it also loses that connection - its name alone does not tie it to the code.
Here is a different approach that might make it easier for you to manage... have the buttons layer be one continuous set of frames instead of breaking it with a keyframe for each section. In frame 1 place all of the buttons in their place. In the actions layer make use of the 'visible' property to control which buttons are visible in the different frames. You could even have a function that you share for them all that first hides them all and then sets the one passed to that function to be visible. Alternately, you could just have code at the start of each section that adjusts the visible properties for all of them as needed.
If you move that Next button onto the stage in frame 1 you will see it works properly.
Ned Murphy wrote:
You will know better than myself, but I think the problem stems from you not having the buttons continuous along the timeline.
That is absolutely what the problem is. All those events are only assigned to the initial instances of the buttons. The moment that first keyframe hits, as far as Flanimate is concerned it's now a completely new set of buttons (that coincidentally happen to have the same names).
Agreed that the correct way to do this is to have the buttons continuous across the entire adventure. He could then write a set of global helper functions to configure their label and destination at each step. For example, each "page" of the adventure could have something like:
configButton(choice1btn, "Play", "classChoice");
But then why does everything else up to that point work?
I'm kind of a novice when it comes to this type of code. I'll see if my teacher can help me set this up.
Thank you very much.
I cannot answer for Animate CC since I do not use it, but for Flash it has always been a case where if you have objects continuous along a timeline they will remain those objects even if you break them with keyframes at different points. This can work to your advantage in some cases, but in other cases it can cause what you intend to be a different object to be the same object. For instance, if you took that button and placed it on two adjacent keyframes, and only assigned it an instance name in the first frame, the second one would still acquire that instance name by some weird Flash osmosis. Similarly, if you named the second one but did not name the first one, the second one would lose the name you assigned it due inheriting the property of the first. That is why some of the buttons worked... you have them continuous in the different keyframes involved. But in this Warrior case you broke that connection.
Yeah, Flash tries to figure out when an object is still itself so that tweens can work, but it doesn't always work, so should never be relied upon when things are instantaneously jumping around to different parts of the stage.
Also, even if this approach did work reliably, it would still be the wrong approach because it scales terribly. It requires creating unique button instances for every single stage of the adventure.