[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

flash pageFlip

Posted on 2004-11-05
16
Medium Priority
?
487 Views
Last Modified: 2008-01-09
HI,

I'm working on a project which is based on the famous pageflip as seen here: http://www.pixelwit.com/flip/PageFlip.html
I maneged to change everything as i needed due my project but i have some problems with the flowing:
I actually want to let the pages turn by themselfs when you click the corners so the visitor don't have to drag and turn the pages.
I really would appreciate ur help.
thx alot

Gipsy
0
Comment
Question by:GipsyKing
  • 6
  • 6
  • 3
  • +1
16 Comments
 
LVL 16

Expert Comment

by:vickerleung
ID: 12505373
Gipsy

Download my sample here,
This is my previous work~

sorry that my art work is not that great
But I hope it suits your need

If you have any queries, feel free to ask~~!!

www.geocities.com/vickerleung/page_flip.zip

Vicker :)
0
 
LVL 1

Author Comment

by:GipsyKing
ID: 12505895
HI Vicker,

thx alot for replying en sending ur sample...
but i've already worked on this version: http://www.actionscripts.org/movies/Sean_OShell-Page_Flip-447/Sean_OShell-Page_Flip-447.zip
any idea how i can get my desire effect with this1?
thx alot

Gipsy
0
 
LVL 16

Expert Comment

by:vickerleung
ID: 12506387
Gipsy,

ok~~

Cause I am in a hurry
So I have not detaily run through the whole script

However I have got the code right already
Open your file,
Open the library (Ctrl-L)

Inside the book folder, double click the bound pages,
in the frame 1, replace the scripts with the following

