Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 17-11-2003, 02:03   #1 (permalink)
manx
Gast
 
Beiträge: n/a
duplicateMovieClip mit setInerval

Servus.

Mit dem untenstehenden Script, dublizere ich den MC 'bar'.
Nun.. de Dublikate sollen aber nicht alle auf einmal, sondern einer nach dem anderen eingebelendet werden. Schätze das funktionert mit setInterval.
Die Beispiele in der Flash Hilfe hab ich verstanden, komm aber nicht dahinter wie ich das einbauen muss.

ActionScript:
  1. m = new LoadVars();
  2. m.duplicateMcs = function(anzahl) {
  3.    for(var i=0;i<Number(anzahl);i++){
  4.        _root.bar.duplicateMovieClip("bar"+i, i);
  5.        _root["bar"+i].date = this["date"+i];
  6.        _root["bar"+i].genre = this["genre"+i];
  7.        _root["bar"+i].title = this["title"+i];
  8.        _root["bar"+i].playtime = this["playtime"+i];
  9.        _root["bar"+i].link = this["link"+i];
  10.        _root["bar"+i]._y = i*12;
  11.    }
  12. }
  13. m.onLoad = function(ok) {
  14.     if (ok) {
  15.         this.duplicateMcs(this.anzahl);
  16.     }
  17. };
  18. m.load("inhalt.txt");


inhalt.txt:

&anzahl=20&
&date0=01.01.04&
&genre0=balbla&
&title0=blabla&
&playtime0=blabla&
&link0=<a href="http://.....">balbla</a>&
&date1=--&
&genre1=--&
...usw...

Geändert von manx (17-11-2003 um 05:19 Uhr)
  Mit Zitat antworten
Alt 17-11-2003, 07:09   #2 (permalink)
_______________
 
Benutzerbild von son yu
 
Registriert seit: Mar 2003
Ort: !Schnitzerland
Beiträge: 2.003
hy,

naja mit ner for schleife wird das nix, weil die erst alles berechnet und dir das ende dann präsentiert...
also die komplette for schleife läuft in einem frame ab...

probier's mal so
ActionScript:
  1. m = new LoadVars();
  2. m.duplicateMcs = function(anzahl) {
  3. this.onEnterFrame = function(){
  4. var i=0;
  5.        if(i<Number(anzahl)){
  6.                 _root.bar.duplicateMovieClip("bar"+i, i);
  7.                 _root["bar"+i].date = this["date"+i];
  8.                 _root["bar"+i].genre = this["genre"+i];
  9.                 _root["bar"+i].title = this["title"+i];
  10.                 _root["bar"+i].playtime = this["playtime"+i];
  11.                 _root["bar"+i].link = this["link"+i];
  12.                 _root["bar"+i]._y = i*12;
  13. i++;
  14.         }else {
  15. delete this.onEnterFrame;
  16. }
  17. }
  18. }
  19. m.onLoad = function(ok) {
  20.         if (ok) {
  21.                 this.duplicateMcs(this.anzahl);
  22.         }
  23. };
  24. m.load("inhalt.txt");

schöne grüße
__________________
ey… be cool!

Mac OS-X 10.5.6, Safari Version 4 Public Beta (5528.16), on PowerBook 12" G4 1,5 GHz,
1,25 GB RAM, FlashPlayer 9 is auch noch da, wenn ich Lust habe…
son yu ist offline   Mit Zitat antworten
Alt 17-11-2003, 11:23   #3 (permalink)
manx
Gast
 
Beiträge: n/a
Hmm.. funzelt irgednwie nicht.
  Mit Zitat antworten
Alt 17-11-2003, 12:59   #4 (permalink)
_//\\#//\\_
 
Benutzerbild von warrantmaster
 
Registriert seit: Jan 2003
Beiträge: 7.060
ActionScript:
  1. m = new LoadVars();
  2. var i = 0;
  3. duplicateMcs = function () {
  4.     if (i<anz) {
  5.         var mc = _root.bar.duplicateMovieClip("bar"+i, i);
  6.         mc.date = m["date"+i];
  7.         mc.genre = m["genre"+i];
  8.         mc.title = m["title"+i];
  9.         mc.playtime = m["playtime"+i];
  10.         mc.link = m["link"+i];
  11.         mc._y = i*12;
  12.         i++;
  13.     } else {
  14.         clearInterval(inter);
  15.     }
  16. };
  17. m.onLoad = function(ok) {
  18.     if (ok) {
  19.         _root.anz = this.anzahl;
  20.         inter = setInterval(duplicateMcs, 500);
  21.     }
  22. };
  23. m.load("inhalt.txt");
warrantmaster ist offline   Mit Zitat antworten
Alt 17-11-2003, 15:25   #5 (permalink)
_______________
 
Benutzerbild von son yu
 
Registriert seit: Mar 2003
Ort: !Schnitzerland
Beiträge: 2.003
na also den fehler hätts auch finden können...

ActionScript:
  1. //extrem gekürzt
  2. m = new LoadVars();
  3.  function duplicateMcs(anzahl) {
  4.       var i=0;//<<<sollte schon vor des on Enter Frame, sonst wirds ja immer null bleiben...
  5.         this.onEnterFrame = function(){
  6.          
  7.                 if(i<Number(anzahl)){
  8.                         _root.attachMovie("bar"+i, i);
  9.                        
  10.                         i++;
  11.                 }else {
  12.                         delete this.onEnterFrame;
  13.                 }
  14.         }
  15. }
  16. _root.duplicateMcs(20);

schöne grüße
__________________
ey… be cool!

Mac OS-X 10.5.6, Safari Version 4 Public Beta (5528.16), on PowerBook 12" G4 1,5 GHz,
1,25 GB RAM, FlashPlayer 9 is auch noch da, wenn ich Lust habe…
son yu ist offline   Mit Zitat antworten
Alt 18-11-2003, 08:09   #6 (permalink)
manx
Gast
 
Beiträge: n/a
Axooo!!

Ich danke Euch...

Gruss
Manx
  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 04:47 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele