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

推荐订阅源

The Register - Security
The Register - Security
云风的 BLOG
云风的 BLOG
U
Unit 42
F
Fortinet All Blogs
The GitHub Blog
The GitHub Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
D
Docker
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
S
Secure Thoughts
Hacker News: Ask HN
Hacker News: Ask HN
Vercel News
Vercel News
S
Security @ Cisco Blogs
GbyAI
GbyAI
Stack Overflow Blog
Stack Overflow Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
I
Intezer
MongoDB | Blog
MongoDB | Blog
AI
AI
MyScale Blog
MyScale Blog
Engineering at Meta
Engineering at Meta
Y
Y Combinator Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
P
Proofpoint News Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
W
WeLiveSecurity
博客园 - 叶小钗
S
SegmentFault 最新的问题
N
News | PayPal Newsroom
WordPress大学
WordPress大学
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
D
DataBreaches.Net
小众软件
小众软件
Microsoft Azure Blog
Microsoft Azure Blog
Spread Privacy
Spread Privacy
H
Help Net Security
美团技术团队
博客园 - 司徒正美
T
Threat Research - Cisco Blogs
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
K
Kaspersky official blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
V
Vulnerabilities – Threatpost
TaoSecurity Blog
TaoSecurity Blog
N
Netflix TechBlog - Medium
L
Lohrmann on Cybersecurity
J
Java Code Geeks
量子位
Martin Fowler
Martin Fowler
博客园_首页

博客园 - GIS小能

利用Simplify进行ArcGIS Server多面合并查询 关于Flex Ant的相关注意事项 ArcGIS KeyGen注册机,五步操作实现ArcGIS9.X与ArcGIS10全模块无时限破解(转载:我是一只牛) Flex开发必知(1) ArcGIS Server 10 问题汇总 ArcGIS Server 10 许可文件 Ecp 基于flex及SVG技术打造交互式地图(数据篇) 将应用程序从Flex 3迁移至Flex 4(转载) ArcGIS 10 破解安装(desktop及ArcGIS Server 10) 基于Geoserver配置多图层地图以及利用uDig来进行样式配置 基于ArcGIS Server 10 在flex瓦片客户端叠加瓦片服务 胡说八道--mate flex 优化原则 flex与flash交互详解 flex调用WMS远程图片所产生安全错误 loder导致的安全沙箱的2122错误 flex一周精选(20100308) 解析MapBar兴趣点加载原理 Flex一周精选(20100301)
浅谈Image和Bitmap
GIS小能 · 2010-02-22 · via 博客园 - GIS小能

记得刚学flex的时候,常常被Image和Bitmap、Bitmapdata搞得七荤八素的,现在看来,其实如果只想简单应用,其实也是很简单的:
Image  ---- 可视化控件
Bitmap ---- 通常我们所见的文件,如jpg,gif
BitmapData  ---- 从字面上也可以理解了,同时看看官方的解释:可以看作是加载的或动态创建的位图图像中包含的像素的照片快照。此快照用对象
中的像素数据的数组表示。BitmapData 类还包含一系列内置方法,可用于创建和处理像素数据。
因此,从以下代码也可以看出bitmap和bitmapdata的关系

var myBitmapDataObject:BitmapData = new BitmapData(150150false0xFF0000);
var myImage:Bitmap 
= new Bitmap(myBitmapDataObject);
addChild(myImage);

那么常用的图像加载方式主要有以下几种:

代码

<?xml version="1.0" encoding="utf-8"?>   
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete="InitApp()">   
    
<mx:Script>   
        
<!--[CDATA[   
           
            
//第一种方式 这种方式编译以后1.jpg 会直接编译进swf文件中 所以swf可以独立存在   
            [Bindable]   
            [Embed(source
="1.jpg")]   
            
private var imgClass:Class;   
               
            
//第2种方式   
            private var _loader:Loader;   
               
            
private function InitApp():void{   
                   
                
//第一种方式的代码   
                _img.source = imgClass;   
                   
                
//第二种方式的代码   
                _loader = new Loader();   
                
//这里需要注意的是 不是_loader.addEventListener  这样是没有效果的   
                _loader.contentLoaderInfo.addEventListener(Event.COMPLETE,function(e:Event):void{   
                 
//source既可以指向地址,也可以直接指向位图
                    _img.source = e.currentTarget.content;   
                });     
                _loader.load(
new URLRequest(encodeURI("1.jpg")));   
                   
                   
                
//第三种方式比较简单   
                _img.source = "1.jpg";  //注意这里必须设置img autoLoad属性为true   
                   
                
//最后说明 其中第2 第3种方式中swf都不能独立存在 必须配合1.jpg文件的存在 而第一种方式则不需要   
            }   
        ]]
-->   
    
</mx:Script>   
    
<mx:Image x="51" y="62" width="298" height="245" autoLoad="true" id="_img"/>   
</mx:Application>