Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

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>
ÍƼöʹÓõÚÈýÖÖ·½·¨¡£


Ïà¹ØÎĵµ£º

flex Óë .net ½»»¥¡¾»ùÓÚWebServiceµÄÊý¾Ý·ÃÎÊ¡¿

 ·ÏÂÃæ½éÉÜFlexÓë.NETµÄWebServiceµÄÊý¾ÝͨÐÅ֪ʶµã;°üÀ¨Á¬½ÓWebService£¬Ô¶³Ìµ÷ÓÃWebService·½·¨£¬¸øWebService·½·¨´«µÝ²ÎÊýµÈÏà¹Ø֪ʶµã¡£
¡¡¡¡<mx:WebServiceid="dataService"
¡¡¡¡¡¡¡¡wsdl="http://localhost/FlashFlex/DataWebService.asmx?wsdl"
¡¡¡¡¡¡¡¡useProxy="false">
¡¡¡¡¡¡¡¡<mx:ope ......

FLEXÁ÷³ÌÉè¼ÆÆ÷£¨Ðò£©

   ¹¤×÷Á÷Ó¦ÓÃÔÚÆóÒµÐÅÏ¢»¯½¨ÉèÖÐÔ½À´Ô½À´ÆÕ¼°£¬¶øÇÒÓû§³£³£ÒªÇó×Ô¼º¿ÉÒÔÔÚÒ»¶¨³Ì¶È¸ù¾Ý×Ô¼ºÒµÎñÐèÇó¶ÔÁ÷³Ì½øÐÐÐ޸ġ£¶øÎÒÃÇÒÔÇ°×öÁ÷³ÌÉè¼ÆÆ÷¶¼ÊÇ»ùÓÚC/Sģʽ£¬ÕâÑù¾ÍÔì³ÉÓû§ÔÚʹÓõÄʱºòÐèÒªÀ´»ØÇл»Á½¸öϵͳ£¬¶øÇÒÕâÖּܹ¹²»ÀûÓÚ³ÌÐòͳһÉý¼¶¡£ËùÒÔÎÒ´òË㿪·¢Ò»¸ö»ùÓÚFlexµÄÁ÷³ÌÉè¼ÆÆ÷¡£ ´ÓÒÔÍù¾­ÑéÀ´¿´£¬×ö± ......

flex ͼ±íʹÓðٷֱÈʾÀý

<?xml version="1.0"?>
<!-- charts/PredefinedAxisStyles.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

<mx:Script>
<!--[CDATA[
//µ¼ÈëÏà¹Ø°ü
import mx.collections.ArrayCollection;
import mx.charts.*;
import mx.charts.ser ......

¡¾¿ª·¢¡¿²âÊÔÇý¶¯µÄFLEX¿ª·¢ ʹÓÃFLEXUNIT

http://elromdesign.com/blog/2010/03/10/test-driven-development-tdd-with-flexunit-4-complete-tutorial/
±¾À´ÊÇ´òËãÍêÕûµÄ·­ÒëÍê³ÉÕâƪ²©Îĵģ¬Ò»±ß·­Ò룬һ±ß̸̸×Ô¼º¶ÔÇý¶¯²âÊÔ¿ª·¢µÄÀí½â¡£ µ±È»ÎÒµÄÀí½âºÍÔ­ÎÄ×÷ÕßµÄÀí½â²»Ò»¶¨Ò»Ñù£¬µ«ÊÇÖÁÉÙ£¬ÎÒÃǶ¼³ÐÈÏ¿ª·¢µÃÊDzâÊÔÇý¶¯µÄ¡£ È»¶øCSDNµÄ²©¿ÍϵͳÊÇʵÔÚ²»ÄÜÀí½â¡¾Î ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