与网站加载图像加载 [英] Image load with site load

查看:118
本文介绍了与网站加载图像加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我进行简单的网站,但我有一个小麻烦,加载图像。你可以用新的类别看有新形象。这里有一个问题,仅东阳然后IMG加载,我要加载所有图像时,我的网站加载。 样品code我如何与IMG的工作。

Hello I make simple site but I have a little trouble with loading images. As you can see with new category there is new image. There is a problem, beacause only then img is loading, and I want to load all images when my site is loading. sample code how I operate with those img.

imgUrls.push("img/01.jpg");
imgUrls.push("img/02.jpg");
var k3:Boolean=false;

btn1.addEventListener(MouseEvet.CLICK, clickFunc);
function clickFunc(e:MouseEvent):void
if (k3==false)
{
    img1.myUILoader.source = imgUrls[0];
    k3=true;

}else
{
    img2.myUILoader.source = imgUrls[0];
    k3=false;
}

btn2.addEventListener(MouseEvet.CLICK, clickFunc2);
function clickFunc2(e:MouseEvent):void
if (k3==false)
{
    img1.myUILoader.source = imgUrls[1];
    k3=true;

}else
{
    img2.myUILoader.source = imgUrls[1];
    k3=false;
}

所以我的问题是:?如何加载所有与网站的img

推荐答案

您code目前正在告诉程序加载图片时,无论 BTN1 BTN2 点击。你需要告诉程序加载图像马上,用户输入之前,则有 BTN1 BTN2 显示它们

Your code currently is telling the program to load the images when either btn1 or btn2 is clicked. You need to tell the program to load the images right away, before user input, then have btn1 and btn2 display them.

这篇关于与网站加载图像加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