Jump to content


Can this be put in more detail


  • You cannot reply to this topic
1 reply to this topic

#1 I am still lost

    Young Padawan

  • Members
  • Pip
  • 7 posts

Posted 09 September 2007 - 02:25 PM

I really like this but for a noob like me to flash i am still missing the minor details... I can create the buttons no biggie... but trying to get the slading stuff to work and get them layed out i am lost

http://www.flashvist...tails/item/746/

#2 flamereaper

    Young Padawan

  • Members
  • Pip
  • 65 posts
  • Gender:Male
  • Location:UK

Posted 12 September 2007 - 04:02 PM

Glad to help (hopefully)

Right well the buttons are the tough part i recon. (i just find things go wrong with buttons for no reason more)

but here we go.

You wan to have a movie clip, this clip will contain all of the art for the pages, set up next to each other. ALso make sure that the registration point for the clips is on the far left. (this is important). also make sure all the pages are the same width, (in this case i will use 200px)

then what you want, is to give the movie and instance name of for example Pages. then (i put the code on the main timelines frame, you can split it to the buttons if you need to).

page1button.onRelease=function(){
Pages.targetX = 0;
}
page2button.onRelease=function(){
Pages.targetX = 200;
}
page3button.onRelease=function(){
Pages.targetX = 400;
}
(continue with these for as many buttons as you have, each time increasing the target X by the width of a page)


then the code that gets your sliding going.

onEnterFrame=function(){
dx = Pages.targetX - Pages.x; // the distance to the target position from the current location
if(dx>1 || dx<-1){ // if the distance is not within 1px of the target, move it
Pages._x += dx/5; // by moving it by only a 5th of the dx value, it will move fast at first, then slow, increase or decrease the number 5 to increase or decrease the ammount of friction on the sliding movement
} else {
Pages._x = Pages.targetX; // if its within 1 px, just set it to the right position (stops tiny movements)
}
};



Hope that helps. let me know if you need any more help.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users