FlexÖÐImage¼ÓÔØͼƬ³ö´íʱÏÔʾĬÈÏͼƬµÄ¼¸ÖÖ·½·¨
FlexÖÐImage¼ÓÔØͼƬ³ö´íʱÏÔʾĬÈÏͼƬµÄ·½·¨Ö÷ÒªÓÐÒÔϼ¸ÖÖ£º
·½·¨Ò»£ºÀûÓà brokenImageSkin ·ç¸ñÏÔʾһ¸öĬÈϵÄͼ£¬Ö»ÐèÉèÖÃCSS¾ÍÐÐÁË£¬ÈçÏ£º
<mx:Style>
Image {
brokenImageSkin: Embed("assets/404.jpg");
}
</mx:Style>
·½·¨¶þ£º¼àÌýImage×é¼þµÄIOErrorEvent.IO_ERRORʼþ£¬´úÂëÈçÏ£º
private function errorHandler():void
{
image.source = "assets/404.jpg";
}
<mx:Image id="image" source="http://²»´æÔÚ.jpg" ioError="errorHandler()"/>
·½·¨Èý£º¼Ì³ÐImageÀ࣬¸²¸ÇÆäset source·½·¨£¬ÈçÏ£º
override public function set source(value:Object):void
{
if(!value || value == ""){
value = "assets/404.jpg";
}
super.source = value;
}
ÍƼöʹÓõÚÈýÖÖ·½·¨£¬ÒòΪµÚÒ»ÖÖ·½·¨¸úµÚ¶þÖÖ·½·¨Óиö¹²Í¬µÄȱµã£¬ÈçÏÂÇé¿ö£º
<mx:Image id="image" source="" ioError="errorHandler()"/>
´ËʱÎÞÂÛÊǵÚÒ»ÖÖ·½·¨»¹ÊǵڶþÖÖ·½·¨¶¼²»»áÏÔʾĬÈÏͼƬ£¬¶øµÚÈýÖÖ·½·¨¾Í¿ÉÒÔ½â¾öÕâ¸öÎÊÌâ¡£
µÚÈýÖÖ·½·¨¾ßÌåʵÏÖ¼°Ê¹Ó÷½·¨ÈçÏ£º
MyImage.as
package
{
import flash.events.IOErrorEvent;
import mx.controls.Image;
public class MyImage extends Image
{
private var defaultImage:String = "assets/404.jpg";
public function MyImage()
{
this.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
}
override public function set source(value:Object):void
{
if(!value || value == ""){
value = defaultImage;
}
super.source = value;
}
private function ioErrorHandler(event:IOErrorEvent):void
{
super.source = defaultImage;
}
}
}
Main.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:local="*">
<local:MyImage id="image" source=""/>
</mx:Application>
ÍƼöʹÓõÚÈýÖÖ·½·¨¡£
Ïà¹ØÎĵµ£º
²»¿É·ñÈÏMyEclipseÏÖÔÚÔ½×öԽǿ´ó£¨±Ï¾¹ÊÇÊշѵÄÂ£¬Ç¿´óµ½¿ªÊ¼ÅųâµÚÈý·½²å¼þ£¬ÕâÓÐЩ²»·ûºÏEclipseµÄ³õÖÔ£¬Eclipse¾ÍÊÇ¿¿Á¼ºÃµÄÀ©Õ¹ÐÔ·¢Õ¹ÆðÀ´µÄ¡£
MyEclipse´Ó7.5¿ªÊ¼£¨7.0ûÓùý£¬²»ÖªµÀ£©£¬ÍêÈ«¸Ä±äÁ˳ÌÐò½á¹¹£¬ÏÖÔÚÀ©Õ¹µÚÈý·½²å¼þ ÔÙҲûÓÐÒÔÇ°ÄÇô·½±ãÁË£¬ÌرðÊÇlink·½Ê½£¬Õâ¶Ô³ÌÐòÔ±À´ËµÊÇÖÂÃüµÄ¡£Flex Plugin ° ......
¹¤×÷Á÷Ó¦ÓÃÔÚÆóÒµÐÅÏ¢»¯½¨ÉèÖÐÔ½À´Ô½À´ÆÕ¼°£¬¶øÇÒÓû§³£³£ÒªÇó×Ô¼º¿ÉÒÔÔÚÒ»¶¨³Ì¶È¸ù¾Ý×Ô¼ºÒµÎñÐèÇó¶ÔÁ÷³Ì½øÐÐÐ޸ġ£¶øÎÒÃÇÒÔÇ°×öÁ÷³ÌÉè¼ÆÆ÷¶¼ÊÇ»ùÓÚC/Sģʽ£¬ÕâÑù¾ÍÔì³ÉÓû§ÔÚʹÓõÄʱºòÐèÒªÀ´»ØÇл»Á½¸öϵͳ£¬¶øÇÒÕâÖּܹ¹²»ÀûÓÚ³ÌÐòͳһÉý¼¶¡£ËùÒÔÎÒ´òË㿪·¢Ò»¸ö»ùÓÚFlexµÄÁ÷³ÌÉè¼ÆÆ÷¡£ ´ÓÒÔÍù¾ÑéÀ´¿´£¬×ö± ......
*****************************************************
1-0. °²×°ÅäÖù¤×÷»·¾³
*****************************************************
1.°²×°jdk1.6
ÉèÖû·¾³±äÁ¿:java_home,ÄÚÈÝΪjdk°²×°ºójdkËùÔÚĿ¼£¬²»ÊÇjreĿ¼
2.°²×°tomcal 6.0µ½d:\
3.°²×°myeclipse 6.5
4.°²×°firefox¼°²å¼þ
°²×°firefox
&nbs ......
ÎÒÒÔÇ°Ò»Ö±´ÓÊÂ×ÀÃ濪·¢£¬ÓÈÆäÊý¾Ý´¦ÀíµÄµÄϵͳ½Ï¶à¡£Ê¹Óý϶àµÄÊÇ¿ª·¢¹¤¾ßÊÇVFP£¬ËüÓÐ×Ô´øµÄÊý¾Ý¿â£¬Ò²¿ÉÒÔʹÓôóÐ͵ÄÊý¾Ý¿âϵͳ£¬¼È¿ÉÒÔ¿ª·¢ÏµÍ³Ò²¿ÉÒÔÓÃÃüÁîÐнøÐйÜÀíÊý¾Ý¡£µ«£¬ËüÔÚ²»¾ÃµÄ½«À´¾ÍMS²»ÔÙ¸§ÑøÕâ¸öÂòÀ´µÄ¶ù×ÓÁË£¬²Ù×÷µÄϵͳµÄ»»´úµÈµÈ¶àÖÖÒòËØÓ°Ï죬²»¹ÜËüÊÇ·ñ»áÏûÍü£¬µ«Ê¼ÖÕÒ²»á ......