我想从硬盘加载图像并显示在我的 Flash 电影中当我点击按钮时我的代码很少,它会打开超链接,所以任何人都知道图像加载功能
package{
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.net.navigateToURL;
import flash.net.URLRequest;
public class Main extends Sprite{
public function Main():void{
z_cst.addEventListener(MouseEvent.CLICK,buttonClick);
z_kp.addEventListener(MouseEvent.CLICK,buttonClick);
z_kr.addEventListener(MouseEvent.CLICK,buttonClick);
z_ka.addEventListener(MouseEvent.CLICK,buttonClick);
z_rs.addEventListener(MouseEvent.CLICK,buttonClick);
z_c.addEventListener(MouseEvent.CLICK,buttonClick);
z_vp.addEventListener(MouseEvent.CLICK,buttonClick);
z_cr.addEventListener(MouseEvent.CLICK,buttonClick);
z_cs.addEventListener(MouseEvent.CLICK,buttonClick);
}
private function buttonClick(e:MouseEvent):void{
var url:URLRequest=new URLRequest();
switch(e.target.name){
case "z_cst": url.url="http://www.star.com"; break;
case "z_kp": url.url="http://www.star.com"; break;
case "z_kr": url.url="http://www.star.com"; break;
case "z_ka": url.url="http://www.star.com"; break;
case "z_rs": url.url="http://www.gear.com"; break;
case "z_c": url.url="http://www.apple.com"; break;
case "z_vp": url.url="http://www.images.com"; break;
case "z_cr": url.url="http://www.buy.com"; break;
case "z_cs": url.url="http://www.contact.com"; break;
}
navigateToURL(url,"_blank");
}
}
}