关于在 flash 动作脚本中停止闪烁

Regarding Stop blinking in flash Action Script

您好,我正在使用 Flash 动作脚本。图像以 1 秒的间隔从互联网上显示。但这是眨眼。我怎样才能停止眨眼,以便我可以连续看到图像。

    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) {
    my_pb.label = "loading: "+target_mc._name;
};
mclListener.onLoadProgress = function(target_mc:MovieClip, numBytesLoaded:Number, numBytesTotal:Number) {
    var pctLoaded:Number = Math.ceil(100*(numBytesLoaded/numBytesTotal));
    my_pb.setProgress(numBytesLoaded, numBytesTotal);
};
var myInterval = setInterval(testInterval, 1000);
function testInterval() {
    my_mcl.addListener(mclListener);
    my_mcl.loadClip("https://www.google.co.in/logos/doodles/2015/holi-festival-2015-5124794139803648-hp.gif", img_mc);
    //my_mcl.loadClip("https://www.google.co.in/logos/doodles/2015/holi-festival-2015-5124794139803648-hp.gif", img_mc);
}

为避免这种情况,您可以使用两个 MovieClip,每次将图像加载到其中一个中并隐藏另一个,如下所示:

var images:Array = [
    'https://cdn3.iconfinder.com/data/icons/inficons/128/Whosebug.png',
    'https://cdn3.iconfinder.com/data/icons/inficons/128/joomla.png',
    'https://cdn3.iconfinder.com/data/icons/inficons/128/bitcoin.png',
    'https://cdn3.iconfinder.com/data/icons/inficons/128/wordpress.png',    
    'https://cdn3.iconfinder.com/data/icons/inficons/128/github.png'
];  

var current_loader:Number = 1;
var current_img:Number = 0;

var progress_bar:mx.controls.ProgressBar;
    progress_bar.mode = 'manual';

this.createEmptyMovieClip('img_01', 999);
this.createEmptyMovieClip('img_02', 998);

img_01._x = img_01._y = img_02._x = img_02._y = 20;

var loader:MovieClipLoader = new MovieClipLoader();

var listener:Object = new Object();
    listener.onLoadStart = function(target_mc:MovieClip) {
        progress_bar.visible = true;
    }
    listener.onLoadProgress = function(target_mc:MovieClip, numBytesLoaded:Number, numBytesTotal:Number) {
        progress_bar.setProgress(numBytesLoaded, numBytesTotal);
    }
    listener.onLoadComplete = function(target_mc:MovieClip) {
        // hide the last image loader 
        if(target_mc._name == 'img_01'){
            img_02._visible = false;
        } else {
            img_01._visible = false;
        }
        // init the progress bar and hide it
        progress_bar.setProgress(0, 100);
        progress_bar.visible = false;
    }

var interval:Number = setInterval(load_image, 1000);
function load_image() { 
    loader.addListener(listener);
    loader.loadClip(images[current_img], _root['img_0'+current_loader]);
    // set the next loader
    current_loader = current_loader == 1 ? 2 : 1;
    // set next image
    current_img = current_img == images.length - 1 ? 0 : current_img + 1;
}
// load the first image 
load_image();

您可以看到此代码有效 here

有时候看不到进度条是因为图片加载速度太快了,当然如果你想用大图,就得把间隔拉大。

希望能帮到你。