//
//  P i X E L W i T . C O M
//
stop();
//
//
//
//
//
//________________________C O M M E N T S
//
// Thought to self:
// Try naming functions according to the events which preclude them
//
//
// A page flip involves 3 pieces of paper
// 2 bottom static pages (which lay flat at all times)
// and 1 active flipping page (which has 2 sides)
// Four pages total, 2 static/stationary and 2 flipping
// The flipping page can be on the left or right side
// The top image on the flipping page doesn't actually move
//
//
//
//
//
//_________________________V A R I A B L E S
//
// Store a constant reference to this clip on the main timeline so
// clip can be referenced from any other timeline as _level0.pagesAbs
_level0.pagesAbs = this;
// Set page dimensions
var pageWi = 200;
var PageHi = 300;
var pageWiHi = pageWi+pageHi;
var pivotY = pageHi/2+pageWi;
var pageColor = 0xFFFFE5;
// "dir" equals either 1 or -1 and determines if you
// are flipping forward or backward through the book
var dir = 1;
// "flipPage" is the # "between" the two flipping page #'s
var flipPage = 1.5;
// "curPage" is the # between the two currently viewed page #'s
var curPage = .5;
// "maxPages" should be an even number
var maxPages = 8;
// "autoStep" percentage of page width determining step size when auto-closing
var autoStep = .05;
// "dragging" is true if you are dragging the page
var dragging = false
//
//
//
//
//
//________________________________R U N   O N C E
//
// Place Left and Right page flip Buttons
this.attachMovie ("cornerButton", "RButton", 11);
with (RButton) {
      _x = pageWi;
      _y = -pageWi;
}
this.attachMovie ("cornerButton", "LButton", 12);
with (LButton) {
      _x = -pageWi;
      _y = -pageWi;
      _xscale = -100;
}
//
//
// Build pages for first time
pageInit (flipPage, dir);
// Drop down to appear centered
_y+=pivotY;
//
//
//
//
//
// _____________________B U I L D   F U N C T I O N S
//
// Create a left-aligned page-sized solid fill raised one pagewidth
function makePage (targ, xQuadrant) {
      with (targ) {
            beginFill(pageColor, 100);
            moveto(0, -pageWi);
            lineto(0, -pageWiHi);
            lineTo(xQuadrant*pageWi, -pageWiHi);
            lineTo(xQuadrant*pageWi, -pageWi);
            endFill();
      }
}
//
//
// Create a left-aligned page-sized shadow gradient raised one pagewidth
// Shade is used to add depth to stationary pages
function makeShade (targ, xQuadrant) {
      with (targ) {
            // Defines gradient used as shadow overlay
            var colors = [0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000];
            var alphas = [      40,       25,       15,        5,        0,        1,        6];
            var ratios = [       0,        1,       17,       51,       89,      132,      255];
            var matrix = { matrixType:"box", x:0, y:pageWi, w:xQuadrant*pageWi, h:pageHi, r:0};
            beginGradientFill( "linear", colors, alphas, ratios, matrix );
            moveto(0, -pageWi);
            lineto(0, -pageWiHi);
            lineTo(xQuadrant*pageWi, -pageWiHi);
            lineTo(xQuadrant*pageWi, -pageWi);
            endFill();
      }
}
//
//
// create a bottom-left aligned shadow gradient
// for animated shadows
function makeShadow (targ, xQuadrant) {
      with (targ) {
            // Defines gradient used as shadow overlay
            var colors = [0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000];
            var alphas = [      40,       25,       15,        5,        0,        1,        6];
            var ratios = [       0,        1,       17,       51,       89,      132,      255];
            var maxLength = Math.sqrt((pageWi*pageWi)+(pageWIHi*pageWiHi));
            var matrix = { matrixType:"box", x:0, y:-maxLength, w:xQuadrant*pageWi, h:maxLength-pageWi, r:0};
            beginGradientFill( "linear", colors, alphas, ratios, matrix );
            moveto(0, -pageWi);
            lineto(0, -maxLength);
            lineto(xQuadrant*pageWi, -maxLength);
            lineTo(xQuadrant*pageWi, -pageWi);
            endFill();
      }
}
//
//
// Place Stationary Pages
function setStationary() {
// Place the "S"tationary "L"eft "P"age
createEmptyMovieClip("SLPage", 1);
      if (flipPage!=1.5) {
            makePage (SLPage, -1)
            SLPage.attachMovie("print"+(flipPage-1.5), "Print", 1);
            with (SLPage.Print) {
                  _x = -pageWi/2;
                  _y = -pivotY;
            }
      }
      // Place the "S"tationary "R"ight "P"age
createEmptyMovieClip("SRPage", 2);
      if (flipPage!=maxPages-.5){
            makePage (SRPage, 1)
            SRPage.attachMovie("print"+(flipPage+1.5), "Print", 1);
            with (SRPage.Print) {
                  _x = pageWi/2;
                  _y = -pivotY;
            }
      }
      // Place shade on page not being revealed
      var targ = dir>0 ? SLPage : SRPage;
      targ.createEmptyMovieClip("Shade", 2);
      makeShade(targ.Shade, -dir);
}
//
//
// Place the Flipping Pages
function setFlipping() {
      var targ;
      // Place the "F"lipping "T"op "P"age
      createEmptyMovieClip("FTPage", 3);
      makePage (FTPage, dir)
      with (FTPage) {
            attachMovie("print"+(flipPage-dir*.5), "Print", 1);
            with (Print) {
                  _x = dir*pageWi/2;
                  _y = -pivotY;
            }
      }
      FTPage.createEmptyMovieClip("Shade", 2);
      makeShade(FTPage.Shade, dir);
      // Place the "F"lipping "B"ottom "P"age
      createEmptyMovieClip("FBPage", 4);
      makePage (FBPage, -dir)
      FBPage.attachMovie("print"+(flipPage+dir*.5), "Print", 1);
      with (FBPage.Print) {
            _x = -dir*pageWi/2;
            _y = -pivotY;
      }
      FBPage._rotation = dir*90;
}
//
//
// Creates Shadows which follow edge of transition
function setShadows() {
      var targ;
      // Place shadow on the "F"lipping page
      this.createEmptyMovieClip("FShadow", 5);
      makeShadow(FShadow, -dir);
      FShadow._rotation = dir*45;
      // Place shadow on the "S"tationary page
      this.createEmptyMovieClip("SShadow", 6);
      makeShadow(SShadow, dir);
      SShadow._rotation = dir*45;
}
//
//
// Create Masks to hide everything
function makeMasks() {
      // Create mask for Flipping Bottom Page Mask
      this.createEmptyMovieClip("FBPageMask", 7);
      with (FBPageMask) {
            beginFill(0x005500, 100);
            lineto(pageWiHi, -PageWiHi);
            curveto(0, -2*PageWiHi, -pageWiHi, -pageWiHi);
            endFill();
      }
      // Create mask for Flipping Top Page
      FBPageMask.duplicateMovieClip("FTPageMask", 8);
      // Create mask for Shadow on the Flipping Page
      this.createEmptyMovieClip("FShadowMask", 9);
      makePage (FShadowMask, -dir);
      FShadowMask._rotation = dir*90;
      // Create mask for Shadow on Stationary Page
      this.createEmptyMovieClip("SShadowMask", 10);
      makePage(SShadowMask, dir);
      FBPage.setMask(FBPageMask);
      FTPage.setMask(FTPageMask);
      FShadow.setMask(FShadowMask);
      SShadow.setMask(SShadowMask);
}
//
//
// Hide pages before page1 and after Last Page
function limitBook () {
      if (flipPage==1.5) {
            SLPage._visible = 0;
            LButton._visible = 0;
            SShadow._visible = 0;
            if (dir==1) {
                  FTPage.Shade._alpha = 67;
                  SShadow._visible = 1;
            }else {
                  FShadow._alpha = 67;
            }                  
      } else if (flipPage==maxPages-.5) {
            SRPage._visible = 0;
            RButton._visible = 0;
            SShadow._visible = 0;
            if (dir==-1) {
                  FTPage.Shade._alpha = 67;
                  SShadow._visible = 1;
            } else {
                  FShadow._alpha = 67;
            }
      }            
}
//
//
// How to position all pages needed for a page flip
// calls all functions listed above
function pageInit (cp, d) {
      flipPage = cp;
      dir = d;
      //trace ("flip page = "+flipPage+" dir = "+dir);
      setStationary();
      setFlipping();
      setShadows();
      makeMasks();
      limitBook ();
}
//
//
//
//
//
//__________________F L I P P I N G   F U N C T I O N S
//
// How to adjust position of flipping page
// based on a value between 0 and 1
function flip(curVal) {
      var rot = dir*45*curVal;
      FBPageMask._rotation = FTPageMask._rotation = -rot;
      FBPage._rotation = FShadowMask._rotation = (dir*90)-rot*2;
      FShadow._rotation = SShadow._rotation=(dir*45)-rot;
}
//
//
// how to determine position of flipping page
// returns a value between 0 and 1
// zero being no-flip and one being full-flip
function getPageRatio () {
      if (dragging) {
            // if dragging page position is determined by mouse position
            // the 20 helps advance the turning page when the button is pressed
            pageRatio = -dir*(_xmouse-startX-dir*20)/(2*pageWi);
      } else {
            // if not dragging; auto increment page towards final position
            pageRatio>2/3 ? pageRatio += autoStep : pageRatio -= autoStep;
      }
      // if out of bounds
      if (pageRatio<=0) {
            pageRatio = 0;
            if (!dragging) {
                  flipDone();
            }
      } else if (pageRatio>=1) {
            pageRatio = 1;
            if (!dragging) {
                  flipDone();
            }
      }
      return (pageRatio);
}
//
//
//
//
//
//_____________C O N T R O L I N G   F U N C T I O N S
//
// What to do when you press a page flipping button
function startFlip (dir) {
      pageInit (curPage+dir, dir);
      startX = dir*pageWi;
      dragging = true;
      RButton._alpha=0;
      Lbutton._alpha=0;
      temp_ratio = 0;
      this.onEnterFrame = function () {
            temp_ratio = temp_ratio + 0.1;
            if (temp_ratio > 0.9)
            {
                  curPage+=2 * dir;
            flipDone ();
                  }
//            flip(getPageRatio());
flip (temp_ratio);
      }
}
//
//
// what to do when page is released
function flipRelease () {
      dragging = false;
      if (pageRatio>2/3) {
            curPage+=2*dir;
      }
}
//
//
// What to do when pages are done flipping
function flipDone () {
      trace (curPage);
      this.onEnterFrame = null;
      RButton._alpha = 100;
      LButton._alpha = 100;
      if (curPage!=.5){
            LButton._visible = 1;            
      }
      if (curPage!=maxPages+.5){
            RButton._visible = 1;
      }
      // Delete hidden pages to save resources
      if (pageRatio==0) {
            FShadow.removeMovieClip();
            FShadowMask.removeMovieClip();
            SShadow.removeMovieClip();
            SShadowMask.removeMovieClip();
            FBPage.removeMovieClip();
            FBPageMask.removeMovieClip();
            if (dir==1) {
                  SRPage.removeMovieClip();
            } else {
                  SLPage.removeMovieClip();
            }                  
      } else {
            FTPage.removeMovieClip();
            if (dir==-1) {
                  SRPage.removeMovieClip();
            } else {
                  SLPage.removeMovieClip();
            }
      }
      FTPageMask.removeMovieClip();
}
//
//
// assign functions to button events
LButton.onPress = function() {
      startFlip (-1);
}

RButton.onPress = function() {
      startFlip (1);
}

//
//
//
//
//

That's it ^^
Vicker
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 16

Expert Comment

by:vickerleung
ID: 12506411
O~~ please remove this line

trace (curPage);

I use that for my debug purpose :p
Although it won't affect the run of the script

Vicker
0
 
LVL 1

Author Comment

by:GipsyKing
ID: 12506537
HI Vicker,

thx alot  u made my day :)
u got urself 250 points
can i have the 2 effects at the same time like here: www.work-it-out.be/boek
U can anwser me when u have the time...

thx for ur quick respons,

Gipsy
0
 
LVL 16

Expert Comment

by:vickerleung
ID: 12506653
Gipsy,

2 effects at the same time..

don't quite understand your meaning...

(p.s. just to remind that to click accept answer ^^)

Vicker
0
 
LVL 1

Author Comment

by:GipsyKing
ID: 12506731
Hi,

as u can see on www.work-it-out.be/boek , the visitor still can also drag pages...
1st effect: clicking and dragging pages ( like it was before)
2nd effect: just clicking ( like u have change it)
i hope u get my point :)

thx,

Gipsy
0
 
LVL 16

Accepted Solution

by:
vickerleung earned 1000 total points
ID: 12507229
OK Gipsy

The code is as follows:

