Copy link to clipboard
Copied
I'm using HTML5 Canvas to build a menu.
I have 2 layers: a Javascript layer and a layer for my menu:
I have some movie clips in my library.
When a particular frame loads, I want it to show some movie clip on the stage. When a different frame loads, I want that movie clip to disappear.
Right now, the javascript for the frame with the movie clip looks like this:
if (exportRoot.ControllerStatus == "working")
{
ControllerWorkingClip = new lib.ControllerWorkingClip();
this.addChild(ControllerWorkingClip);
ControllerWorkingClip.setTransform(274.9,380.7,4.452,4.45,0,0,0,39,44.5);
} else
{
ControllerBrokenClip = new lib.ControllerBrokenClip();
this.addChild(ControllerBrokenClip);
ControllerBrokenClip.setTransform(274.9,380.7,4.452,4.45,0,0,0,39,44.5);
}
This adds the proper movie clip to the stage in the right position, but when my frame changes to a different menu, the movie clip is still visible.
As far as I can tell here, "this" is exportRoot.
Is there a way to add the movie clip to the current frame so that the movie clip disappears when the frame changes?
Frames do not "load", therefore neither do they unload. So anything you add with code, you're responsible for removing with code.
That being said, if you want a particular movie clip to appear on a particular frame, and not appear on other frames, why don't you just put that movieclip on that frame? That's literally what the timeline is designed for.
Copy link to clipboard
Copied
Frames do not "load", therefore neither do they unload. So anything you add with code, you're responsible for removing with code.
That being said, if you want a particular movie clip to appear on a particular frame, and not appear on other frames, why don't you just put that movieclip on that frame? That's literally what the timeline is designed for.
Copy link to clipboard
Copied
The if statement chooses which movie clip to put on the frame.
If I have a dozen different movie clips that the if statement can choose from, I don't want them all sitting on the frame in the editor, but hidden, or anything messy like that.
Copy link to clipboard
Copied
You have two options then...
1. When navigating away from the frame, use code to remove any clips you've added.
2. Put all possible clips in a single container clip, one per frame. Put the container clip in the appropriate root timeline frame. Use code to display the clip you want by telling the container clip to go to that frame.
Copy link to clipboard
Copied
#2 is an interesting idea. I'll give that a try.
Thanks
Find more inspiration, events, and resources on the new Adobe Community
Explore Now