Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 13-10-2003, 15:32   #1 (permalink)
darki000
Gast
 
Beiträge: n/a
Question MovieClipLoader: bytesLoaded und bytesTotal

Hi,

kann mir jemand mal ein kurzes einfaches Beispiel posten in dem auf die Eigenschaften bytesLoaded und bytesTotal zugegriffen wird. Ich bekomme es nicht hin die Eigenschaften abzufragen.

Danke!

Gruß
Nick Weschkalnies
www.medianetic.de
  Mit Zitat antworten
Alt 13-10-2003, 17:39   #2 (permalink)
Trainman
 
Benutzerbild von Hamster2k
 
Registriert seit: Sep 2001
Ort: Wien, Österreich
Beiträge: 1.324
Hi!
ActionScript:
  1. deinContainer.loadMovie("deineswf.swf");
  2. trace("Lade deineswf.swf :");
  3. deinContainer.onEnterFrame = function() {
  4. if(this.getBytesLoaded()<this.getBytesTotal()) {
  5. trace(this.getBytesLoaded()/this.getBytesTotal()*100+" %");
  6. } else {
  7. delete this.onEnterFrame;
  8. trace("100% !");
  9. }
  10. }

*untested*

MfG
__________________
So much to learn and so little time.

Ich liebe dieses Forum!!
Hamster2k ist offline   Mit Zitat antworten
Alt 13-10-2003, 17:46   #3 (permalink)
darki000
Gast
 
Beiträge: n/a
Hi,

Mir ist schon klar, wie ich über die alten Methoden darauf zugreife. Es geht mir um den neuen MovieClipLoader.

Vielleicht war das etwas mißverständlich ausgedrückt.
  Mit Zitat antworten
Alt 13-10-2003, 18:04   #4 (permalink)
Trainman
 
Benutzerbild von Hamster2k
 
Registriert seit: Sep 2001
Ort: Wien, Österreich
Beiträge: 1.324
Achso
Hab in der Hilfe nachgesehen, und da gibts eh ein ausführliches Beispiel:
ActionScript:
  1. // first set of listeners
  2. var my_mcl = new MovieClipLoader();
  3. myListener = new Object();
  4. myListener.onLoadStart = function (target_mc)
  5. {
  6. myTrace ("*********First my_mcl instance*********");
  7. myTrace ("Your load has begun on movie clip . = " + target_mc);
  8. var loadProgress = my_mcl.getProgress(target_mc);
  9. myTrace(loadProgress.bytesLoaded + " = bytes loaded at start");
  10. myTrace(loadProgress.bytesTotal + " = bytes total at start");
  11. }
  12. myListener.onLoadProgress = function (target_mc, loadedBytes, totalBytes)
  13. {
  14. myTrace ("*********First my_mcl instance Progress*********");
  15. myTrace ("onLoadProgress() called back on movie clip " + target_mc);
  16. myTrace(loadedBytes + " = bytes loaded at progress callback " );
  17. myTrace(totalBytes + " = bytes total at progress callback \n");
  18. }
  19. myListener.onLoadComplete = function (target_mc)
  20. {
  21. myTrace ("*********First my_mcl instance*********");
  22. myTrace ("Your load is done on movie clip = " + target_mc);
  23. var loadProgress = my_mcl.getProgress(target_mc);
  24. myTrace(loadProgress.bytesLoaded + " = bytes loaded at end" );
  25. myTrace(loadProgress.bytesTotal + " = bytes total at end=");
  26. }
  27. myListener.onLoadInit = function (target_mc)
  28. {
  29. myTrace ("*********First my_mcl instance*********");
  30. myTrace ("Movie clip = " + target_mc + " is now initialized");
  31. // you can now do any setup required, for example:
  32. target_mc._width = 100;
  33. target_mc._width = 100;
  34. }
  35. myListener.onLoadError = function (target_mc, errorCode)
  36. {
  37. myTrace ("*********First my_mcl instance*********");
  38. myTrace ("ERROR CODE = " + errorCode);
  39. myTrace ("Your load failed on movie clip = " + target_mc + "\n");
  40.  }
  41. my_mcl.addListener(myListener);
  42. //Now load the files into their targets.
  43. // loads into movie clips - strings used as target
  44. my_mcl.loadClip("http://www.somedomain.somewhere.com/someFile.swf","_root.myMC");
  45. my_mcl.loadClip("http://www.somedomain.somewhere.com/someOtherFile.swf", "_level0.myMC2");
  46. //failed load
  47. my_mcl.loadClip("http://www.somedomain.somewhere.com/someFile.jpg", _root.myMC5);
  48.  
  49. // loads into movie clips - movie clip instances used as target.
  50. my_mcl.loadClip("http://www.somedomain.somewhere.com/someOtherFile.jpg", _level0.myMC3);
  51.  
  52. // loads into _level1
  53. my_mcl.loadClip("file:///C:/media/images/somePicture.jpg", 1);
  54.  
  55. //Second set of listeners
  56. var another_mcl = new MovieClipLoader();
  57. myListener2 = new Object();
  58. myListener2.onLoadStart = function (target_mc)
  59. {
  60. myTrace("*********Second my_mcl instance*********");
  61. myTrace ("Your load has begun on movie clip22 . = " + target_mc);
  62. var loadProgress = my_mcl.getProgress(target_mc);
  63. myTrace(loadProgress.bytesLoaded + " = bytes loaded at start" );
  64. myTrace(loadProgress.bytesTotal + " = bytes total at start");
  65. }
  66. myListener2.onLoadComplete = function (target_mc)
  67. {
  68. myTrace ("*********Second my_mcl instance*********");
  69. myTrace ("Your load is done on movie clip = " + target_mc);
  70. var loadProgress = my_mcl.getProgress(target_mc);
  71. myTrace(loadProgress.bytesLoaded + " = bytes loaded at end");
  72. myTrace(loadProgress.bytesTotal + " = bytes total at end" );
  73. }
  74. myListener2.onLoadError = function (target_mc, errorCode)
  75. {
  76. myTrace ("*********Second my_mcl instance*********");
  77. myTrace ("ERROR CODE = " + errorCode);
  78. myTrace ("Your load failed on movie clip = " + target_mc + "\n");
  79.  }
  80. another_mcl.addListener(myListener2);
  81. //Now load the files into their targets (using the second instance of MovieClipLoader)
  82. another_mcl.loadClip("http://www.somedomain.somewhere.com/yetAnotherFile.jpg", _root.myMC4);
  83. // Issue the following statements after the download is complete,
  84. // and after my_mcl.onLoadInit has been called.
  85. // my_mcl.removeListener(myListener)
  86. // my_mcl.removeListener(myListener2)
  87.  
MfG
__________________
So much to learn and so little time.

Ich liebe dieses Forum!!
Hamster2k 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:38 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele