Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Swapping scrollpane content 1

Status
Not open for further replies.

Puckle

Technical User
Jan 16, 2008
2
MX
Hi,

I've got a scrollpane, and outside that I have a few buttons working as a nav bar. I want these buttons to load a different movieclip (which isn't in the stage, it's in the library) to the scrollpane.

Using the tutorial on this site (the one where you add or remove a blue movieclip to the scrollpane) I got as far as adding the movieclip to the scrollpane. Problem is, I need the buttons to unload the current movieclip before loading the new one.

(So for example, if the movieclip called "home" is loaded in the scrollpane and I click on the button "Patterns & Textures" I want that button to unload "home" from the scrollpane and load the movieclip "patterns")

My code so far looks like this:

Code:
scrollPane.setStyle("borderStyle", "none");

var  i:Number=0;
var mcMain:MovieClip;
function init() {

scrollPane.contentPath = "home";
mcMain = scrollPane.content;
trace(mcMain);

}
init();

brushes_btn.onRelease = function() {

mcMain.attachMovie("brushes", "brushes"+i, mcMain.getNextHighestDepth(), {_y:50*i+5, _x:5});
i++;
scrollPane.invalidate();

};


Taken from the kirupa tutorial.

I'm pretty sure I don't need the + i part because I won't have more than one mc in the scrollpane at once, but I don't know how to remove it without screwing it up.

I'm using CS3 and AS2.

I'd greatly appreciate any help!
 
Code:
scrollPane.setStyle("borderStyle","none");
scrollPane.contentPath = "home";

patternsAndTextures_btn.onRelease = function():Void  {
	scrollPane.contentPath = "patternsAndTextures";
};

Kenneth Kawamoto
 
Thank you so much!! It works perfectly, I was going crazy trying to figure it out.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top