一个Loader加载多个swf

      as3.0专区 2008-7-4 8:9

着几天在群里有人问关于能不能通过一个loader来装载多个swf当时我想可能能实现吧,经过晚上的研究的出一下结果,那就是一定没有问题,呵呵不说废话了.
通过调试器观察.........发现Loader.content属性为空时.才能够正确地加载一个swf.否则会抛出"提供的 DisplayObject 必须是调用者的子级错误"
偏偏Loader.content是只读属性,不能认为改变.....
没办法,只好利用它的报错功能,来实现一个一个Loader加载多个swf,不过始终觉得有点不完美....两次加载,还扑捉异常
不知道这捕捉异常的消耗能不能抵上重新创建一个Loader,呵呵,有兴趣的人可以研究研究

                      if(loader.content != null)
                       
{
                                
try
                                
{
                                        loader.load(request);
                                }

                                
catch(error:Error)
                                
{
                                        
//trace("出错...." + error);
                                }

                        }

                        
//再次加载
                        loader.load(request);


标签集:TAGS:
回复Comments() 点击Count()

回复Comments

{commentauthor}
{commentauthor}
{commenttime}
{commentnum}
{commentcontent}
作者:
{commentrecontent}