Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 25-07-2005, 11:32   #1 (permalink)
Neuer User
 
Registriert seit: Oct 2003
Ort: Shanghai, China
Beiträge: 10
Photo gallery - funktioniert gut, aber geht es auch als Slide show ??

Ich verwende ein Photo Gallery Script von Kirupa.com

Der Quellcode dazu siehe unten. Das ganze funktioniert recht gut, nur hätte ich gerne 2 Änderungen.

a) Ich hätte gerne, dass Bilder auch schon vorladen, also nicht erst geladen werden wenn der User auf das "next" button klickt

b) Ich würde gerne optional eine automatische Slide Show einbauen, so dass Bilder zB. nach ein paar Sekunden automatisch wechseln.

Leider verstehe ich den Code kaum, wäre sehr sehr Dankbar, wenn hier jemand helfen könnte.

Und hier der Code :

ActionScript:
  1. function loadXML(loaded) {
  2.  
  3. if (loaded) {
  4.  
  5. xmlNode = this.firstChild;
  6. image = [];
  7. description = [];
  8. total = xmlNode.childNodes.length;
  9. for (i=0; i<total; i++) {
  10.  
  11. image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
  12. description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
  13.  
  14. }
  15. firstImage();
  16.  
  17. } else {
  18.  
  19. content = "file not loaded!";
  20.  
  21. }
  22.  
  23. }
  24. xmlData = new XML();
  25. xmlData.ignoreWhite = true;
  26. xmlData.onLoad = loadXML;
  27. xmlData.load("images.xml");
  28. /////////////////////////////////////
  29. listen = new Object();
  30. listen.onKeyDown = function() {
  31.  
  32. if (Key.getCode() == Key.LEFT) {
  33.  
  34. prevImage();
  35.  
  36. } else if (Key.getCode() == Key.RIGHT) {
  37.  
  38. nextImage();
  39.  
  40. }
  41.  
  42. };
  43. Key.addListener(listen);
  44. previous_btn.onRelease = function() {
  45.  
  46. prevImage();
  47.  
  48. };
  49. next_btn.onRelease = function() {
  50.  
  51. nextImage();
  52.  
  53. };
  54. /////////////////////////////////////
  55. p = 0;
  56. this.onEnterFrame = function() {
  57.  
  58. filesize = picture.getBytesTotal();
  59. loaded = picture.getBytesLoaded();
  60. preloader._visible = true;
  61. if (loaded != filesize) {
  62.  
  63. preloader.preload_bar._xscale = 100*loaded/filesize;
  64.  
  65. } else {
  66.  
  67. preloader._visible = false;
  68. if (picture._alpha<100) {
  69.  
  70. picture._alpha += 10;
  71.  
  72. }
  73.  
  74. }
  75.  
  76. };
  77. function nextImage() {
  78.  
  79. if (p<(total-1)) {
  80.  
  81. p++;
  82. if (loaded == filesize) {
  83. picture._alpha = 0;
  84.  
  85. if(description[p] == "hoch"){
  86.     picture._x=70;
  87.     picture._y=0;
  88.     picture.loadMovie(image[p], 1);
  89. } else {
  90.     picture._y = 50;
  91.     picture.loadMovie(image[p], 1);
  92. }   
  93. desc_txt.text = description[p];
  94. picture_num();
  95.  
  96. }
  97.  
  98. }
  99.  
  100. }
  101. function prevImage() {
  102.  
  103. if (p>0) {
  104.  
  105. p--;
  106. picture._alpha = 0;
  107. if(description[p] == "hoch"){
  108.     picture._x=70;
  109.     picture.loadMovie(image[p], 1);
  110. } else {
  111.     picture._y = 50;
  112.     picture.loadMovie(image[p], 1);
  113. }
  114.  
  115. desc_txt.text = description[p];
  116. picture_num();
  117.  
  118. }
  119.  
  120. }
  121. function firstImage() {
  122.  
  123. if (loaded == filesize) {
  124.  
  125. picture._alpha = 0;
  126. if(description[0] == "hoch"){
  127.     picture._x=70;
  128.     picture.loadMovie(image[0], 1);
  129. } else {
  130.     picture._y = 50;
  131.     picture.loadMovie(image[0], 1);
  132. }
  133. desc_txt.text = description[0];
  134. picture_num();
  135.  
  136. }
  137.  
  138. }
  139. function picture_num() {
  140.  
  141. current_pos = p+1;
  142. pos_txt.text = "Photo "+current_pos+" of "+total;
smorb ist offline   Mit Zitat antworten
Alt 25-07-2005, 13:51   #2 (permalink)
Neuer User
 
Registriert seit: Oct 2003
Ort: Shanghai, China
Beiträge: 10
up ^^^

Genau betrachet müsste ich einfach nur aus

ActionScript:
  1. listen.onKeyDown = function() {

etwas machen wie "wenn 20 sekunden um sind, dann "function()" ..

aber wie sage ich Flash "wenn 20 sekunden um sind" ??


Danke !!
smorb ist offline   Mit Zitat antworten
Alt 25-07-2005, 16:58   #3 (permalink)
o_0
 
Benutzerbild von DoTheSinWave
 
Registriert seit: Apr 2005
Ort: zuhause
Beiträge: 79
ActionScript:
  1. setInterval(funktion,intervall(in millisekunden),parameter)
...ist der Schlüssel.

in deinem Fall also:
ActionScript:
  1. setInterval(nextImage,20000)
DoTheSinWave ist offline   Mit Zitat antworten
Antwort

Lesezeichen

Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks sind an
Pingbacks sind an
Refbacks sind an



Alle Zeitangaben in WEZ +1. Es ist jetzt 00:43 Uhr.

Domains, Webhosting & Vserver von Host Europe
Unterstützt das Flashforum!
Adobe User Group


Copyright ©1999 – 2012 Marc Thiele