惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

MongoDB | Blog
MongoDB | Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
小众软件
小众软件
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - Franky
博客园 - 聂微东
V
Visual Studio Blog
I
InfoQ
罗磊的独立博客
Security Latest
Security Latest
G
Google Developers Blog
博客园_首页
P
Proofpoint News Feed
T
Threat Research - Cisco Blogs
D
DataBreaches.Net
PCI Perspectives
PCI Perspectives
Forbes - Security
Forbes - Security
P
Proofpoint News Feed
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Know Your Adversary
Know Your Adversary
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Recent Commits to openclaw:main
Recent Commits to openclaw:main
The Cloudflare Blog
AWS News Blog
AWS News Blog
Latest news
Latest news
T
Tailwind CSS Blog
P
Palo Alto Networks Blog
Hugging Face - Blog
Hugging Face - Blog
云风的 BLOG
云风的 BLOG
Cyberwarzone
Cyberwarzone
T
The Exploit Database - CXSecurity.com
WordPress大学
WordPress大学
Recorded Future
Recorded Future
A
Arctic Wolf
V
Vulnerabilities – Threatpost
Security Archives - TechRepublic
Security Archives - TechRepublic
宝玉的分享
宝玉的分享
人人都是产品经理
人人都是产品经理
月光博客
月光博客
有赞技术团队
有赞技术团队
P
Privacy & Cybersecurity Law Blog
Scott Helme
Scott Helme
美团技术团队
Hacker News - Newest:
Hacker News - Newest: "LLM"
Jina AI
Jina AI
N
News and Events Feed by Topic
Attack and Defense Labs
Attack and Defense Labs

博客园 - netlynx2000

flex如何删除一个XML Node flex TabContainer 类实例化问题 一个追风筝的人,追寻着什么 flex加载Module遇到的问题 Action script如何复制一个Bitmap对象 Flex- 将Sprite控件添加到FLEX UI中 ex metadata tag 自定义flex中的事件 从EAI到SOA OMG工作流规范翻译 男人,信仰,爱,恨,人性 开源产品公司如何生存 拔拔草,开源与闭源 其实现在的我们也有很多梦想,比如低谷时想未来做一个什么样的公司,未来买什么样的豪宅。但是仅限于自我满足的想想,然后继续平庸的生活。 做事情的好习惯 使用Ajax读取aspx页面源代码 挣钱,买个照相机 友情提示的一个问题 苍天开眼,刘青云终于获奖了
如何一个Loader加载多个资源
netlynx2000 · 2008-03-06 · via 博客园 - netlynx2000

使用一个Loaderload资源时报错误

Title所提供的DisplayObject 必须为调用方的子级

的解决方案

Title

package com.asdia.comptest
{
 import flash.display.Bitmap;
 import flash.display.Loader;
 import flash.display.Sprite;
 import flash.events.Event;
 import flash.net.URLRequest;
 import flash.system.System;
 public class DisplayTesting extends Sprite
 {
  public var text:String ;
  private static var _loader:Loader= null;
  public function DisplayTesting()
  {
  

  }
  public function LoadImg():void{
   //_loader=new Loader();
   _loader=getLoaderIntance();
   _loader.contentLoaderInfo.addEventListener(Event.COMPLETE,showImg)
   if(_loader.content!=null){
    
    _loader.removeEventListener(Event.COMPLETE,showImg);
    _loader=null;
    _loader=getLoaderIntance();
   }
   
   _loader.contentLoaderInfo.addEventListener(Event.COMPLETE,showImg)
   _loader.load(new URLRequest("http://images.sohu.com/uiue/sohu_logo/beijing2008/2008sohu.gif"));
  }
  static public function  getLoaderIntance():Loader{
   if(_loader==null){
    _loader=new Loader();
    return _loader;
   }else{
    return _loader;
   }
  }
  private function showImg(event:Event):void{
   var image:Bitmap=_loader.contentLoaderInfo.content as Bitmap;
   
   this.addChild(image);
   trace(System.totalMemory);
  }
  
 }

}

posted on 2008-03-06 11:09  netlynx2000  阅读(409)  评论()    收藏  举报