• beyond tellerrand – play. Register Now!
Zurück   Flashforum > Flash > Flash Fortgeschritten > Flash MX 2004

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 22-08-2005, 10:59   #1 (permalink)
flashen-lehr
 
Benutzerbild von michey
 
Registriert seit: Dec 2004
Ort: CH, Europa
Beiträge: 1.672
Falsche Position bei schnellem Click

Hallo

Kann mir jemand sagen warum bei dieser Gallerie die Position der Bilder verschoben wird wenn zu schnell geclickt wird und ob es eine Möglichkeit gibt dies zu verhindern?

Danke.

michey

ActionScript:
  1. spacing = 10;
  2. containerMC._alpha = 0;
  3. var pArray = new Array();
  4. var tArray = new Array();
  5. MovieClip.prototype.loadPic = function(pic) {
  6.     containerMC._alpha = 0;
  7.     cur = pic;
  8.     this.loadMovie(pArray[pic]);
  9.     this._parent.onEnterFrame = function() {
  10.         var t = containerMC.getBytesTotal(), l = containerMC.getBytesLoaded();
  11.         bar._visible = 1;
  12.         per = Math.round((l/t)*100);
  13.         if (t != 0 && Math.round(l/t) == 1 && containerMC._width != 0) {
  14.             var w = containerMC._width+spacing, h = containerMC._height+spacing;
  15.             border.resizeMe(w, h, pic);
  16.             bar._visible = 0;
  17.             loadText.text = "";
  18.             delete this.onEnterFrame; // falsch: delete this.onEnterFrame;
  19.         } else {
  20.             bar._width = per;
  21.             // gives the bar a max width 100. För att få 250 px t.ex: bar._width = per*2.5;
  22.             loadText.text = per+" % ";
  23.         }
  24.     };
  25. };
  26. MovieClip.prototype.resizeMe = function(w, h, pic) {
  27.     var speed = 3;
  28.     containerMC._xscale = containerMC._yscale = 0; // Skalierung auf 0% setzen.
  29.     this.onEnterFrame = function() {
  30.         this._width += (w-this._width)/speed;
  31.         this._height += (h-this._height)/speed;
  32.         nav._y = Math.round(border._y+border._height/2+10);
  33.         prevb._x = nav._x-5;
  34.         nextb._x = nav._x+this._width+5;
  35.         nextb._y = prevb._y=this._y-this._height/2;
  36.         picinfo._y = 70;
  37.         picinfo.info.text = tArray[pic];
  38.         picinfo._x = border._x-picinfo._width/2;
  39.         if (Math.abs(this._width-w)<1 && Math.abs(this._height-h)<1) {
  40.             this._width = w;
  41.             this._height = h;
  42.             containerMC._x = this._x-this._width/2+spacing/2;
  43.             containerMC._y = this._y-this._height/2+spacing/2;
  44.             containerMC._xscale = containerMC._yscale += 7; // container Skalieren
  45.             containerMC._alpha += 7;
  46.             if (containerMC._alpha>90 || containerMC._xscale >= 100) { // Bedingung erweitert
  47.                 containerMC._alpha = 100;
  48.                 containerMC._xscale = containerMC._yscale = 100;
  49.                 delete this.onEnterFrame;
  50.             }
  51.         }
  52.     };
  53. };
  54. var gallery_xml = new XML();
  55. gallery_xml.ignoreWhite = true;
  56. gallery_xml.onLoad = function(success) {
  57.     if (success) {
  58.         var gallery = this.firstChild;
  59.         for (var i = 0; i<gallery.childNodes.length; i++) {
  60.             tArray.push(gallery.childNodes[i].attributes.title);
  61.             pArray.push(gallery.childNodes[i].attributes.source);
  62.         }
  63.         //loading first picture
  64.         containerMC.loadPic(0);
  65.     } else {
  66.         title_txt.text = "Error!";
  67.     }
  68. };
  69. gallery_xml.load("gallery.xml");
  70. prevb.onRelease = function() {
  71.     if (cur == 0) {
  72.         containerMC.loadPic(pArray.length-1);
  73.     } else {
  74.         containerMC.loadPic(cur-1);
  75.     }
  76. };
  77. nextb.onRelease = function() {
  78.     if (cur == pArray.length-1) {
  79.         containerMC.loadPic(0);
  80.     } else {
  81.         containerMC.loadPic(cur+1);
  82.     }
  83. };
Angehängte Dateien
Dateityp: zip Zoom1.zip (33,9 KB, 6x aufgerufen)

