Add Pages to Flash Page Flip (PageFlip)

“How to add more pages” is the most common topic found at the PageFlip Help page. If you’d like to know how to add a page or why you keep getting an error saying, “A ‘with’ action failed because the specified object did not exist” then this Tutorial is what you’re looking for.

You can watch a video walk-through illustrating every detail of this “Adding Pages” tutorial.

To be sure we’re working with the same file and code, download the Page Flip Source File. Open it up and check it out. This one FLA file is designed to be a self-contained page flip solution. It contains a SWF Player version checker, a preloader, each page of the book and the code to make it all go.

Change “maxPages” variable: The first step in adding pages is to locate the main code block and change the “maxPages” variable.

  1. Open the PageFlip file.
  2. Click on frame #11 of the Pages layer.
  3. The small cross highlighted in the center of the stage is an instance of the “Bound Pages” movieclip named “Pages”. Double-click it to begin editing it.
  4. Once you are editing the Bound Pages clip, select the first frame of the Actions layer.
  5. Open the Actions Panel (Menu»Window»Actions).
  6. Go to line #29 in the Actions panel to locate the “maxPages” variable.
  7. Change the “maxPages” variable to the number of pages you want your book to have. Be sure to use an even number or else very bad things will happen.

As far as modifying code goes, that’s all you needed to do, now it’s a matter of creating your new pages and adding them to the FLA file.

Creating a page: You need to make sure you create a Print movieclip for every page in your book, even the blank ones.

  1. Open the “Create New Symbol” window. (Menu»Insert»NewSymbol).
  2. Name the new symbol “print” (all lower case) followed by a page number. For example page #9 would be named “print9”.
  3. Make sure the symbol’s “Type” is set to “MovieClip”.
  4. Check the “Export for ActionScript” box.
  5. Make sure the Identifier is “print” followed by the proper page number (should be automatic).
  6. Un-check the “Export in first frame” box.
  7. Click “OK” to close the “Create New Symbol” window and begin editing the new movieclip.
  8. Drag an instance of the “Page Guide Outline” graphic from the Library onto the Stage of your new Print clip.
  9. Center the Page Guide Outline in the exact middle of the stage.
  10. Add your page content to the movieclip while keeping everything within the Page Guide Outline

Adding a page:

  1. Go to the root/main timeline.
  2. Create a new blank keyframe at the end of the “Prints” layer. (Right-click the keyframe in the timeline and choose “insert blank keyframe”.)
  3. Select the new keyframe.
  4. Drag the new page movieclip (e.g. Print9 etc.) from the Library onto the stage. Make sure the movieclip lands in the last keyframe of the Prints layer that you created 2 steps ago.
  5. Repeat steps 2, 3 and 4 for each new page. You must have a “Print” movieclip for every page in your book.

Adjusting the file to accommodate the new pages:
The basic goal is to extend the length of all layers with content by adding one more frame to them.

  1. Drag the last keyframe of the Actions layer to the right, one frame beyond the last keyframe in the Prints layer.
  2. Insert a new frame in the “Pages” layer under the last frame in the Actions layer. (Right-click the keyframe in the timeline and choose “insert frame”.)
  3. Insert a new frame in the “Background” layer under the last frame in the Actions layer.
  4. Insert a new frame in the “Load Status” layer one frame before the last frame in the Actions layer.
  5. Repeat for any other layers containing graphic content.
  6. Test the movie.

If you will be loading the entire “PageFlip.swf” file with an external preloader you can skip step #6 in the “Creating a page” section which will ensure the Print clip is exported in the first frame of your SWF file. You can also skip the “Adding a page” and “Adjusting the file” sections completely.

Leave a comment if you have any questions.

NEW! StarImproved PageFlip Now Available: Improved PageFlip implements the most commonly requested features.


159 Responses to “Add Pages to Flash Page Flip (PageFlip)”

  1. Vince says:

    Hi!

    1st let me say that this tutorial is great and your stuffs rock!

    Now, I’ve downloaded the latest Page Flip Source file, I am using Flash MX (6.0) on PC, and use the flash player 6 that comes with MX to test the SWF…

    I’ve followed your tutorial step by step, made sure every single times that the linkage are good,and triple-checked it…even saved the FLA under an other name to try and recreate my own print symbol following once again your tutorial very carefully, removing all the print frames and clip and redoing my own but it never works.

    Every time i am testing there is the famous “A ‘with’ action failed because the specified object did not exist” coming up, and this even with the original page flip ressource file…the only time i’ve seen this working was actually on your site… 🙁

    What do you think i missed? is FLash MX/6.0 too old for this?

    Please let me know…Thanks very much!!

  2. francis says:

    Ur a genius! well done…:)

  3. Tahar Hussain says:

    Good Morning,
    i am not understanding the action how to call images insted of that message. pls clear my doubt.

    Regards,

    Tahar Hussain

  4. Buenos Dias says:

    Dear Pixelwit,
    thanks for your great free code for pageFlip.
    I hope you can help me with my questions:
    Have you already done a AS for automatic or by On relaese turning pages for lazy people? Free or only in your Improved Version?
    Have you already done a AS for changing the content without placing it in the fla before? Like reading any unnumbered jpg from a file and add them to a new empty MC?
    Best regards and thank you.
    Buenos Dias

  5. Mark B says:

    Is it possible to embed other premade swf files in a page so that it takes up the whole page?

    Thanks
    M.

  6. John Ospina says:

    Hi! I’d like to purchase your full featured page flip template with instructions. do you accept paypal?

    Thanx in advance!

  7. Pixelwit says:

    @Constance, After I did some further testing, I learned that the book requires a minimum of 4 pages due to the way the “limitBook” function is set up. You might be able to adjust the conditional statements (if, else) in there to get it to work but I didn’t see an easy solution. Thanks for bringing this to my attention.

  8. Constance says:

    I just did but nothing has changed :
    http://doculogy.opus-net.com/sources/flash/doculogy-schema-global.swf
    Do you know for wich reason ?

    I deleted th third page and deleted the keyframe for this third page on the main scene. and put the last content on the stage.
    there is still corner

  9. Pixelwit says:

    @Constance, An ‘even number’ is a number which can be divided by 2 without a remainder. Set MaxPages to 2 and put the third page on the stage in a layer under your 2 page book.

  10. Constance says:

    thank you for your quick answer. could you tell me what is your even number ? there’s no way to chnage that even number rather than create a new page book ?

  11. Pixelwit says:

    @Stephen, it sounds like you’re not setting the Linkage Identifier or you’re not placing the clip on the stage.

    @Constance, All ‘real’ books have an even number of pages, this one’s no different. A suitable solution might be to create a 2 page book and then place it on top of your 3rd page.

  12. Constance says:

    Deae Pixelwit,
    I’m thanksfull to you for your work. it’s a great one !

    I just have one question. I need to have a book with only 3 pages. I followed your instructions step by step to create page. My maxPages is 3. but the page flip coninue to put a corner as if there is a fourth page. in the main time, theunexisting 4th page, is transparent. How can I make this corner on th4th page disapears ?

  13. Stephen Hanson says:

    Ok, I’ve managed to add one more page but I wanted at least two more. I changed the code to 12 max. and did all of the other things mentioned:
    1. Added new symbol correctly, Page9, Added contact by dragging an outline graphic from one of the other Print# (Print 5 or whatever) to the stage, inserted new blank keyframe, and then again added the outline graphic to the stage there as well to complete the blank keyframe. I then did the same operation for another Print# (Print10)Then I adjusted the Actions,(did control drag) Pages, Background one more frame. Also, added one more frame to the Load Status (just one more frame behind the others.)
    HOwever, when testing I get the error message when attempting to go to page 10. I set the max to 12, perhaps I need to change to max 10 or add 2 more pages so it won’t show error message?

    Thanks…

  14. Pixelwit says:

    @Stephen Hanson, You’re working with the older file from ActionScript.org, you should use the file at the top of this page (To be sure we’re working with the same file…) since it is free of typos. I’ve modified the tutorial so the part about dragging pages to the stage is a bit clearer. Let me know if you have any other suggestions. Thanks.

  15. Stephen Hanson says:

    Nevermind, it looks like it’s on line 46 and not 29.
    Also, I wasn’t sure at first how to: Drag the new page movieclip (Print9 etc.) to the blank keyframe.It seems that I just drag the new page symbol onto the stage, because obviously it won’t be able to go to the actual blank keyframe on the frame above. Make sense?

Leave a Reply

PixelWit.com's Comment Guidelines


Warning: Undefined variable $user_ID in /home2/pixelwit/public_html/blog/wp-content/themes/fvariant2/comments.php on line 57

You must be logged in to post a comment.

© Sean O'Shell 2007-2024