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. Pixelwit says:

    @EJ and Paul, I’ve updated the tutorial to address your concerns.

    Please let me know if you encounter any problems caused by the changes.

  2. E.J. says:

    Hello. I first want to say thanks to the creator of this great Fla code. And second, I’ve been reading through some of these comments and I am curious to find out what the “Linkage Identifier” does. I’ve taken this process very slow and I think that I’ve done everything correct (but I guess I’m not) and when I test the movie, I get the error message after 6 flips when i set it for 16.

    I’m not sure if the Linkage Identifier has anything to do with this error.

  3. Paul says:

    Hey!
    It looks awesome..and fist..sorry my bad english but im from finland and i am 15yers 😀 so my problem is that i really cant find “Max Pages” anywhere from the pages layer..like does it read somewhere there..or do i need to move that action frame to 29?

    would be awesome if u could do like video about adding pages, or can someone explain it to me like really clearly? Sorry 😀 but thanks anyway 😀

  4. Ann says:

    Zahra,

    So sorry I really meant the movie size. When I open it it is really small. I have to stretch it out to see the whole book. I want the movie to be the same size as my book. How can I make that happen

  5. Zahra says:

    Hi Ann,

    This tutorial indeed is very good, and i have wanted similar results with my project too.

    In order to change the size of the pages you would have to go into the action script (ie the coding of the project)

    We would have to refer to the same set of coding that is mentioned above when we changed the max variable pages!
    Instead of going on line 29, you can change the size of the page WIDTH and HEIGHT on lines 16 and 17.
    However they are in pixels not inches.

    Hope this helps you with ur project 🙂

  6. Ann says:

    First off let me say thank you for creating this. It’s great. And as soon as I can figure it all out will be perfect.

    So I want to resize the document to be 8.5″ x 11″. How can I accomplish this? I changed it in the size but only my last doc was that size. Your pages were not. FYI: I’m pretty much a beginner with Flash.

  7. Pixelwit says:

    @Casidi, Two is two too few to use. Four or more will do the chore.

  8. Casidi says:

    And yes, I still get the curl and the error with it set to 2.

    Thanks in advance =)

  9. Casidi says:

    I have max pages set to 2. Is that too few? I only need 1 page turn.

  10. Pixelwit says:

    @Zahra, your “Linkage Identifier” is probably not set up right.

    @Henry, either “Linkage Identifier” troubles or you aren’t placing the new pages on stage before the PageFlip needs them.

    @Casidi, “MaxPages” must be an even number. Simply decreasing the MaxPages variable (i.e. changing it from 8 to 6) will not cause an error.

  11. Casidi says:

    Thank you for such an awesome fla!! You and I are so alike. I read how you got into coding Flash and I had a similar experience when I started programming. I so understand that moment of epiphany.

    Anyway, I was working with your code and am stuck a little. Instead of adding pages I want to remove pages. So I tried the the reverse of your adding pages, but I still get a page curl after what is supposed to be the last page. Then I get the error if you try to use the page turn. =/ Any suggestions?

    Thanks in advance!

  12. henry says:

    help its works perfectly but i can only see 8 pages no more, i have changed the doing to 20 pages but it doesn’t help what am i doing wrong???

  13. Jake says:

    We are using a template and adobe flash CS3 ver#9.
    The template is very similiar to what you describe for a flip book – bit we dont seem to have a ‘code section’ where we can modify how many pages we want to have.
    we wish to add more pages AND create links from objects/?tweens? to other in-movie pages.
    We’ve gathered that each page needs an swf, elements, objects, tweens…but, are not quite getting the idea of how/where to add new pages

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