Geändert von michey (22-08-2005 um 12:05 Uhr)
michey ist offline   Mit Zitat antworten
Alt 22-08-2005, 12:13   #2 (permalink)
flashen-lehr
 
Benutzerbild von michey
 
Registriert seit: Dec 2004
Ort: CH, Europa
Beiträge: 1.672
Hat keiner eine Ahnung?
Dürfte doch wohl für einen alten Hasen keine Sache sein!
michey ist offline   Mit Zitat antworten
Alt 22-08-2005, 12:21   #3 (permalink)
................
 
Benutzerbild von Der Frager
 
Registriert seit: Jun 2004
Beiträge: 15.888
Hallo.
Hab dir noch eine Variable reingesetzt, die prüft, ob das vorherige Bild noch läd:
ActionScript:
  1. MovieClip.prototype.loadPic = function(pic) {
  2.     if (!laden) { // [B]Gucken ob nicht geladen wird[/B]
  3.         laden = true;
  4.         containerMC._alpha = 0;
  5.         cur = pic;
  6.         this.loadMovie(pArray[pic]);
  7.         this._parent.onEnterFrame = function() {
  8.             var t = containerMC.getBytesTotal(), l = containerMC.getBytesLoaded();
  9.             bar._visible = 1;
  10.             per = Math.round((l/t)*100);
  11.             if (t != 0 && Math.round(l/t) == 1 && containerMC._width != 0) {
  12.                 var w = containerMC._width+spacing, h = containerMC._height+spacing;
  13.                 border.resizeMe(w, h, pic);
  14.                 bar._visible = 0;
  15.                 loadText.text = "";
  16.                 delete this.onEnterFrame;
  17.                 // falsch: delete this.onEnterFrame;
  18.             } else {
  19.                 bar._width = per;
  20.                 // gives the bar a max width 100. För att få 250 px t.ex: bar._width = per*2.5;
  21.                 loadText.text = per+" % ";
  22.             }
  23.         };
  24.     }
  25. };
  26. MovieClip.prototype.resizeMe = function(w, h, pic) {
  27.     var speed = 3;
  28.     containerMC._xscale = containerMC._yscale=0;
  29.     // Skalierung auf 0% setzen.
  30.     this.onEnterFrame = function() {
  31.         this._width += (w-this._width)/speed;
  32.         this._height += (h-this._height)/speed;
  33.         nav._y = Math.round(border._y+border._height/2+10);
  34.         prevb._x = nav._x-5;
  35.         nextb._x = nav._x+this._width+5;
  36.         nextb._y = prevb._y=this._y-this._height/2;
  37.         picinfo._y = 70;
  38.         picinfo.info.text = tArray[pic];
  39.         picinfo._x = border._x-picinfo._width/2;
  40.         if (Math.abs(this._width-w)<1 && Math.abs(this._height-h)<1) {
  41.             this._width = w;
  42.             this._height = h;
  43.             containerMC._x = this._x-this._width/2+spacing/2;
  44.             containerMC._y = this._y-this._height/2+spacing/2;
  45.             containerMC._xscale = containerMC._yscale += 7;
  46.             // container Skalieren
  47.             containerMC._alpha += 7;
  48.             if (containerMC._alpha>90 || containerMC._xscale>=100) {
  49.                 // Bedingung erweitert
  50.                 containerMC._alpha = 100;
  51.                 containerMC._xscale = containerMC._yscale=100;
  52.                 delete this.onEnterFrame;
  53.                 laden = false; // [B]Hier ist's dann geladen[/B]
  54.             }
  55.         }
  56.     };
  57. };
__________________

ternärer Konditionaloperator

+++ Bitte keine Privat-Nachrichten bezüglich Flashfragen! +++
Der Frager ist offline   Mit Zitat antworten
Alt 22-08-2005, 12:34   #4 (permalink)
flashen-lehr
 
Benutzerbild von michey
 
Registriert seit: Dec 2004
Ort: CH, Europa
Beiträge: 1.672
Danke Frager!
Hat der Bug also damit zu tun dass bei schnellem clicken irgendwie von einer
Zwischenposition(vom ersten Click) ausgegangen wird um das neue Bild zu laden beim zweiten zu schnellen Click?

michey
michey ist offline   Mit Zitat antworten
Alt 22-08-2005, 12:42   #5 (permalink)
................
 
Benutzerbild von Der Frager
 
Registriert seit: Jun 2004
Beiträge: 15.888
Denke ich mal... Habe mir jetzt nicht das ganze Script durchgelesen.
__________________

ternärer Konditionaloperator

+++ Bitte keine Privat-Nachrichten bezüglich Flashfragen! +++
Der Frager 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 01:26 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele