Hi
new to the forum
hope we grow together in our world
these days i am reading this book:
it is really good for beginners, but still need help from the pro
i am stuck in some part of this code, i do not want to move to the next part until i understand this one, please help me to read it:
THE CODE:
[AS]//stop main timeline from playing on its own through to second scene
stop();
//stop movie clip from playing on its own
pages.stop();
//button event listeners
onePlus.addEventListener(MouseEvent.CLICK, onOnePlusClick, false, 0, true);
output.addEventListener(MouseEvent.CLICK, onOutputClick, false, 0, true);
labelCheck.addEventListener(MouseEvent.CLICK, onLabelCheckClick, false, 0, true);
/*
i did not understand this part, what i know is this talking to a movie clip “pages”, and move the play head to label called "page1), also this part of code is connected to “getFrame” function at the bottom of the code. my question here is: why the name of the movie is there again after the label “page1”.
*/
//jump to a frame relative to the location of a label
function onOnePlusClick(evt:MouseEvent):void {
pages.gotoAndStop(getFrame(“page1”,pages) + 4);
}
//output simple variants of movie, scene, label, and frame information
function onOutputClick(evt:MouseEvent):void {
trace(“The main movie has " + scenes.length + " scenes.”);
trace(“The current scene is '” + currentScene.name + “’.”);
trace(“It has " + currentScene.numFrames + " frame(s),”);
trace(" and " + currentScene.labels.length + " label(s). “);
trace(“The second scene’s first label is '” + scenes[1].labels[0].name + “’,”);
trace(” which is in frame " + scenes[1].labels[0].frame + “.”);
trace(“Movie clip ‘pages’ has " + pages.currentLabels.length + " labels.”);
trace(“Its last label is '” + pages.currentLabels.pop().name + “’.”);
}
// i did not understand this part
//check to see if a frame label exists
function onLabelCheckClick(evt:MouseEvent):void {
trace(isFrameLabel(“page3”, pages));
}
// i did not understand this part
//accept mc and frame label and return frame number in which label resides
function getFrame(frLabel:String, mc:MovieClip):int {
for (var i:int = 0; i<mc.currentLabels.length; i++) {
if (mc.currentLabels*.name == frLabel) {
return mc.currentLabels*.frame;
}
}
return -1;
}
// i did not understand this part
//accept mc and frame label and return true if the label exists, false if not
function isFrameLabel(frLabel:String, mc:Object):Boolean {
for (var i:int = 0; i<mc.currentLabels.length; i++) {
if (mc.currentLabels*.name == frLabel) {
return true;
}
}
return false;
}[/AS]
i tried many times to understand but i could not, also is it good way to stop until i understand the difficult part of AS3 until i understand or go read on then come back?
Thank all for your time