Published in: ActionScript
delay = 5000; //----------------------- function loadXML(loaded) { if (loaded) { xmlNode = this.firstChild; a = []; o = {}; total = xmlNode.childNodes.length; for (i=0; i<total; i++) { var o = {}; o.image = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue; o.description = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue; a.push(o); } preloadImages(a); } else { content = "file not loaded!"; } } xmlData = new XML(); xmlData.ignoreWhite = true; xmlData.onLoad = loadXML; xmlData.load("images.xml"); // /////////////////////////////////// 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(); }; // /////////////////////////////////// p = 0; this.onEnterFrame = function() { filesize = picture.getBytesTotal(); loaded = picture.getBytesLoaded(); preloader._visible = true; if (loaded != filesize) { preloader.preload_bar._xscale = 100*loaded/filesize; } else { preloader._visible = false; if (picture._alpha<100) { picture._alpha += 10; } } }; var myInterval; function nextImage() { p++; p %= a.length; if (loaded == filesize) { //picture._alpha = 0; picture.loadMovie(a[p].image,1); //picture._width=763; //picture._height=525.8; desc_txt.text = a[p].description; picture_num(); clearInterval(myInterval); if (playing) { slideshow(); } } } function prevImage() { clearInterval(myInterval); if (playing) { slideshow(); } if (p>0) { p--; } else { p = a.length-1; } picture._alpha = 0; picture.loadMovie(a[p].image); desc_txt.text = a[p].description; picture_num(); } function firstImage() { if (loaded == filesize) { //picture._alpha = 0; picture.loadMovie(a[0].image,1); desc_txt.text = a[0].description; picture_num(); clearInterval(myInterval); if (playing) { slideshow(); } } } function picture_num() { current_pos = p+1; pos_txt.text = current_pos+"/"+total; picture._yscale = 80; picture._xscale = 94; } function slideshow() { myInterval = setInterval(pause_slideshow, delay); function pause_slideshow() { clearInterval(myInterval); nextImage(); } } //stop.tt.text = "STOP"; //play.tt.text="PLAY" playing = true; play.onPress = function() { playing = true; desc_txt.text = a[p].description; picture_num(); clearInterval(myInterval); if (playing) { slideshow(); } }; play.onRelease =play.onReleaseOutside= function(){; this.gotoAndStop("_disabled"); //this.enabled = false; }; stop.onPress = function() { playing = false; //play.enabled = true clearInterval(myInterval); }; if (gus.playpause == "pause") { playing = false; //play.enabled = true clearInterval(myInterval); } // end if;
You need to login to post a comment.
