cia a tutti..sto lavorando ad una galleria fotografica che simula un vero album, c'è un'angolo della pagina che si trascina e sfoglia la pagina successiva..qualcuno avrà già visto in rete cose del genere..ora..fin quando mi sono limitato semplicemente a richiamare le istanze delle immagini e sostituirle nessun problema...ma visto che il mio book ha 36 immagini e quello che sto rieditando ne ha solo 32 come faccio ad inserire le altre 4immagini?
nello script (che ora vi copio ed incollo) quasi alla fine c'è una stringa che dice max32 pag.
io ho scritto 36...le 4 pagine vengono aggiunte e lo script risulta cmq corretto, solo che nella prova dell'swf le 4 pagine finali vengono in bianco e appena le tocco mi da questo errore:Error: A 'with' action failed because the specified object did not exist.
lo script per intero è il seguente...
function makePage(targ, xQuadrant)
{
with (targ)
{
beginFill(pageColor, 100);
moveto(0, -pageWi);
lineto(0, -pageWiHi);
lineTo(xQuadrant * pageWi, -pageWiHi);
lineTo(xQuadrant * pageWi, -pageWi);
endFill();
} // End of with
} // End of the function
function makeShade(targ, xQuadrant)
{
with (targ)
{
var colors = [0, 0, 0, 0, 0, 0, 0];
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();
} // End of with
} // End of the function
function makeShadow(targ, xQuadrant)
{
with (targ)
{
var colors = [0, 0, 0, 0, 0, 0, 0];
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();
} // End of with
} // End of the function
function setStationary()
{
createEmptyMovieClip("SLPage", 1);
if (flipPage != 1.500000)
{
makePage(SLPage, -1);
SLPage.attachMovie("print" + (flipPage - 1.500000), "Print", 1);
with (SLPage.Print)
{
_x = -pageWi / 2;
_y = -pivotY;
} // End of with
} // end if
createEmptyMovieClip("SRPage", 2);
if (flipPage != maxPages - 0.500000)
{
makePage(SRPage, 1);
SRPage.attachMovie("print" + (flipPage + 1.500000), "Print", 1);
with (SRPage.Print)
{
_x = pageWi / 2;
_y = -pivotY;
} // End of with
} // end if
var targ = dir > 0 ? (SLPage) : (SRPage);
targ.createEmptyMovieClip("Shade", 2);
makeShade(targ.Shade, -dir);
} // End of the function
function setFlipping()
{
var targ;
createEmptyMovieClip("FTPage", 3);
makePage(FTPage, dir);
with (FTPage)
{
attachMovie("print" + (flipPage - dir * 0.500000), "Print", 1);
with (Print)
{
_x = dir * pageWi / 2;
_y = -pivotY;
} // End of with
} // End of with
FTPage.createEmptyMovieClip("Shade", 2);
makeShade(FTPage.Shade, dir);
createEmptyMovieClip("FBPage", 4);
makePage(FBPage, -dir);
FBPage.attachMovie("print" + (flipPage + dir * 0.500000), "Print", 1);
with (FBPage.Print)
{
_x = -dir * pageWi / 2;
_y = -pivotY;
} // End of with
FBPage._rotation = dir * 90;
} // End of the function
function setShadows()
{
var targ;
this.createEmptyMovieClip("FShadow", 5);
makeShadow(FShadow, -dir);
FShadow._rotation = dir * 45;
this.createEmptyMovieClip("SShadow", 6);
makeShadow(SShadow, dir);
SShadow._rotation = dir * 45;
} // End of the function
function makeMasks()
{
this.createEmptyMovieClip("FBPageMask", 7);
with (FBPageMask)
{
beginFill(21760, 100);
lineto(pageWiHi, -PageWiHi);
curveto(0, -2 * PageWiHi, -pageWiHi, -pageWiHi);
endFill();
} // End of with
FBPageMask.duplicateMovieClip("FTPageMask", 8);
this.createEmptyMovieClip("FShadowMask", 9);
makePage(FShadowMask, -dir);
FShadowMask._rotation = dir * 90;
this.createEmptyMovieClip("SShadowMask", 10);
makePage(SShadowMask, dir);
FBPage.setMask(FBPageMask);
FTPage.setMask(FTPageMask);
FShadow.setMask(FShadowMask);
SShadow.setMask(SShadowMask);
} // End of the function
function limitBook()
{
if (flipPage == 1.500000)
{
SLPage._visible = 0;
LButton._visible = 0;
SShadow._visible = 0;
if (dir == 1)
{
FTPage.Shade._alpha = 67;
SShadow._visible = 1;
}
else
{
FShadow._alpha = 67;
} // end if
}
else if (flipPage == maxPages - 0.500000)
{
SRPage._visible = 0;
RButton._visible = 0;
SShadow._visible = 0;
if (dir == -1)
{
FTPage.Shade._alpha = 67;
SShadow._visible = 1;
}
else
{
FShadow._alpha = 67;
} // end if
} // end if
} // End of the function
function pageInit(cp, d)
{
flipPage = cp;
dir = d;
setStationary();
setFlipping();
setShadows();
makeMasks();
limitBook();
} // End of the function
function flip(curVal)
{
var _l1 = dir * 45 * curVal;
FBPageMask._rotation = FTPageMask._rotation = -_l1;
FBPage._rotation = FShadowMask._rotation = dir * 90 - _l1 * 2;
FShadow._rotation = SShadow._rotation = dir * 45 - _l1;
} // End of the function
function getPageRatio()
{
if (dragging)
{
pageRatio = -dir * (_xmouse - startX - dir * 20) / (2 * pageWi);
}
else
{
pageRatio > 0.666667 ? (pageRatio = pageRatio + autoStep, pageRatio = pageRatio + autoStep) : (pageRatio = pageRatio - autoStep);
} // end if
if (pageRatio <= 0)
{
pageRatio = 0;
if (!dragging)
{
flipDone();
} // end if
}
else if (pageRatio >= 1)
{
pageRatio = 1;
if (!dragging)
{
flipDone();
} // end if
} // end if
return(pageRatio);
} // End of the function
function startFlip(dir)
{
var _l1 = dir;
pageInit(curPage + _l1, _l1);
startX = _l1 * pageWi;
dragging = true;
RButton._alpha = 0;
Lbutton._alpha = 0;
this.onEnterFrame = function ()
{
flip(getPageRatio());
};
} // End of the function
function flipRelease()
{
dragging = false;
if (pageRatio > 0.666667)
{
curPage = curPage + 2 * dir;
} // end if
} // End of the function
function flipDone()
{
this.onEnterFrame = null;
RButton._alpha = 100;
LButton._alpha = 100;
if (curPage != 0.500000)
{
LButton._visible = 1;
} // end if
if (curPage != maxPages + 0.500000)
{
RButton._visible = 1;
} // end if
if (pageRatio == 0)
{
FShadow.removeMovieClip();
FShadowMask.removeMovieClip();
SShadow.removeMovieClip();
SShadowMask.removeMovieClip();
FBPage.removeMovieClip();
FBPageMask.removeMovieClip();
if (dir == 1)
{
SRPage.removeMovieClip();
}
else
{
SLPage.removeMovieClip();
} // end if
}
else
{
FTPage.removeMovieClip();
if (dir == -1)
{
SRPage.removeMovieClip();
}
else
{
SLPage.removeMovieClip();
} // end if
} // end if
FTPageMask.removeMovieClip();
} // End of the function
stop();
_level0.pagesAbs = this;
var pageWi = 290;
var PageHi = 425;
var pageWiHi = pageWi + pageHi;
var pivotY = pageHi / 2 + pageWi;
var pageColor = 16777189;
var dir = 1;
var flipPage = 1.500000;
var curPage = 0.500000;
var maxPages = 32;
var autoStep = 0.050000;
var dragging = false;
this.attachMovie("cornerButton", "RButton", 11);
with (RButton)
{
_x = pageWi;
_y = -pageWi;
} // End of with
this.attachMovie("cornerButton", "LButton", 12);
with (LButton)
{
_x = -pageWi;
_y = -pageWi;
_xscale = -100;
} // End of with
pageInit(flipPage, dir);
_y = _y + pivotY;
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();
};
ovviamente ho aggiunto le 4 immagini in libreria e le ho convertite in simboli grafici e movi
cosa sbaglio? che mmmmmanca? devo modificare lo script o fare qualche operazione particolare...qualcuno sa aiutarmi?
nello script (che ora vi copio ed incollo) quasi alla fine c'è una stringa che dice max32 pag.
io ho scritto 36...le 4 pagine vengono aggiunte e lo script risulta cmq corretto, solo che nella prova dell'swf le 4 pagine finali vengono in bianco e appena le tocco mi da questo errore:Error: A 'with' action failed because the specified object did not exist.
lo script per intero è il seguente...
function makePage(targ, xQuadrant)
{
with (targ)
{
beginFill(pageColor, 100);
moveto(0, -pageWi);
lineto(0, -pageWiHi);
lineTo(xQuadrant * pageWi, -pageWiHi);
lineTo(xQuadrant * pageWi, -pageWi);
endFill();
} // End of with
} // End of the function
function makeShade(targ, xQuadrant)
{
with (targ)
{
var colors = [0, 0, 0, 0, 0, 0, 0];
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();
} // End of with
} // End of the function
function makeShadow(targ, xQuadrant)
{
with (targ)
{
var colors = [0, 0, 0, 0, 0, 0, 0];
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();
} // End of with
} // End of the function
function setStationary()
{
createEmptyMovieClip("SLPage", 1);
if (flipPage != 1.500000)
{
makePage(SLPage, -1);
SLPage.attachMovie("print" + (flipPage - 1.500000), "Print", 1);
with (SLPage.Print)
{
_x = -pageWi / 2;
_y = -pivotY;
} // End of with
} // end if
createEmptyMovieClip("SRPage", 2);
if (flipPage != maxPages - 0.500000)
{
makePage(SRPage, 1);
SRPage.attachMovie("print" + (flipPage + 1.500000), "Print", 1);
with (SRPage.Print)
{
_x = pageWi / 2;
_y = -pivotY;
} // End of with
} // end if
var targ = dir > 0 ? (SLPage) : (SRPage);
targ.createEmptyMovieClip("Shade", 2);
makeShade(targ.Shade, -dir);
} // End of the function
function setFlipping()
{
var targ;
createEmptyMovieClip("FTPage", 3);
makePage(FTPage, dir);
with (FTPage)
{
attachMovie("print" + (flipPage - dir * 0.500000), "Print", 1);
with (Print)
{
_x = dir * pageWi / 2;
_y = -pivotY;
} // End of with
} // End of with
FTPage.createEmptyMovieClip("Shade", 2);
makeShade(FTPage.Shade, dir);
createEmptyMovieClip("FBPage", 4);
makePage(FBPage, -dir);
FBPage.attachMovie("print" + (flipPage + dir * 0.500000), "Print", 1);
with (FBPage.Print)
{
_x = -dir * pageWi / 2;
_y = -pivotY;
} // End of with
FBPage._rotation = dir * 90;
} // End of the function
function setShadows()
{
var targ;
this.createEmptyMovieClip("FShadow", 5);
makeShadow(FShadow, -dir);
FShadow._rotation = dir * 45;
this.createEmptyMovieClip("SShadow", 6);
makeShadow(SShadow, dir);
SShadow._rotation = dir * 45;
} // End of the function
function makeMasks()
{
this.createEmptyMovieClip("FBPageMask", 7);
with (FBPageMask)
{
beginFill(21760, 100);
lineto(pageWiHi, -PageWiHi);
curveto(0, -2 * PageWiHi, -pageWiHi, -pageWiHi);
endFill();
} // End of with
FBPageMask.duplicateMovieClip("FTPageMask", 8);
this.createEmptyMovieClip("FShadowMask", 9);
makePage(FShadowMask, -dir);
FShadowMask._rotation = dir * 90;
this.createEmptyMovieClip("SShadowMask", 10);
makePage(SShadowMask, dir);
FBPage.setMask(FBPageMask);
FTPage.setMask(FTPageMask);
FShadow.setMask(FShadowMask);
SShadow.setMask(SShadowMask);
} // End of the function
function limitBook()
{
if (flipPage == 1.500000)
{
SLPage._visible = 0;
LButton._visible = 0;
SShadow._visible = 0;
if (dir == 1)
{
FTPage.Shade._alpha = 67;
SShadow._visible = 1;
}
else
{
FShadow._alpha = 67;
} // end if
}
else if (flipPage == maxPages - 0.500000)
{
SRPage._visible = 0;
RButton._visible = 0;
SShadow._visible = 0;
if (dir == -1)
{
FTPage.Shade._alpha = 67;
SShadow._visible = 1;
}
else
{
FShadow._alpha = 67;
} // end if
} // end if
} // End of the function
function pageInit(cp, d)
{
flipPage = cp;
dir = d;
setStationary();
setFlipping();
setShadows();
makeMasks();
limitBook();
} // End of the function
function flip(curVal)
{
var _l1 = dir * 45 * curVal;
FBPageMask._rotation = FTPageMask._rotation = -_l1;
FBPage._rotation = FShadowMask._rotation = dir * 90 - _l1 * 2;
FShadow._rotation = SShadow._rotation = dir * 45 - _l1;
} // End of the function
function getPageRatio()
{
if (dragging)
{
pageRatio = -dir * (_xmouse - startX - dir * 20) / (2 * pageWi);
}
else
{
pageRatio > 0.666667 ? (pageRatio = pageRatio + autoStep, pageRatio = pageRatio + autoStep) : (pageRatio = pageRatio - autoStep);
} // end if
if (pageRatio <= 0)
{
pageRatio = 0;
if (!dragging)
{
flipDone();
} // end if
}
else if (pageRatio >= 1)
{
pageRatio = 1;
if (!dragging)
{
flipDone();
} // end if
} // end if
return(pageRatio);
} // End of the function
function startFlip(dir)
{
var _l1 = dir;
pageInit(curPage + _l1, _l1);
startX = _l1 * pageWi;
dragging = true;
RButton._alpha = 0;
Lbutton._alpha = 0;
this.onEnterFrame = function ()
{
flip(getPageRatio());
};
} // End of the function
function flipRelease()
{
dragging = false;
if (pageRatio > 0.666667)
{
curPage = curPage + 2 * dir;
} // end if
} // End of the function
function flipDone()
{
this.onEnterFrame = null;
RButton._alpha = 100;
LButton._alpha = 100;
if (curPage != 0.500000)
{
LButton._visible = 1;
} // end if
if (curPage != maxPages + 0.500000)
{
RButton._visible = 1;
} // end if
if (pageRatio == 0)
{
FShadow.removeMovieClip();
FShadowMask.removeMovieClip();
SShadow.removeMovieClip();
SShadowMask.removeMovieClip();
FBPage.removeMovieClip();
FBPageMask.removeMovieClip();
if (dir == 1)
{
SRPage.removeMovieClip();
}
else
{
SLPage.removeMovieClip();
} // end if
}
else
{
FTPage.removeMovieClip();
if (dir == -1)
{
SRPage.removeMovieClip();
}
else
{
SLPage.removeMovieClip();
} // end if
} // end if
FTPageMask.removeMovieClip();
} // End of the function
stop();
_level0.pagesAbs = this;
var pageWi = 290;
var PageHi = 425;
var pageWiHi = pageWi + pageHi;
var pivotY = pageHi / 2 + pageWi;
var pageColor = 16777189;
var dir = 1;
var flipPage = 1.500000;
var curPage = 0.500000;
var maxPages = 32;
var autoStep = 0.050000;
var dragging = false;
this.attachMovie("cornerButton", "RButton", 11);
with (RButton)
{
_x = pageWi;
_y = -pageWi;
} // End of with
this.attachMovie("cornerButton", "LButton", 12);
with (LButton)
{
_x = -pageWi;
_y = -pageWi;
_xscale = -100;
} // End of with
pageInit(flipPage, dir);
_y = _y + pivotY;
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();
};
ovviamente ho aggiunto le 4 immagini in libreria e le ho convertite in simboli grafici e movi
cosa sbaglio? che mmmmmanca? devo modificare lo script o fare qualche operazione particolare...qualcuno sa aiutarmi?