8 Aralık 2009 Salı

Actionscript 2.0 ile Resim Yükleme

ADV Manager sistemimizde kullanmamız gereken bir diğer uygulama kodu da flash dosyamızda yüklediğimiz resimlerin görüntülenmesi ile ilgili olmalı. Bunun içine araştırıp bulduğum örnek kod aşağıdaki gibiydi.

var my_pb:mx.controls.ProgressBar;
my_pb.mode = "manual";

this.createEmptyMovieClip("img_mc", 999);

var my_mcl:MovieClipLoader = new MovieClipLoader();
var mclListener:Object = new Object();
mclListener.onLoadStart = function(target_mc:MovieClip):Void {
    my_pb.label = "loading: " + target_mc._name;
};
mclListener.onLoadProgress = function(target_mc:MovieClip, numBytesLoaded:Number, numBytesTotal:Number):Void {
    var pctLoaded:Number = Math.ceil(100 * (numBytesLoaded / numBytesTotal));
    my_pb.setProgress(numBytesLoaded, numBytesTotal);
};
my_mcl.addListener(mclListener);
my_mcl.loadClip("http://www.helpexamples.com/flash/images/image1.jpg", img_mc);

Örneğin alına http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001025.html linkinden ulaşılabiliyor.

0 yorum:

Yorum Gönder