Help if anyone can PageTurning effect

I am using some code to creat the page turning effect, which
works quite nicely to turn pages. But it only turns pages from
right to left and I would like the option of going left to right.
The code or file i used is from:
http://www.oreillynet.com/pub/a/javascript/2004/09/03/flashhacks.html
You can download the source .fla from here
I was hoping some one could point in the direction or gimme
some pointers on how I could re-code this effect to turn both ways
http://www.oreillynet.com/pub/a/javascript/2004/09/03/flashhacks.html

heres the code by the way. Downloading the file may be a long
process
function curlPage(p) {
// Create the page pair p and p+1
var topPage = this.attachMovie(pages[p], pages[p],
TOP_PAGE_DEPTH, pagePos);
var bottomPage = this.attachMovie(pages[p+1], pages[p+1],
BOTTOM_PAGE_DEPTH, pagePos);
// Mask the bottomPage (recall that bottomPage is actually
the one that
// appears on the top).
bottomPage.setMask(line.rightMask);
line.onEnterFrame = function() {
// This function curls the bottom
// left hand corner of the rightmost page.
line._x += (PAGE_CURL-line._x)/TURN_RATE;
movePages();
if ((line._x-PAGE_CURL)<1) {
delete this.onEnterFrame;
function pageTurn() {
// This function performs the page turning
// animation that occurs when the user is
// dragging the page.
var oldMousePos = _xmouse;
line.onMouseMove = function() {
line._x += _xmouse-oldMousePos;
oldMousePos = _xmouse;
if (line._x>PAGE_CURL) {
line._x = PAGE_CURL;
} else if (line._x<PAGE_SPINE) {
line._x = PAGE_SPINE;
movePages();
updateAfterEvent();
function movePages() {
backPage._x = line._x;
backPage.back._x = -(PAGE_EDGE-line._x);
backPage._rotation = 90*(line._x-PAGE_SPINE)/page._width;
line._rotation = 45*(line._x-PAGE_SPINE)/page._width;
function pageRelease() {
// This function runs when the user
// lets go of the page. It decides
// on whether the page should be opened
// or closed depending on where in the
// page turn the page was released, and
// uses either openPage() or closePage()
// to open/close the page respectively.
delete line.onMouseMove;
if (line._x<HALF_PAGE_TURN) {
turnInterval = setInterval(openPage, 10);
} else {
turnInterval = setInterval(closePage, 10);
function openPage() {
// This function opens the page (i.e. turns
// the current page to the left) if the user
// lets go of the page when it is almost open.
line._x += (PAGE_SPINE-line._x)/TURN_RATE;
if ((line._x-PAGE_SPINE)<1) {
if (pageNum<pages.length-2) {
line._x = PAGE_EDGE;
curlPage(++pageNum);
clearInterval(turnInterval);
movePages();
updateAfterEvent();
function closePage() {
// This function closes the page (i.e. turns
// the current page to the right) if the user
// lets go of the page when it is almost closed.
line._x += (PAGE_CURL-line._x)/TURN_RATE;
if ((PAGE_CURL-line._x)<1) {
line._x = PAGE_CURL;
clearInterval(turnInterval);
movePages();
updateAfterEvent();
// Set up constants
var PAGE_SPINE = page._x;
var PAGE_EDGE = page._x+page._width;
var PAGE_CURL = PAGE_EDGE-20;
var HALF_PAGE_TURN = PAGE_SPINE+(PAGE_EDGE-PAGE_SPINE)/3;
var TURN_RATE = 3;
var TOP_PAGE_DEPTH = 0;
var BOTTOM_PAGE_DEPTH = TOP_PAGE_DEPTH+1;
var BACK_PAGE_DEPTH = TOP_PAGE_DEPTH+2;
// Set up variables
var lineAngle = 45;
var pageNum = 0;
var turnInterval = 0;
var pages = ["page1", "page2", "page3", "page4",
"page5","page6", "cover"];
// Set up position objects for the
// parts of the book that will be
// attached to the stage dynamically
var pagePos = {_x
age._x, _y
age._y};
var backPos = {_x
AGE_EDGE, _y
age._y+page._height, _rotation:90};
var linePos = {_x
AGE_EDGE, _y
age._y+page._height, _rotation:lineAngle};
var hideShadowPos = {_x
AGE_EDGE, _y
age._y};
// Attach the book parts
var backPage = this.attachMovie("backPage","backPage",
BACK_PAGE_DEPTH, backPos);
var line = this.attachMovie("line", "line", TOP_PAGE_DEPTH+3,
linePos);
var hideShadow = this.attachMovie("hideShadow", "hideShadow",
1000, hideShadowPos);
// Set up the interaction events
// (NB - the 'turn page' button is
// the back of the turning page).
backPage.onPress = pageTurn;
backPage.onRelease = pageRelease;
backPage.onReleaseOutside = pageRelease;
// Define the permanent masks.
line.pageShadow.setMask(backPage.back.shadowMask);
backPage.setMask(line.leftMask);
// Create the initial curled page.
curlPage(pageNum);
Again please if anyone knows the way I could re-code this so
as to create the page turning effect in both directions.
I'm thinking of just duplicating all the code for the right
side onto the left but this might not be the smart way of doing
this.

Similar Messages

  • Please help if anyone can!!!

    I have multiple issues. first, i have a problem on iteration. i am given
    (x,f(x)) and (x + d, f( x + d)), where x ranges from Xmin to Xmax and d = (Xmax - Xmin)/100. Draw the curve f(x) = X^3/100 - x + 10, where x ranges from -10 to 10 in this fashion. And am asked to draw a hundred line segments joining those points.
    I have already figured that the distance d = 10-(-10)/100 which is equal to 0.2. Since i am told to draw 100 line segments, i figured that increasing -10 by .2 will take 100 iterations to get to 10.
    Now my question is how do i use a "for" loop to represent the above statement. I have tried couple of them, but it doesn't seem right. example of the one i tried is:
    let x = 10
    for(i = -10; i < x; i++). I know this is wrong. Please help if anyone can. I will really appreciate and thanks in advance.

    import java.applet.Applet;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.geom.Line2D;
    This program draws graphs of curves using iterations
    CS 46A, Fall, 2002
    @author Afam Okeke Section 7
    @version October 6, 2002 Program 6
    public class DrawCubicApplet extends Applet
    public void paint (Graphics g);
    Graphics2D g2 = (Graphics2D)g;
    double xscale = (getWidth() - 1.0) / (XMAX - XMIN);
    double yscale = (getHeight() - 1.0)/ (YMIN - YMAX);
    g2.scale (xscale, yscale);
    g2.translate (-XMIN, -YMIN);
    g2.setStroke (new BasicStroke(0));
    final double Xmax = 10;
    final double Xmin = -10;
    final double Ymax = 15;
    final double Ymin = 5;
    double d = 0.2;
    This is how far i have gotten. Now i don't know how to set up my 'for' loop for the x values. That is, how can i state that from -10 with an increment of 0.2 will take 100 iterations to get to 10. I hope am not confusing you. Below is the question
    Question: Simply draw a hundred line segments joining the points (x,f(x)) and (x + d, f( x + d)), where x ranges from Xmin to Xmax and d = (Xmax - Xmin)/100. Draw the curve f(x) = X^3/100 - x + 10, where x ranges from -10 to 10 in this fashion.

  • Spinning ball of death...help if anyone can please

    Hi there,
    I'm have a Aluminium Unibody Macbook running 10.6.2., bootcamp installed running Windows 7. I am having major issues which I think are flash related. When did they start, funny enough just after Steve had a run in with Adobe at the launch on the iPad over Flash!
    When using any app, but mainly a browser, be it Safari or Firefox I am, within minutes, faced with the spinning ball of death. This also impacts on my Bootcamp partition in that it needs chkdsk to run for over an hour to fix things before booting into W7.
    I have removed and reloaded flash, reinstalled the combo 10.6.2 update even tried it in a test user account with the same issues. the spinning ball. With Flash removed all seems to be fine.
    I'm thinking I now need to reinstall SL complete on a clean formatted drive or even purchase a new drive.... BUT before I do so does anyone have any ideas as to what the issues could be or where at least I should/could start to look..
    Thanks in advance.

    Of 285GB I have 99GB showing as free...I'm not 100% convinced it's a HDD issue rather than a screwed up installation. but by what......guess I'll never know...
    Does anyone know of a crash proof app I can run that tells me what is making the spinning ball appear..... now that WOULD really help..

  • HT1766 ive backed up and restored my phone but the battery is still draining quickly i need help if anyone can tell me what to do

    we went through the steps as told by an apple rep.  it doesnt give the option to pick or choose apps to keep or get rid of.  the battery is still draing after the back up and restore.  can anyone tell me why or what to do now?  Thank you

    If still problem after advice from Apple. Take it up with them again, iPhone 4S has full Warranty so let Apple solve the problem.

  • Help,Could anyone can explain this to me ?

    public class A {
    B b;
         private int a;
         * @param args
         public int get(){
              return this.a;
         public static void main(String[] args) {
    class B{
         private int b;
         A a;
         public int get(){
              return this.b;
    There is a reference to A in Class B,and There is a reference to B
    in Class A,I am confused about this,could someone explain it to me ?

    learnningboy wrote:
    There is a reference to A in Class B,and There is a reference to B
    in Class A,I am confused about this,could someone explain it to me ?For example, there's a road between city X and city Y that goes two ways (you can travel from X to Y and you can also travel from Y to X). That's the idea: both cities hold a reference of each other in them.

  • Hello, i´m trying to do a proyect that requires modulate and demodulate a text in QAM. i´ve been trying this for days but i can´t come uo with a solution, if anyone can help me, that would be great. thank you very much

    hello
    i´m trying to do a proyect that requires modulate and demodulate a text in QAM. i´ve been trying this for days but i can´t come up with a solution, I can not retrieve the text I am modulating and i do not understand why. I am new to using Labview  and would appreciate some help.
    if anyone can help that would be great.
    i have attached the vi that i´ve done.
    thank you very much
    Attachments:
    intentoproyectocom2.vi ‏78 KB

    I beleive they used the same concept that they did in iOS. One folder deep. If you think they should implement somehting more, then please use the feedback links in the forums FAQs to leave your comments and suggestions.
    Jason

  • Hi, Firefox keeps crashing, the crash signature is ProcessBoundaryCells. I tried searching Mozilla, but there are no supporting articles. If anyone can please help me fix this issue, that would be great. Thanks

    Hi, Firefox on my desktop keeps crashing at just random moments. Sometimes not very often at all, but other times it can happen a few times within an hour.
    My Desktop Window Manager also crashes regularly and the dialogue box always pops up saying its stopped working. However, this doesn't seem to effect anything.
    It could be realated though, as I just had this desktop built a few weeks ago and a few times it's crashed as well as programs.
    If anyone can help me fix this issue with Firefox, that would be great. Thanks in advance.

    Hi,
    I updated the Flash plugin, but I still keep getting crashes.
    I will try to disable the hardware acceleration in the Flash Player as you recommended and hopefully this will work.
    Although the last crash report I got has a different problem then before,
    https://crash-stats.mozilla.com/report/index/6c5d8c66-6789-4b52-94e4-61cdf2110530
    Signature: BuildArgArray
    If you can please offer any more advice that would be great, thanks.

  • I have a PowerBook G4 17" and need Apple discs to set it up again. Mine lost during move. Screen seems damaged, has vertical lines.  Can anyone help. I can call as I have unlimited calling on my iPhone 6  anywhere in North America.

    I have a PowerBook G4 17" and need Apple discs to set it up again. Mine lost during move. Screen seems damaged, has vertical lines.  Can anyone help. I can call as I have unlimited calling on my iPhone 6  anywhere in North America.

    king,
    If your Powerbook's serial number (do not post it here) starts with "W8" then the vertical lines are mostly likely due to a defect in the display itself. W8 is a factory code and, during the iMac G5 and PowerBook G4 timespan, that factory shipped thousands of units with the same defect. It cannot be fixed via software.
    As all PowerBooks are now classed as "obsolete," an Apple Store will not work on it. They will look at it ands tell you it has vertical lines and that they cannot fix it. This Apple article shows Apple devices they curently considered obsolete:
    Vintage and obsolete products - Apple Support
    It is possible that some Apple Authorized Service Providers (AASP) will still work on older computes but they cannot get neededparts from Apple. As this issue was so pervassive, it wil be hard for you or an AASP to find a used/pulled display that is not effected with the "W8 Curse."
    Although I love the old PowerBooks, I would not even spent the money for disks, much less the US$150-400 it would cost to replace the display, even should one be available.
    If you give us a rough idea of where you are in the world, we can suggest repair shops specializing in fixing older Mac notebooks, but be aware those resources may be rather scare outside North America.

  • Pretty tech question here but if anyone can help I'd be so grateful..

    I've just updated from logic 7 to Logic 8.
    I'm currently working on a remix for a record label, I'm experiencing problems on playback in Logic 8 - basically it wont playback and cites this warning:
    **"Logic pro has detected a possible conflict between one or more third party MIDI audio drivers.**
    *Be sure to install the latest drivers for all audio and MIDI equipment connected to your computer, and remove any older or unused drivers."*
    I don't have a Roland MC505 in my studio, I'm running a MOTU 828mk2 and
    I have the most updated driver for my sound card installed.
    In Logic 7 I get the message below but playback isn't effected and I can access the entire project.
    *Instrument “Roland MC505” sends to a MIDI port named “EDIROL UM-2” of musical interface “EDIROL UM-2” which no longer exists.*
    *Please check if all MIDI interfaces are connected and switched on; otherwise adjust the instrument’s MIDI out port setting.*
    If anyone can help I'd me most grateful..

    My first thought, is for you to check your environment.
    If the song you're working on started out originally from someone else's Logic session, Their may be a Roland MC505 instrument in the MIDI layer of your environment.
    Hit Apple/8, and select MIDI from the tab in the upper right. Select and delete anything in there that doesn't apply to your set-up directly.
    See if that's what's going on...

  • Please help error -9808 when downloading apps in itunes store anyone can help me out

    please help error -9808 when downloading apps in itunes store anyone can help me out

    Click here >  iTunes: Advanced iTunes Store troubleshooting
    Then "expand" Specific Conditions and Alert Messages
    Then click 9808

  • HT4743 why are TV series not available on Itunes when they are over 2 years old and are available with Netfox & Lovefilms, E,G The Americans series 1 but not 2 or 3, Revenge series 1 & 2 but not 3. can anyone help were I can download them please

    Itunes is not up to date with these series, Revenge series 3 and The Americans 2 & 3, can anyone help were I can stream this to my Mac or ITV please

    It is up to the content owner as to when, and if, specific content is available on itunes (or any outlet for that matter). Very often a network or production compnat willhave exclusive deals with streaming outlets for a period of time before a seaon of a series is available elsewhere.
    I can't speak to most of the shows you reference, but in the case of The Americans, there has only been one season so far. Season two isn't schedule for broadcast until February of next year.

  • I use "hdmi to component converter" to connect apple tv with my old plasma tv by component cable. Sound is ok but the picture split 2screens left and right. Still can't fix it. Anyone can help or has any idea? should I try convert to av?

    I use "hdmi to component converter" to connect apple tv with my old plasma tv by component cable. Sound is ok but the picture split 2screens left and right. Still can't fix it. Anyone can help or has any idea? should I try convert to av?

    Your TV hasn't entered some odd picture in picture mode has it with  two 'inputs' side by side?
    AC

  • Unable to play video onto my Samsung LCD TV when using a Memorex Mini Soundbar MA5004. Anyone can help?

    Unable to play video onto my Samsung LCD TV when using a Memorex Mini Soundbar MA5004. Anyone can help?

    Does anything go to the TV? Like can you hear audio?
    Dod it ever work?
    Does it work with other display devices?
    You are using an app that supports TV out?
    What does the soudbar have to do with it? 

  • I am residing in India and have purchased Ipad 3 from US, I have lost my invoice and also the small pin which helps in inserting sim card, Can anyone help me how can I get a copy of duplicate invoice from India and a PIN for my Ipad 3

    Dear Friends,
    I have purchased Ipad 3 from the US but unfortunately while returning back to India I have lost in transit the copy of Invoice and a tiny PIN which helps in inserting 3G card.
    Can anyone help me how can I get the duplicate copy of my invoice and an extra PIN from India and whether any Apple Store in India can issue me the duplicate copy of Invoice for the product purchased from US and also are the require to issue me an extra PIN on request.
    Thanking you all in anticipation....
    Regards,
    Bankim Mehta

    You can use a paper clip instead of the PIn that came with the iPad.
    http://support.verizonwireless.com/clc/devices/knowledge_base.html?id=54813
     Cheers, Tom

  • My ipad is hung what to do?i cannot switch off for 2 weeks because of i cloud it say full and cannot be back up i try to close or open the settings but nothing happen anyone can help me thanks a lot in advance

    my ipad is hung what to do?i cannot switch off for 2 weeks because of i cloud it say full and cannot be back up i try to close or open the settings but nothing happen anyone can help me thanks a lot in advance

    Welcome to Apple Support Communities
    Hold Sleep and Home buttons for 10 seconds until the device restarts

Maybe you are looking for

  • My ID was changed fraudulently and I want to change it back.

    My apple id was changed fraudulently and I got the email stating: Hello, The following information for your Apple ID XXXX was updated on 22/03/2013: Apple ID Email address(es) If these changes were made in error, or if you believe an unauthorised per

  • Windows Server 2008 R2 Folder Redirection on Windows 8.1 Not Working

    I am running Windows 2008 R2 Domain Controllers on 2008 R2 Functional Level. Only our IT Dept is running Windows 8.1, everyone else on 7 Enterprise SP1 edition. I cannot get Folder Redirection to work on Windows 8.1 which I need to get completed beca

  • Not recording whole programmes

    Recently, (about two weeks) my you view box has been dicking about with recordings. We have a few season records set up and now and again when I go to watch an episode it has only recorded 4 mins, it's usually 4 but sometimes it's 2. It also happens

  • IWeb Doesn't show the web page!

    When i open up iWeb it wont show the template that i choose... Plz help me... thanks

  • Unrecognized file format

    I'm using a Fujifilm s1500 to upload photos to iPhoto. I've uploaded with this camera several times now with no issues. After trying to upload my latest pictures several times, I got the same response: "unrecognized file format." 4 pictures uploaded,