//
//  P i X E L W i T . C O M
//
stop();
//
//
//
//
//
//________________________C O M M E N T S
//
// Thought to self:
// Try naming functions according to the events which preclude them
//
//
// A page flip involves 3 pieces of paper
// 2 bottom static pages (which lay flat at all times)
// and 1 active flipping page (which has 2 sides)
// Four pages total, 2 static/stationary and 2 flipping
// The flipping page can be on the left or right side
// The top image on the flipping page doesn't actually move
//
//
//
//
//
//_________________________V A R I A B L E S
//
// Store a constant reference to this clip on the main timeline so
// clip can be referenced from any other timeline as _level0.pagesAbs
_level0.pagesAbs = this;
// Set page dimensions
var pageWi = 200;
var PageHi = 300;
var pageWiHi = pageWi+pageHi;
var pivotY = pageHi/2+pageWi;
var pageColor = 0xFFFFE5;
// "dir" equals either 1 or -1 and determines if you
// are flipping forward or backward through the book
var dir = 1;
// "flipPage" is the # "between" the two flipping page #'s
var flipPage = 1.5;
// "curPage" is the # between the two currently viewed page #'s
var curPage = .5;
// "maxPages" should be an even number
var maxPages = 8;
// "autoStep" percentage of page width determining step size when auto-closing
var autoStep = .05;
// "dragging" is true if you are dragging the page
var dragging = false
//
//
//
//
//
//________________________________R U N   O N C E
//
// Place Left and Right page flip Buttons
this.attachMovie ("cornerButton", "RButton", 11);
with (RButton) {
      _x = pageWi;
      _y = -pageWi;
}
this.attachMovie ("cornerButton", "LButton", 12);
with (LButton) {
      _x = -pageWi;
      _y = -pageWi;
      _xscale = -100;
}
//
//
// Build pages for first time
pageInit (flipPage, dir);
// Drop down to appear centered
_y+=pivotY;
//
//
//
//
//
// _____________________B U I L D   F U N C T I O N S
//
// Create a left-aligned page-sized solid fill raised one pagewidth
function makePage (targ, xQuadrant) {
      with (targ) {
            beginFill(pageColor, 100);
            moveto(0, -pageWi);
            lineto(0, -pageWiHi);
            lineTo(xQuadrant*pageWi, -pageWiHi);
            lineTo(xQuadrant*pageWi, -pageWi);
            endFill();
      }
}
//
//
// Create a left-aligned page-sized shadow gradient raised one pagewidth
// Shade is used to add depth to stationary pages
function makeShade (targ, xQuadrant) {
      with (targ) {
            // Defines gradient used as shadow overlay
            var colors = [0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000];
            var alphas = [      40,       25,       15,        5,        0,        1,        6];
            var ratios = [       0,        1,       17,       51,       89,      132,      255];
            var matrix = { matrixType:"box", x:0, y:pageWi, w:xQuadrant*pageWi, h:pageHi, r:0};
            beginGradientFill( "linear", colors, alphas, ratios, matrix );
            moveto(0, -pageWi);
            lineto(0, -pageWiHi);
            lineTo(xQuadrant*pageWi, -pageWiHi);
            lineTo(xQuadrant*pageWi, -pageWi);
            endFill();
      }
}
//
//
// create a bottom-left aligned shadow gradient
// for animated shadows
function makeShadow (targ, xQuadrant) {
      with (targ) {
            // Defines gradient used as shadow overlay
            var colors = [0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000];
            var alphas = [      40,       25,       15,        5,        0,        1,        6];
            var ratios = [       0,        1,       17,       51,       89,      132,      255];
            var maxLength = Math.sqrt((pageWi*pageWi)+(pageWIHi*pageWiHi));
            var matrix = { matrixType:"box", x:0, y:-maxLength, w:xQuadrant*pageWi, h:maxLength-pageWi, r:0};
            beginGradientFill( "linear", colors, alphas, ratios, matrix );
            moveto(0, -pageWi);
            lineto(0, -maxLength);
            lineto(xQuadrant*pageWi, -maxLength);
            lineTo(xQuadrant*pageWi, -pageWi);
            endFill();
      }
}
//
//
// Place Stationary Pages
function setStationary() {
// Place the "S"tationary "L"eft "P"age
createEmptyMovieClip("SLPage", 1);
      if (flipPage!=1.5) {
            makePage (SLPage, -1)
            SLPage.attachMovie("print"+(flipPage-1.5), "Print", 1);
            with (SLPage.Print) {
                  _x = -pageWi/2;
                  _y = -pivotY;
            }
      }
      // Place the "S"tationary "R"ight "P"age
createEmptyMovieClip("SRPage", 2);
      if (flipPage!=maxPages-.5){
            makePage (SRPage, 1)
            SRPage.attachMovie("print"+(flipPage+1.5), "Print", 1);
            with (SRPage.Print) {
                  _x = pageWi/2;
                  _y = -pivotY;
            }
      }
      // Place shade on page not being revealed
      var targ = dir>0 ? SLPage : SRPage;
      targ.createEmptyMovieClip("Shade", 2);
      makeShade(targ.Shade, -dir);
}
//
//
// Place the Flipping Pages
function setFlipping() {
      var targ;
      // Place the "F"lipping "T"op "P"age
      createEmptyMovieClip("FTPage", 3);
      makePage (FTPage, dir)
      with (FTPage) {
            attachMovie("print"+(flipPage-dir*.5), "Print", 1);
            with (Print) {
                  _x = dir*pageWi/2;
                  _y = -pivotY;
            }
      }
      FTPage.createEmptyMovieClip("Shade", 2);
      makeShade(FTPage.Shade, dir);
      // Place the "F"lipping "B"ottom "P"age
      createEmptyMovieClip("FBPage", 4);
      makePage (FBPage, -dir)
      FBPage.attachMovie("print"+(flipPage+dir*.5), "Print", 1);
      with (FBPage.Print) {
            _x = -dir*pageWi/2;
            _y = -pivotY;
      }
      FBPage._rotation = dir*90;
}
//
//
// Creates Shadows which follow edge of transition
function setShadows() {
      var targ;
      // Place shadow on the "F"lipping page
      this.createEmptyMovieClip("FShadow", 5);
      makeShadow(FShadow, -dir);
      FShadow._rotation = dir*45;
      // Place shadow on the "S"tationary page
      this.createEmptyMovieClip("SShadow", 6);
      makeShadow(SShadow, dir);
      SShadow._rotation = dir*45;
}
//
//
// Create Masks to hide everything
function makeMasks() {
      // Create mask for Flipping Bottom Page Mask
      this.createEmptyMovieClip("FBPageMask", 7);
      with (FBPageMask) {
            beginFill(0x005500, 100);
            lineto(pageWiHi, -PageWiHi);
            curveto(0, -2*PageWiHi, -pageWiHi, -pageWiHi);
            endFill();
      }
      // Create mask for Flipping Top Page
      FBPageMask.duplicateMovieClip("FTPageMask", 8);
      // Create mask for Shadow on the Flipping Page
      this.createEmptyMovieClip("FShadowMask", 9);
      makePage (FShadowMask, -dir);
      FShadowMask._rotation = dir*90;
      // Create mask for Shadow on Stationary Page
      this.createEmptyMovieClip("SShadowMask", 10);
      makePage(SShadowMask, dir);
      FBPage.setMask(FBPageMask);
      FTPage.setMask(FTPageMask);
      FShadow.setMask(FShadowMask);
      SShadow.setMask(SShadowMask);
}
//
//
// Hide pages before page1 and after Last Page
function limitBook () {
      if (flipPage==1.5) {
            SLPage._visible = 0;
            LButton._visible = 0;
            SShadow._visible = 0;
            if (dir==1) {
                  FTPage.Shade._alpha = 67;
                  SShadow._visible = 1;
            }else {
                  FShadow._alpha = 67;
            }                  
      } else if (flipPage==maxPages-.5) {
            SRPage._visible = 0;
            RButton._visible = 0;
            SShadow._visible = 0;
            if (dir==-1) {
                  FTPage.Shade._alpha = 67;
                  SShadow._visible = 1;
            } else {
                  FShadow._alpha = 67;
            }
      }            
}
//
//
// How to position all pages needed for a page flip
// calls all functions listed above
function pageInit (cp, d) {
      flipPage = cp;
      dir = d;
      //trace ("flip page = "+flipPage+" dir = "+dir);
      setStationary();
      setFlipping();
      setShadows();
      makeMasks();
      limitBook ();
}
//
//
//
//
//
//__________________F L I P P I N G   F U N C T I O N S
//
// How to adjust position of flipping page
// based on a value between 0 and 1
function flip(curVal) {
      var rot = dir*45*curVal;
      FBPageMask._rotation = FTPageMask._rotation = -rot;
      FBPage._rotation = FShadowMask._rotation = (dir*90)-rot*2;
      FShadow._rotation = SShadow._rotation=(dir*45)-rot;
}
//
//
// how to determine position of flipping page
// returns a value between 0 and 1
// zero being no-flip and one being full-flip
function getPageRatio () {
      if (dragging) {
            // if dragging page position is determined by mouse position
            // the 20 helps advance the turning page when the button is pressed
            pageRatio = -dir*(_xmouse-startX-dir*20)/(2*pageWi);
      } else {
            // if not dragging; auto increment page towards final position
            pageRatio>2/3 ? pageRatio += autoStep : pageRatio -= autoStep;
      }
      // if out of bounds
      if (pageRatio<=0) {
            pageRatio = 0;
            if (!dragging) {
                  flipDone();
            }
      } else if (pageRatio>=1) {
            pageRatio = 1;
            if (!dragging) {
                  flipDone();
            }
      }
      return (pageRatio);
}
//
//
//
//
//
//_____________C O N T R O L I N G   F U N C T I O N S
//
// What to do when you press a page flipping button
function startFlip (dir) {
      pageInit (curPage+dir, dir);
      startX = dir*pageWi;
      dragging = true;
      RButton._alpha=0;
      Lbutton._alpha=0;
      this.onEnterFrame = function () {
            flip(getPageRatio());
      }
}
//
//
// what to do when page is released
function flipRelease () {
      dragging = false;
      
      this.onEnterFrame = function () {
      if (pageRatio<1) {
            pageRatio = pageRatio + 0.1;
            if (pageRatio > 1) pageRatio = 1;
            flip (pageRatio);
      }
      else
      {
      curPage+=2*dir;
      flipDone ();
      }
      }
      }
