Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Taci Bianchini

Page Flip

Recommended Posts

Estou com um grande problema!!!!!Estou tentando fazer um daqueles projetos que viram as páginas como uma revista impressa....Estou tentando desesperadamente fazer esse negocio funcionar, mas não consigo de jeito nenhum. Esse é o action script que eu tenho do page flip://// 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 dimensionsvar pageWi = 320;var PageHi = 340;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 bookvar dir = 1;// "flipPage" is the # "between" the two flipping page #'svar flipPage = 1.5;// "curPage" is the # between the two currently viewed page #'svar curPage = .5;// "maxPages" should be an even numbervar maxPages = 8;// "autoStep" percentage of page width determining step size when auto-closingvar autoStep = .05;// "dragging" is true if you are dragging the pagevar dragging = false////////////________________________________R U N O N C E//// Place Left and Right page flip Buttonsthis.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 timepageInit (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 pagewidthfunction 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 pagesfunction makeShade (targ, xQuadrant) {with (targ) {// Defines gradient used as shadow overlayvar 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 shadowsfunction makeShadow (targ, xQuadrant) {with (targ) {// Defines gradient used as shadow overlayvar 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 Pagesfunction setStationary() {// Place the "S"tationary "L"eft "P"agecreateEmptyMovieClip("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"agecreateEmptyMovieClip("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 revealedvar targ = dir>0 ? SLPage : SRPage;targ.createEmptyMovieClip("Shade", 2);makeShade(targ.Shade, -dir);}// // // Place the Flipping Pagesfunction setFlipping() {var targ;// Place the "F"lipping "T"op "P"agecreateEmptyMovieClip("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"agecreateEmptyMovieClip("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 transitionfunction setShadows() {var targ;// Place shadow on the "F"lipping pagethis.createEmptyMovieClip("FShadow", 5);makeShadow(FShadow, -dir);FShadow._rotation = dir*45;// Place shadow on the "S"tationary pagethis.createEmptyMovieClip("SShadow", 6);makeShadow(SShadow, dir);SShadow._rotation = dir*45;}// // // Create Masks to hide everythingfunction makeMasks() {// Create mask for Flipping Bottom Page Maskthis.createEmptyMovieClip("FBPageMask", 7);with (FBPageMask) {beginFill(0x005500, 100);lineto(pageWiHi, -PageWiHi);curveto(0, -2*PageWiHi, -pageWiHi, -pageWiHi);endFill();}// Create mask for Flipping Top PageFBPageMask.duplicateMovieClip("FTPageMask", 8);// Create mask for Shadow on the Flipping Pagethis.createEmptyMovieClip("FShadowMask", 9);makePage (FShadowMask, -dir);FShadowMask._rotation = dir*90;// Create mask for Shadow on Stationary Pagethis.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 Pagefunction 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 abovefunction 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 1function 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-flipfunction getPageRatio () {if (dragging) {// if dragging page position is determined by mouse position// the 20 helps advance the turning page when the button is pressedpageRatio = -dir*(_xmouse-startX-dir*20)/(2*pageWi);} else {// if not dragging; auto increment page towards final positionpageRatio>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 buttonfunction 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 releasedfunction flipRelease () {dragging = false;if (pageRatio>2/3) {curPage+=2*dir;}}////// What to do when pages are done flippingfunction 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 resourcesif (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 eventsLButton.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();}////////// Eu coloquei ele no primeiro frame e nada funcionava, tentei achar erros no script mas não achei. Não sei o que acontece. Eu tenho que criar todos os objetos botões etc para que o script funcione? Se eu cria-los vou ter que alterar ou modificar algo no script?Please, me ajudem!!!!!!!!!!!!!!!

Compartilhar este post


Link para o post
Compartilhar em outros sites

oi garota loira de olhos azuis...

hahahah

 

seguinte taci

 

eu uso um page flip pronto... e free q eu achei na net...

tem ateh opcao de escolher capa dura... entre outras coisas...

 

eh absurdamente facil de usar e configurar... veja se te ajuda

 

PageFlip

 

para inserir paginas basta q você use a funcao addPage(linkage) onde linkage eh o id do mc na library...

 

qlqr duvida estamos por aqui

Compartilhar este post


Link para o post
Compartilhar em outros sites

Boa Noite Taci, seja bem vinda. O titulo do Seu Topico foi editado para se enquadrar as regras do iMASTERS!

 

 

Peço que nao as perca de vista ok?

 

 

 

Bons Estudos

 

e leia as REGRAS

 

 

 

Fique na Paz

Compartilhar este post


Link para o post
Compartilhar em outros sites

Victor esse link que você passou é interssante...Onde eu consigo .fla dele??

Olá a Todos^^Então pessoal, consegui resolver meu problema, depois de apanhar muito!Obrigada pela ajuda!

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.