Hi pb1856,
There's several ways to accomplish this. Firstly, you should make sure your desired content (page) is contained within a movieclip.
Approach 1: On stage, but hidden until needed.
Place your movieclip on the stage on a separate layer with an easy to remember instance name. On a separate "actions" layer, in the first frame, set it's "visibilty" to false - like so:
// Example movieclip instance name: content_mc
content_mc._visible = false;
Next, write some code to tell a button to change that visibility to true when it's clicked:
// Example button instance name: my_btn
my_btn.onRelease = function() {
content_mc._visible = true;
}
Approach 2: Attaching the movieclip to the stage when needed.
Having created your content movieclip, you'll need to know exactly where you'd like to place it on the stage. So place it where you want it to be, then select it and goto the Properties panel. Take note of it's X and Y coordinates. Also note that your movieclip will not initially need an instance name, so delete that if there is one. And you can now delete the movieclip from the stage. It's still in the library. Hit the shortcut key F11 to view the library. Right click on your movieclip and select Linkage. Take note of the Linkage Identifier for later - it's usually the same as the name you've given your symbol. Make sure the "Export for ActionScript" and "Export in first frame" check boxes are checked, then Ok it.
That's your movieclip prepared to be added to the stage. Now for the ActionScript to perform it:
// Attaching a movieclip to the stage from the library
attachMovie("content_mc", "content", 0, {_x:0, _y:0});
Let's understand what the above means:
attachMovie = the command to attach movieclips to the stage
"content_mc" = the linkage identifier from earlier goes here
"content" = this is where you supply an instance name
0 = the level your movieclip will be attached to
{_x:0, _y:0} = the X and Y coordinates you noted from earlier go here
Following on from Approach 2, if you have buttons or anything that needs to be accessed within your content movieclip, you can address those symbols by using the new instance name. As per the example code above, addressing a button would look like this:
// Example button instance name: another_btn
content.another_btn.onRelease = function() {
// do something
}
And finally, removing the attached movieclip with a button:
// Example button instance name: remove_btn
// Attached movieclip instance name: content
remove_btn.onRelease = function() {
removeMovieClip("content");
}
That's pretty much it. Hope it's helpful