//
//
// What to do when pages are done flipping
function flipDone () {
      this.onEnterFrame = null;
      RButton._alpha = 100;
      LButton._alpha = 100;
      if (curPage!=.5){
            LButton._visible = 1;            
      }
      if (curPage!=maxPages+.5){
            RButton._visible = 1;
      }
      // Delete hidden pages to save resources
      if (pageRatio==0) {
            FShadow.removeMovieClip();
            FShadowMask.removeMovieClip();
            SShadow.removeMovieClip();
            SShadowMask.removeMovieClip();
            FBPage.removeMovieClip();
            FBPageMask.removeMovieClip();
            if (dir==1) {
                  SRPage.removeMovieClip();
            } else {
                  SLPage.removeMovieClip();
            }                  
      } else {
            FTPage.removeMovieClip();
            if (dir==-1) {
                  SRPage.removeMovieClip();
            } else {
                  SLPage.removeMovieClip();
            }
      }
      FTPageMask.removeMovieClip();
}
//
//
// assign functions to button events
LButton.onPress = function() {
      startFlip (-1);
}
LButton.onReleaseOutside = function () {
      flipRelease();
}
LButton.onRelease = function () {
      flipRelease();
}
RButton.onPress = function() {
      startFlip (1);
}
RButton.onReleaseOutside = function () {
      flipRelease();
}
RButton.onRelease = function () {
      flipRelease();
}
//
//
//
//
//

