Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / Flash Actionscript / December 2005



Tip: Looking for answers? Try searching our database.

build up layers of movieclips then remove them

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
IndieMonkey - 31 Dec 2005 15:22 GMT
Hello, I was wondering if anybody could help me out with the actionscript to
produce a website idea have.

The sites navigation consists of a list of buttons down the the left hand side
of the page, then once the buttons are clicked I want a movieclip (in the style
of a piece of paper) to appear on the right of the screen (so attach in a
certain place). You can press these buttons as many times as you like so the
paper stack appears to be building up. But, to make it look a little more
realistic (and to make the problem harder!) I'd like them to attach in a random
place - within set boundaries!

However, once the pages (or attached movieclips) have reached a certain
number, say 10, I'd like them all to slowly slide down off the screen - then
disappear.

I think some kind of counter may work but im not entirely sure where to start!
If any clever people could help me out, I'd be very grateful!
:-s

Thanks,
Gavin.
kglad - 31 Dec 2005 16:17 GMT
use attachMovie() to attach your pages to the stage, use ranNum(x1,x2) to
position your pages and keep track of the depths used to attach your pages so
you can remove the lowest page:

dep=0;
pageA=["page1ID","page2ID",...];
for(var j=1;j<=buttonNumber;j++){
_root["btn"+j].jvar=j;
_root["btn"+j].onPress=function(){
rclip=_root.attachMovie(pageA[this.jvar],"page"+dep,dep);
rclip._x=ranNum(x1,x2);
rclip._y=ranNum(y1,y2);
if(dep>10){
removeMC(_root["page"+(dep-10)]);
}
dep++;
}
}
function ranNum(a,b){
return Math.floor(a+(b-a+1)*Math.random());
}
slideOffA=[];
ind=0;
function removeMC(mc){
slideOffA[ind]=setInterval(slideOffF,60,mc,ind);
ind++;
}
function slideOffF(mc,ind){
mc._y+=3;
if(mc._y>Stage.height){
clearInterval(slideOffA[ind]);
mc.removeMovieClip();
}
}
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.