Difference between revisions of "Actionscript-XML Interaction"
From Wikicliki
(→One More) |
|||
(7 intermediate revisions by 2 users not shown) | |||
Line 64: | Line 64: | ||
imagePaths.push(this.firstChild.childNodes[2].childNodes[bannerSequence[i]].childNodes[2].firstChild.nodeValue); | imagePaths.push(this.firstChild.childNodes[2].childNodes[bannerSequence[i]].childNodes[2].firstChild.nodeValue); | ||
links.push(this.firstChild.childNodes[2].childNodes[bannerSequence[i]].childNodes[3].firstChild.nodeValue); | links.push(this.firstChild.childNodes[2].childNodes[bannerSequence[i]].childNodes[3].firstChild.nodeValue); | ||
+ | |||
+ | // loop: draw box and print number inside it then repeat and draw the next box on the right of the first box and repeat | ||
+ | |||
_root.wn.banner_mc3.createEmptyMovieClip("ButtonImage"+i, i+20); | _root.wn.banner_mc3.createEmptyMovieClip("ButtonImage"+i, i+20); | ||
eval("ButtonImage"+i).lineStyle(2,0xCCCCCC,20); | eval("ButtonImage"+i).lineStyle(2,0xCCCCCC,20); | ||
Line 97: | Line 100: | ||
</pre> | </pre> | ||
+ | |||
+ | |||
+ | == Another Implementation == | ||
+ | |||
+ | <pre> | ||
+ | xmlette = this.firstChild; | ||
+ | total = xmlette.childNodes.length; | ||
+ | image = []; | ||
+ | header = []; | ||
+ | subheader = []; | ||
+ | for (k=0; k<total; k++) { | ||
+ | image[k] = xmlette.childNodes[k].childNodes[0].firstChild.nodeValue; | ||
+ | header[k] = xmlette.childNodes[k].childNodes[1].firstChild.nodeValue; | ||
+ | subheader[k] = xmlette.childNodes[k].childNodes[2].firstChild.nodeValue; | ||
+ | } | ||
+ | |||
+ | a = 0; | ||
+ | aleft = a-1; | ||
+ | aright = a+1; | ||
+ | |||
+ | avalue_txt.text = a; // this for cheking | ||
+ | arightvalue_txt.text = aright; | ||
+ | aleftvalue_txt.text = aleft; | ||
+ | |||
+ | container.loadMovie(image[a], 1); | ||
+ | containerleft.loadMovie(image[aleft], 1); // container for the slide before | ||
+ | containerright.loadMovie(image[aright], 1); // container for the slide after | ||
+ | |||
+ | |||
+ | |||
+ | <slides> | ||
+ | <slide> | ||
+ | <image>swf/filename.swf</image> | ||
+ | <header></header> | ||
+ | <subheader></subheader> | ||
+ | </slide> | ||
+ | </slides> | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | == One More == | ||
+ | |||
+ | with thanks to Kun (actionscript god): | ||
+ | |||
+ | <pre> | ||
+ | |||
+ | function readysteadygoforKun2(fileNum,newballNumber){ | ||
+ | //trace("READY KUN!") | ||
+ | momo.enabled = false; | ||
+ | itHasMoved = 1; | ||
+ | subHeader._visible = 1; | ||
+ | currentLoaded_txt._visible = 1; | ||
+ | destinoXML = new XML(); | ||
+ | destinoXML.ignoreWhite = true; | ||
+ | destinoXML.onLoad = function(){ | ||
+ | //trace("XML LOADED"); | ||
+ | loadXMLKun(fileNum); | ||
+ | } | ||
+ | var xmlFileName = "cat"+newballNumber+".xml"; | ||
+ | loadedFile = "cat"+newballNumber; | ||
+ | //trace("xmlFileName: "+xmlFileName); | ||
+ | destinoXML.load(xmlFileName); | ||
+ | //trace("DONE"); | ||
+ | pChecker(); | ||
+ | } | ||
+ | |||
+ | function loadXMLKun(fileNum) { | ||
+ | xmlNode = destinoXML.firstChild; | ||
+ | //trace("xmlNode: "+destinoXML) | ||
+ | image = []; | ||
+ | header = []; | ||
+ | subheader = []; | ||
+ | total = xmlNode.childNodes.length; | ||
+ | for (k=0; k<total; k++) { | ||
+ | image[k] = xmlNode.childNodes[k].childNodes[0].firstChild.nodeValue; | ||
+ | header[k] = xmlNode.childNodes[k].childNodes[1].firstChild.nodeValue; | ||
+ | subheader[k] = xmlNode.childNodes[k].childNodes[2].firstChild.nodeValue; | ||
+ | } | ||
+ | ptotal_txt.text = total; | ||
+ | loadSectionKun(fileNum); | ||
+ | pChecker(); | ||
+ | } | ||
+ | |||
+ | function loadSectionKun(fileNum){ | ||
+ | p = fileNum; | ||
+ | pleft = p+1; | ||
+ | pvalue_txt.text = p; | ||
+ | pleftvalue_txt.text = pleft; | ||
+ | |||
+ | container._alpha = 0; | ||
+ | trace("fileNum: "+fileNum) | ||
+ | cat_txt.text = fileNum; | ||
+ | trace("image[fileNum]: "+image[fileNum]) | ||
+ | container.loadMovie(image[fileNum],1); | ||
+ | |||
+ | Header.text = header[fileNum]; | ||
+ | subHeader.text = subheader[fileNum]; | ||
+ | content_txt.text = image[fileNum]; | ||
+ | pChecker(); | ||
+ | } | ||
+ | |||
+ | </pre> | ||
+ | |||
+ | other bits for btns | ||
+ | |||
+ | <pre> | ||
+ | listen = new Object(); | ||
+ | listen.onKeyDown = function() { | ||
+ | if (Key.getCode() == Key.LEFT) { | ||
+ | prevImage(); | ||
+ | } else if (Key.getCode() == Key.RIGHT) { | ||
+ | nextImage(); | ||
+ | } | ||
+ | }; | ||
+ | Key.addListener(listen); | ||
+ | |||
+ | previous_btn.onRelease = function() { | ||
+ | prevImage(); | ||
+ | }; | ||
+ | |||
+ | next_btn.onRelease = function() { | ||
+ | nextImage(); | ||
+ | }; | ||
+ | </pre> | ||
+ | |||
+ | and some others for starting off to go with the btns | ||
+ | |||
+ | <pre> | ||
+ | p = 0; | ||
+ | this.onEnterFrame = function() { | ||
+ | filesize = container.getBytesTotal(); | ||
+ | loaded = container.getBytesLoaded(); | ||
+ | |||
+ | preloader._visible = true; | ||
+ | |||
+ | if (loaded != filesize) { | ||
+ | preloader.preload_bar._xscale = 100*loaded/filesize; | ||
+ | } else { | ||
+ | preloader._visible = false; | ||
+ | if (container._alpha<100) { | ||
+ | container._alpha += 10; | ||
+ | } | ||
+ | } | ||
+ | }; | ||
+ | |||
+ | function nextImage() { | ||
+ | |||
+ | if (p<(total-1)) { | ||
+ | next_btn._visible = true; | ||
+ | p++; | ||
+ | pleft = p+1; | ||
+ | |||
+ | container._alpha = 0; | ||
+ | container.loadMovie(image[p],1); | ||
+ | containerCenter.loadMovie(image[p],1); | ||
+ | Header.text = header[p]; | ||
+ | subHeader.text = subheader[p]; | ||
+ | pChecker(); | ||
+ | |||
+ | |||
+ | } else if (p == (total-1)) { | ||
+ | |||
+ | //trace ("lastslide"); | ||
+ | //next_btn._visible = false; | ||
+ | |||
+ | /* | ||
+ | if (loadedFile == "cat1") { | ||
+ | panel.spot0.gotoAndPlay(1); | ||
+ | panel.spot1.gotoAndPlay(2); | ||
+ | loadXML2(); | ||
+ | reversingCondition = 0; | ||
+ | |||
+ | } else if (loadedFile == "cat2") { | ||
+ | panel.spot1.gotoAndPlay(1); | ||
+ | panel.spot2.gotoAndPlay(2); | ||
+ | loadXML3(); | ||
+ | reversingCondition = 0; | ||
+ | } else if (loadedFile == "cat3") { | ||
+ | panel.spot2.gotoAndPlay(1); | ||
+ | panel.spot3.gotoAndPlay(2); | ||
+ | loadXML4(); | ||
+ | reversingCondition = 0; | ||
+ | } else if (loadedFile == "cat4") { | ||
+ | panel.spot3.gotoAndPlay(1); | ||
+ | panel.spot4.gotoAndPlay(2); | ||
+ | loadXML5(); | ||
+ | reversingCondition = 0; | ||
+ | } else if (loadedFile == "cat5") { | ||
+ | panel.spot4.gotoAndPlay(1); | ||
+ | panel.spot5.gotoAndPlay(2); | ||
+ | loadXML6(); | ||
+ | reversingCondition = 0; | ||
+ | } else if (loadedFile == "cat6") { | ||
+ | panel.spot5.gotoAndPlay(1); | ||
+ | panel.spot6.gotoAndPlay(2); | ||
+ | loadXML7(); | ||
+ | reversingCondition = 0; | ||
+ | } else if (loadedFile == "cat7") { | ||
+ | panel.spot6.gotoAndPlay(1); | ||
+ | panel.spot7.gotoAndPlay(2); | ||
+ | loadXML8(); | ||
+ | reversingCondition = 0; | ||
+ | } else if (loadedFile == "cat8") { | ||
+ | panel.spot7.gotoAndPlay(1); | ||
+ | panel.spot8.gotoAndPlay(2); | ||
+ | loadXML9(); | ||
+ | reversingCondition = 0; | ||
+ | } else if (loadedFile == "cat9") { | ||
+ | panel.spot8.gotoAndPlay(1); | ||
+ | panel.spot9.gotoAndPlay(2); | ||
+ | loadXML10(); | ||
+ | reversingCondition = 0; | ||
+ | } else if (loadedFile == "cat10") { | ||
+ | panel.spot9.gotoAndPlay(1); | ||
+ | panel.spot10.gotoAndPlay(2); | ||
+ | loadXML11(); | ||
+ | reversingCondition = 0; | ||
+ | } | ||
+ | */ | ||
+ | } | ||
+ | |||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | var reverseImage = 0; | ||
+ | |||
+ | function prevImage() { | ||
+ | if (p>0) { | ||
+ | p--; | ||
+ | pleft = p+1; | ||
+ | |||
+ | |||
+ | container._alpha = 0; | ||
+ | container.loadMovie(image[p],1); | ||
+ | Header.text = header[p]; | ||
+ | subHeader.text = subheader[p]; | ||
+ | pChecker(); | ||
+ | |||
+ | } | ||
+ | |||
+ | /* | ||
+ | else if (p == 0) { | ||
+ | |||
+ | reversingCondition = 1; | ||
+ | |||
+ | if (loadedFile == "cat2") { | ||
+ | resetspots(); | ||
+ | panel.spot0.gotoAndPlay(2); | ||
+ | panel.spot1.gotoAndPlay(1); | ||
+ | loadXML1(); | ||
+ | |||
+ | } else if (loadedFile == "cat3") { | ||
+ | resetspots(); | ||
+ | panel.spot1.gotoAndPlay(2); | ||
+ | panel.spot2.gotoAndPlay(1); | ||
+ | loadXML2(); | ||
+ | p = 0; | ||
+ | pleft = p+1; | ||
+ | pChecker(); | ||
+ | } else if (loadedFile == "cat4") { | ||
+ | resetspots(); | ||
+ | panel.spot2.gotoAndPlay(2); | ||
+ | panel.spot3.gotoAndPlay(1); | ||
+ | loadXML3(); | ||
+ | p = 0; | ||
+ | pleft = p+1; | ||
+ | pChecker(); | ||
+ | } else if (loadedFile == "cat5") { | ||
+ | resetspots(); | ||
+ | panel.spot3.gotoAndPlay(2); | ||
+ | panel.spot4.gotoAndPlay(1); | ||
+ | loadXML4(); | ||
+ | p = 0; | ||
+ | pleft = p+1; | ||
+ | pChecker(); | ||
+ | } else if (loadedFile == "cat6") { | ||
+ | resetspots(); | ||
+ | panel.spot4.gotoAndPlay(2); | ||
+ | panel.spot5.gotoAndPlay(1); | ||
+ | loadXML5(); | ||
+ | } else if (loadedFile == "cat7") { | ||
+ | goingBackwards = 1; | ||
+ | resetspots(); | ||
+ | panel.spot5.gotoAndPlay(2); | ||
+ | panel.spot6.gotoAndPlay(1); | ||
+ | loadXML6(); | ||
+ | p = 0; | ||
+ | pleft = p+1; | ||
+ | pChecker(); | ||
+ | } else if (loadedFile == "cat8") { | ||
+ | resetspots(); | ||
+ | panel.spot6.gotoAndPlay(2); | ||
+ | panel.spot7.gotoAndPlay(1); | ||
+ | loadXML7(); | ||
+ | p = 0; | ||
+ | pleft = p+1; | ||
+ | pChecker(); | ||
+ | } else if (loadedFile == "cat9") { | ||
+ | resetspots(); | ||
+ | panel.spot7.gotoAndPlay(2); | ||
+ | panel.spot8.gotoAndPlay(1); | ||
+ | loadXML8(); | ||
+ | p = 0; | ||
+ | pleft = p+1; | ||
+ | pChecker(); | ||
+ | } else if (loadedFile == "cat10") { | ||
+ | resetspots(); | ||
+ | panel.spot8.gotoAndPlay(2); | ||
+ | panel.spot9.gotoAndPlay(1); | ||
+ | loadXML9(); | ||
+ | p = 0; | ||
+ | pleft = p+1; | ||
+ | pChecker(); | ||
+ | } else if (loadedFile == "cat11") { | ||
+ | resetspots(); | ||
+ | panel.spot9.gotoAndPlay(2); | ||
+ | panel.spot10.gotoAndPlay(1); | ||
+ | loadXML10(); | ||
+ | p = 0; | ||
+ | pleft = p+1; | ||
+ | pChecker(); | ||
+ | } */ | ||
+ | |||
+ | } | ||
+ | |||
+ | function firstImage() { | ||
+ | |||
+ | p = 0; | ||
+ | pleft = p+1; | ||
+ | pvalue_txt.text = p; | ||
+ | pleftvalue_txt.text = pleft; | ||
+ | |||
+ | container._alpha = 0; | ||
+ | container.loadMovie(image[0],1); | ||
+ | |||
+ | Header.text = header[0]; | ||
+ | subHeader.text = subheader[0]; | ||
+ | content_txt.text = image[0]; | ||
+ | pChecker(); | ||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | == NOT USING XML BUT GETTING THE SAME EFFECT == | ||
+ | |||
+ | also with help from kun: | ||
+ | |||
+ | <pre> | ||
+ | var slide_array=new Array(); | ||
+ | slide_array=["mcslide1","mcslide3","mcslide2"] | ||
+ | counter=0; | ||
+ | // | ||
+ | |||
+ | next_mc.swapDepths(1000) | ||
+ | prev_mc.swapDepths(1001) | ||
+ | next_mc.onRelease=function(){ | ||
+ | prev_mc._alpha=100 | ||
+ | prev_mc.enabled=true | ||
+ | counter++; | ||
+ | showSlide(); | ||
+ | if(counter>slide_array.length-2){ | ||
+ | next_mc._alpha=30 | ||
+ | next_mc.enabled=false | ||
+ | } | ||
+ | } | ||
+ | prev_mc.onRelease=functison(){ | ||
+ | next_mc._alpha=100 | ||
+ | next_mc.enabled=true | ||
+ | counter--; | ||
+ | showSlide(); | ||
+ | if(counter<1){ | ||
+ | prev_mc._alpha=30 | ||
+ | prev_mc.enabled=false | ||
+ | } | ||
+ | } | ||
+ | |||
+ | function showSlide(){ | ||
+ | var currentSlide=slide_array[counter]; | ||
+ | attachMovie(currentSlide,"slide_mc",10); | ||
+ | } | ||
+ | showSlide(); | ||
+ | prev_mc._alpha=30 | ||
+ | prev_mc.enabled=false | ||
+ | </pre> | ||
+ | |||
+ | notes: | ||
+ | *make mcs in the library and name them in their linkages | ||
+ | *in as3 you wouldn't be able to do the same thing as its much more strict on the depths and you cannot swap to random 100232039384th depth but must swap in chronological and logical order |
Latest revision as of 09:12, 21 August 2009
<box> <thing> <name>apple</name> <colour>red</colour> </thing> <thing> <name>elephant</name> <colour>gray<colour> </thing> </box>
- APPLE is this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
- RED is this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
- ELEPHANT is this.firstChild.childNodes[1].childNodes[0].firstChild.nodeValue;
- GRAY is this.firstChild.childNodes[1].childNodes[1].firstChild.nodeValue;
Contents
Working Example
loading in the xml
var bannersXML:XML = new XML(); bannersXML.ignoreWhite = true; bannersXML.load("banners3.xml");
xml structure
<rotator isRandom="false"> <bannerTime>5</bannerTime> <numberOfBanners>3</numberOfBanners> <banners showHeader="true"> <banner> <name>Banner 1</name> <body>Lorem Ipsum</body> <imagePath>rotator/newpro1.jpg</imagePath> <bannerTime>3</bannerTime> <link>url</link> </banner> <banner> <name>Banner 2</name> <body>Lorem Ipsum</body> <imagePath>rotator/newpro2.jpg</imagePath> <bannerTime>10</bannerTime> <link>url</link> </banner> </banners> </rotator>
AS 2.0
- firstChild is the next level, childNode of the firstChild is the level below that
- first childnode is childNodes[0]
- second childnode is childNode[1]
- third childnode is childNode[2] you get the idea
for (var i = 0; i<numberOfBanners; i++) { banners.push(this.firstChild.childNodes[2].childNodes[bannerSequence[i]].firstChild.firstChild.toString()); bodyTexts.push(this.firstChild.childNodes[2].childNodes[bannerSequence[i]].childNodes[1].firstChild.nodeValue); imagePaths.push(this.firstChild.childNodes[2].childNodes[bannerSequence[i]].childNodes[2].firstChild.nodeValue); links.push(this.firstChild.childNodes[2].childNodes[bannerSequence[i]].childNodes[3].firstChild.nodeValue); // loop: draw box and print number inside it then repeat and draw the next box on the right of the first box and repeat _root.wn.banner_mc3.createEmptyMovieClip("ButtonImage"+i, i+20); eval("ButtonImage"+i).lineStyle(2,0xCCCCCC,20); eval("ButtonImage"+i).beginFill(0xCCCCCC,20); eval("ButtonImage"+i).lineTo(-5,0); eval("ButtonImage"+i).lineTo(-5,20); eval("ButtonImage"+i).lineTo(15,20); eval("ButtonImage"+i).lineTo(15,0); eval("ButtonImage"+i).lineTo(-5,0); eval("ButtonImage"+i).endFill(); eval("ButtonImage"+i)._x = 20+i*24; eval("ButtonImage"+i)._y = 10; _root.wn.banner_mc3.createTextField("ButtonNum"+i, i+10, 0, 3, 20, 20); eval("ButtonNum"+i).text = i+1; var prufont:TextFormat = new TextFormat(); prufont.size = 13; prufont.font = "Arial"; eval("ButtonNum"+i).setTextFormat(prufont); eval("ButtonNum"+i)._x = 20+i*24; eval("ButtonNum"+i)._y = 10; eval("ButtonImage"+i).onRollOver = function() { trace("rolloverbuttonmoon"); myColor = new Color(this); myColor.setRGB(0xff0000, 40); } eval("ButtonImage"+i).onRollOut = function() { trace("rolloverbuttonmoon"); myColor = new Color(this); myColor.setRGB(0xCCCCCC, 20); }
Another Implementation
xmlette = this.firstChild; total = xmlette.childNodes.length; image = []; header = []; subheader = []; for (k=0; k<total; k++) { image[k] = xmlette.childNodes[k].childNodes[0].firstChild.nodeValue; header[k] = xmlette.childNodes[k].childNodes[1].firstChild.nodeValue; subheader[k] = xmlette.childNodes[k].childNodes[2].firstChild.nodeValue; } a = 0; aleft = a-1; aright = a+1; avalue_txt.text = a; // this for cheking arightvalue_txt.text = aright; aleftvalue_txt.text = aleft; container.loadMovie(image[a], 1); containerleft.loadMovie(image[aleft], 1); // container for the slide before containerright.loadMovie(image[aright], 1); // container for the slide after <slides> <slide> <image>swf/filename.swf</image> <header></header> <subheader></subheader> </slide> </slides>
One More
with thanks to Kun (actionscript god):
function readysteadygoforKun2(fileNum,newballNumber){ //trace("READY KUN!") momo.enabled = false; itHasMoved = 1; subHeader._visible = 1; currentLoaded_txt._visible = 1; destinoXML = new XML(); destinoXML.ignoreWhite = true; destinoXML.onLoad = function(){ //trace("XML LOADED"); loadXMLKun(fileNum); } var xmlFileName = "cat"+newballNumber+".xml"; loadedFile = "cat"+newballNumber; //trace("xmlFileName: "+xmlFileName); destinoXML.load(xmlFileName); //trace("DONE"); pChecker(); } function loadXMLKun(fileNum) { xmlNode = destinoXML.firstChild; //trace("xmlNode: "+destinoXML) image = []; header = []; subheader = []; total = xmlNode.childNodes.length; for (k=0; k<total; k++) { image[k] = xmlNode.childNodes[k].childNodes[0].firstChild.nodeValue; header[k] = xmlNode.childNodes[k].childNodes[1].firstChild.nodeValue; subheader[k] = xmlNode.childNodes[k].childNodes[2].firstChild.nodeValue; } ptotal_txt.text = total; loadSectionKun(fileNum); pChecker(); } function loadSectionKun(fileNum){ p = fileNum; pleft = p+1; pvalue_txt.text = p; pleftvalue_txt.text = pleft; container._alpha = 0; trace("fileNum: "+fileNum) cat_txt.text = fileNum; trace("image[fileNum]: "+image[fileNum]) container.loadMovie(image[fileNum],1); Header.text = header[fileNum]; subHeader.text = subheader[fileNum]; content_txt.text = image[fileNum]; pChecker(); }
other bits for btns
listen = new Object(); listen.onKeyDown = function() { if (Key.getCode() == Key.LEFT) { prevImage(); } else if (Key.getCode() == Key.RIGHT) { nextImage(); } }; Key.addListener(listen); previous_btn.onRelease = function() { prevImage(); }; next_btn.onRelease = function() { nextImage(); };
and some others for starting off to go with the btns
p = 0; this.onEnterFrame = function() { filesize = container.getBytesTotal(); loaded = container.getBytesLoaded(); preloader._visible = true; if (loaded != filesize) { preloader.preload_bar._xscale = 100*loaded/filesize; } else { preloader._visible = false; if (container._alpha<100) { container._alpha += 10; } } }; function nextImage() { if (p<(total-1)) { next_btn._visible = true; p++; pleft = p+1; container._alpha = 0; container.loadMovie(image[p],1); containerCenter.loadMovie(image[p],1); Header.text = header[p]; subHeader.text = subheader[p]; pChecker(); } else if (p == (total-1)) { //trace ("lastslide"); //next_btn._visible = false; /* if (loadedFile == "cat1") { panel.spot0.gotoAndPlay(1); panel.spot1.gotoAndPlay(2); loadXML2(); reversingCondition = 0; } else if (loadedFile == "cat2") { panel.spot1.gotoAndPlay(1); panel.spot2.gotoAndPlay(2); loadXML3(); reversingCondition = 0; } else if (loadedFile == "cat3") { panel.spot2.gotoAndPlay(1); panel.spot3.gotoAndPlay(2); loadXML4(); reversingCondition = 0; } else if (loadedFile == "cat4") { panel.spot3.gotoAndPlay(1); panel.spot4.gotoAndPlay(2); loadXML5(); reversingCondition = 0; } else if (loadedFile == "cat5") { panel.spot4.gotoAndPlay(1); panel.spot5.gotoAndPlay(2); loadXML6(); reversingCondition = 0; } else if (loadedFile == "cat6") { panel.spot5.gotoAndPlay(1); panel.spot6.gotoAndPlay(2); loadXML7(); reversingCondition = 0; } else if (loadedFile == "cat7") { panel.spot6.gotoAndPlay(1); panel.spot7.gotoAndPlay(2); loadXML8(); reversingCondition = 0; } else if (loadedFile == "cat8") { panel.spot7.gotoAndPlay(1); panel.spot8.gotoAndPlay(2); loadXML9(); reversingCondition = 0; } else if (loadedFile == "cat9") { panel.spot8.gotoAndPlay(1); panel.spot9.gotoAndPlay(2); loadXML10(); reversingCondition = 0; } else if (loadedFile == "cat10") { panel.spot9.gotoAndPlay(1); panel.spot10.gotoAndPlay(2); loadXML11(); reversingCondition = 0; } */ } } var reverseImage = 0; function prevImage() { if (p>0) { p--; pleft = p+1; container._alpha = 0; container.loadMovie(image[p],1); Header.text = header[p]; subHeader.text = subheader[p]; pChecker(); } /* else if (p == 0) { reversingCondition = 1; if (loadedFile == "cat2") { resetspots(); panel.spot0.gotoAndPlay(2); panel.spot1.gotoAndPlay(1); loadXML1(); } else if (loadedFile == "cat3") { resetspots(); panel.spot1.gotoAndPlay(2); panel.spot2.gotoAndPlay(1); loadXML2(); p = 0; pleft = p+1; pChecker(); } else if (loadedFile == "cat4") { resetspots(); panel.spot2.gotoAndPlay(2); panel.spot3.gotoAndPlay(1); loadXML3(); p = 0; pleft = p+1; pChecker(); } else if (loadedFile == "cat5") { resetspots(); panel.spot3.gotoAndPlay(2); panel.spot4.gotoAndPlay(1); loadXML4(); p = 0; pleft = p+1; pChecker(); } else if (loadedFile == "cat6") { resetspots(); panel.spot4.gotoAndPlay(2); panel.spot5.gotoAndPlay(1); loadXML5(); } else if (loadedFile == "cat7") { goingBackwards = 1; resetspots(); panel.spot5.gotoAndPlay(2); panel.spot6.gotoAndPlay(1); loadXML6(); p = 0; pleft = p+1; pChecker(); } else if (loadedFile == "cat8") { resetspots(); panel.spot6.gotoAndPlay(2); panel.spot7.gotoAndPlay(1); loadXML7(); p = 0; pleft = p+1; pChecker(); } else if (loadedFile == "cat9") { resetspots(); panel.spot7.gotoAndPlay(2); panel.spot8.gotoAndPlay(1); loadXML8(); p = 0; pleft = p+1; pChecker(); } else if (loadedFile == "cat10") { resetspots(); panel.spot8.gotoAndPlay(2); panel.spot9.gotoAndPlay(1); loadXML9(); p = 0; pleft = p+1; pChecker(); } else if (loadedFile == "cat11") { resetspots(); panel.spot9.gotoAndPlay(2); panel.spot10.gotoAndPlay(1); loadXML10(); p = 0; pleft = p+1; pChecker(); } */ } function firstImage() { p = 0; pleft = p+1; pvalue_txt.text = p; pleftvalue_txt.text = pleft; container._alpha = 0; container.loadMovie(image[0],1); Header.text = header[0]; subHeader.text = subheader[0]; content_txt.text = image[0]; pChecker(); }
NOT USING XML BUT GETTING THE SAME EFFECT
also with help from kun:
var slide_array=new Array(); slide_array=["mcslide1","mcslide3","mcslide2"] counter=0; // next_mc.swapDepths(1000) prev_mc.swapDepths(1001) next_mc.onRelease=function(){ prev_mc._alpha=100 prev_mc.enabled=true counter++; showSlide(); if(counter>slide_array.length-2){ next_mc._alpha=30 next_mc.enabled=false } } prev_mc.onRelease=functison(){ next_mc._alpha=100 next_mc.enabled=true counter--; showSlide(); if(counter<1){ prev_mc._alpha=30 prev_mc.enabled=false } } function showSlide(){ var currentSlide=slide_array[counter]; attachMovie(currentSlide,"slide_mc",10); } showSlide(); prev_mc._alpha=30 prev_mc.enabled=false
notes:
- make mcs in the library and name them in their linkages
- in as3 you wouldn't be able to do the same thing as its much more strict on the depths and you cannot swap to random 100232039384th depth but must swap in chronological and logical order