Haha~~ I better charge you more points :p

Vicker
0
 
LVL 1

Author Comment

by:GipsyKing
ID: 12508038
HI Vicker,

yesss, that's it :)
thx alot
You really earn ur 250 points...

greetz,

Gipsy
0
 
LVL 16

Expert Comment

by:vickerleung
ID: 12510512
Gipsy,

I really wanna say,
is LUCK....

I try fooling around with the code and fortunately it works XD

Vicker
0
 

Expert Comment

by:freebd99
ID: 12587352
Hi,
I'm new here and I've just started getting into flash. I recently got the page-flip file and made some changes for a project that I'm working on but whenever I try to change the width and height weird things happen. I have some graphic files of a magazine that I'm putting together but they weren't legeable when added to the original page flip.

Has anyone had any luck customizing page-flip to work with larger images. I really appreciate any feedback offered.

Many thanks. :)
0
 
LVL 1

Author Comment

by:GipsyKing
ID: 12592393
Hi there,

Open the flash file then press ctrl+L to get the liberary in flash, u'll see a movieclip called "bound pages", the hole code is in that movieclip...
at the beginning there are some variables like width and height like u mention...but the important thing here is position of that movieclip (bound pages) on the stage...if u have the same pageflip at least (see above to download it)...
try to move that empty movieclip (bound pages) on the stage, u'll get the point...

