Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. //box control
  2. boxx = _root.box._x
  3. boxy = _root.box._y
  4. boxh = _root.box._height
  5. boxw = _root.box._width
  6. boxp = 10
  7. var curSlide = 0;
  8. var tour:Array = new Array();
  9. mcLoader = new MovieClipLoader();
  10. mcLoader.addListener(this);
  11. //load the XML file
  12. var xmlFile:XML = new XML();
  13. xmlFile.ignoreWhite = true;
  14. xmlFile.onLoad = function(success) {
  15. if (success) {
  16. xml = xmlFile.firstChild.childNodes;
  17. trace(xml.length);
  18. w = ( (boxw - boxp*(xml.length+1)) / xml.length)
  19. for (var i = 0; i<=xml.length-1; i++) {
  20. tour[i] = Array(xml[i].attributes.image, xml[i].attributes.text);
  21. trace(tour[i][1]);
  22. _root.box.duplicateMovieClip("box" + i,i+5000,{_x:boxx+(w*i)+boxp*(i+1),_width:w});
  23. _root["box" + i].box_btn.num = i;
  24. _root["box" + i].box_btn.onRelease = function() {
  25. selectSlide(this.num);
  26. }
  27. }
  28. } else {
  29. trace("LEEEEROOOYYY JEEEEENKIIIINS!!!! XML not found. Your flash asplode.");
  30. }
  31. selectSlide(0);
  32. };
  33. // Load the XML
  34. xmlFile.load("tour.xml");
  35. function selectSlide(num) {
  36. if (num<0 || num>_root.tour.length-1) {
  37. trace("selectSlide was called with an out of bounds number. :"+num);
  38. return;
  39. }
  40. trace("selecting slide #"+num);
  41. _root["box" + curSlide].gotoAndStop(1);
  42. curSlide = num;
  43. _root["box" + curSlide].gotoAndStop(2);
  44. mcLoader.loadClip(_root.tour[num][0], _root.holder1_mc.image_mc);
  45. with (_root.holder1_mc) {
  46. para_txt.htmlText = _root.tour[num][1];
  47. }
  48. }
  49. _root.prev_btn.onRelease = function() {
  50. selectSlide(_root.curSlide-1);
  51. };
  52. _root.next_btn.onRelease = function() {
  53. selectSlide(_root.curSlide+1);
  54. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement