diary       blog       guest

MovieClipLoader class 이거 물건입니다.

http://www.action-scripter.com/blog/trackback/932
이번 플래시 플레이서 7.0 부터 돌아가는 녀석입니다. 공부해 봅시다.

// first set of listeners
var my_mcl:MovieClipLoader = new MovieClipLoader();
var myListener:Object = new Object();
myListener.onLoadStart = function(target_mc:MovieClip) {
  trace("*********First my_mcl instance*********");
  trace("Your load has begun on movie clip = "+target_mc);
  var loadProgress:Object = my_mcl.getProgress(target_mc);
  trace(loadProgress.bytesLoaded+" = bytes loaded at start");
  trace(loadProgress.bytesTotal+" = bytes total at start");
};
myListener.onLoadProgress = function(target_mc:MovieClip, loadedBytes:Number, totalBytes:Number) {
  trace("*********First my_mcl instance Progress*********");
  trace("onLoadProgress() called back on movie clip "+target_mc);
  trace(loadedBytes+" = bytes loaded at progress callback");
  trace(totalBytes+" = bytes total at progress callback");
};
myListener.onLoadComplete = function(target_mc:MovieClip) {
  trace("*********First my_mcl instance*********");
  trace("Your load is done on movie clip = "+target_mc);
  var loadProgress:Object = my_mcl.getProgress(target_mc);
  trace(loadProgress.bytesLoaded+" = bytes loaded at end");
  trace(loadProgress.bytesTotal+" = bytes total at end");
};
myListener.onLoadInit = function(target_mc:MovieClip) {
  trace("*********First my_mcl instance*********");
  trace("Movie clip = "+target_mc+" is now initialized");
  // you can now do any setup required, for example:
  target_mc._width = 100;
  target_mc._height = 100;
};
myListener.onLoadError = function(target_mc:MovieClip, errorCode:String) {
  trace("*********First my_mcl instance*********");
  trace("ERROR CODE = "+errorCode);
  trace("Your load failed on movie clip = "+target_mc+"\n");
};
my_mcl.addListener(myListener);
// Now load the files into their targets.
// loads into movie clips
this.createEmptyMovieClip("clip1_mc", this.getNextHighestDepth());
clip1_mc._x = 400;
this.createEmptyMovieClip("clip2_mc", this.getNextHighestDepth());
my_mcl.loadClip("http://www.macromedia.com/software/drk/images/box_drk5.jpg", clip1_mc);
my_mcl.loadClip("http://www.macromedia.com/devnet/images/160x160/ben_forta.jpg", clip2_mc);
clip2_mc._x = 200;
// loads into _level1
my_mcl.loadClip("http://www.macromedia.com/devnet/images/160x160/mike_chambers.jpg", 1);
//
// Second set of listeners
var another_mcl:MovieClipLoader = new MovieClipLoader();
var myListener2:Object = new Object();
myListener2.onLoadStart = function(target_mc:MovieClip) {
  trace("*********Second my_mcl instance*********");
  trace("Your load has begun on movie = "+target_mc);
  var loadProgress:Object = my_mcl.getProgress(target_mc);
  trace(loadProgress.bytesLoaded+" = bytes loaded at start");
  trace(loadProgress.bytesTotal+" = bytes total at start");
};
myListener2.onLoadComplete = function(target_mc:MovieClip) {
  trace("*********Second my_mcl instance*********");
  trace("Your load is done on movie clip = "+target_mc);
  var loadProgress:Object = my_mcl.getProgress(target_mc);
  trace(loadProgress.bytesLoaded+" = bytes loaded at end");
  trace(loadProgress.bytesTotal+" = bytes total at end");
};
myListener2.onLoadError = function(target_mc:MovieClip, errorCode:String) {
  trace("*********Second my_mcl instance*********");
  trace("ERROR CODE = "+errorCode);
  trace("Your load failed on movie clip = "+target_mc+"\n");
};
another_mcl.addListener(myListener2);
/* Now load the files into their targets (using the second instance of MovieClipLoader) */
another_mcl.loadClip("http://www.macromedia.com/devnet/images/160x160/flex_logo.jpg", this.createEmptyMovieClip("clip4_mc", this.getNextHighestDepth()));
clip4_mc._y = 200;
// Issue the following statements after the download is complete,
// and after my_mcl.onLoadInit has been called.
// my_mcl.removeListener(myListener);
// my_mcl.removeListener(myListener2);

이녀석을 사용하면 프리로딩이 필요없습니다. 로딩이 되는 만큼 무비가 실행되고, 얼마만큼 로딩 되고 있는지 실시간으로 확인할 수 있는 class입니다. 음.. 하지만.. 로딩 되는 만큼 플레이를 시키면 모션이 끊겨 보이겠네요. 아무튼 로드무비 되는 무비의 상태를 단계별로 확인할 수 있는 class입니다.

2004/12/22 11:49 2004/12/22 11:49
   1   ... 804  805  806  807  808  809  810  811  812   ... 1286    
ABOUT  |  WORKS  |  @seonggyu
COPYRIGHT ⓒ 2000 - 2010. ACTION-SCRIPTER.COM. ALL RIGHTS RESEVED.