greetz,

Gipsy
0
 

Expert Comment

by:freebd99
ID: 12595276
Hi Gipsy,
Thanks for taking the time to respond. I went to the "bound pages" clip and the only thing that appears is the cross + in the middle of the area. I select the cross and move it around, test the file and it's still not displaying the whole booklet with the corner edge for flipping.

The new dimensions are:
pageWi = 450
pageHi = 582

Those are the only variables in the code that I've changed.

I'm not sure how to move the clip....

:(

Thanks for your help.
0
 
LVL 1

Author Comment

by:GipsyKing
ID: 12597138
HI there,


By changing the position of the bound pages, i didn't mean the cross itself only, u don't have to move the cross inside it, change the position of the hole movieclip without going into it and changing the cross only...
Just open the file, and select the layer "pages" on 8th frame then move it abit to left or right, dont open the movieclip...just move it...

greetz,

Gipsy
0
 

Expert Comment

by:freebd99
ID: 12597434
Thanks Gypsy for the reply. I'm now able to move things around a bit and increase the size but that opened up another can of worms so I'll have to figure out a better way to do it.

Many thanks,
:-)
0
 
LVL 2

Expert Comment

by:enetadmin
ID: 14610495
Hi Guys,
I already posted another question related to this. But looking at this post, it seems to be much easier using the Pageflip Component :) But I am a beginner. Can you please provide me instructions on how to convert a existing PDF document to a flippable book in Flash using the Pageflip Component? I already have the FlashPaper and Macromedia Flash.

-eNetadmin
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
Suggested Courses
Course of the Month19 days, 20 hours left to enroll

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question