- 授权协议: GPLv2
- 开发语言: ActionScript
- 操作系统: 跨平台
- 软件首页: http://code.google.com/p/htmlsprite/
- 软件文档: http://code.google.com/p/htmlsprite/wiki/Gettingstarted
软件介绍
htmlsprite 是一个 Flash 用来解析 HTML 文档的开发包。
示例代码:
import com.redurban.HTMLSprite
var htmlsprite:HTMLSprite = new HTMLSprite();
//
//static debug mode on/off
HTMLSprite.debug = true;
//
//Use this event when loading both stylesheet and html file
htmlsprite.addEventListener(HTMLSprite.LOADCOMPLETE, LoadComplete);
//
//This event will be dispatched when the rendering is complete
htmlsprite.addEventListener(HTMLSprite.RENDERCOMPLETE, RenderComplete);
//
//Use this event when loading a stylesheet file only
//Will be dispatched when the load is completed.
htmlsprite.addEventListener(HTMLSprite.STYLECOMPLETE, StyleComplete);
//
//Use this event when loading a external html file only,
//Will be dispatched when the load is completed.
htmlsprite.addEventListener(HTMLSprite.HTMLCOMPLETE, HtmlComplete);
//
//This event will be dispatched when an external link is click
//<a target="_blank" rel="nofollow" href="event:internalEvent">Example</a>
htmlsprite.addEventListener(HTMLSprite.LINK, Link);
// Example html file + css file
// htmlsprite.Load("html/indexwithoutcss.htm", "html/style.css");
// Example stylesheet file only
// htmlsprite.LoadStylesheet("html/style.css");
// Example html file only
// htmlsprite.Load("html/index.htm");
// Example html text + stylesheet text
var stylesheet:StyleSheet = new StyleSheet();
stylesheet.setStyle(".header",{fontFamily:"Arial",color:"#000000"});
stylesheet.setStyle("body",{fontFamily:"Arial"});
stylesheet.setStyle("div",{fontFamily:"Arial",fontSize:"20px",backgroundColor:"#efefef"});
htmlsprite.stylesheet = stylesheet;
htmlsprite.html = "Hello<br/>world!";
htmlsprite.Render();
//
// Link Listener
public function Link(evt:LinkEvent)
{
var linkType:String = evt.data.type;
var linkValue:String = evt.data.value;
var linkTarget:String = evt.data.target;
trace("linktype:"+linkType+",linkvalue:"+linkValue+",linktarget:"+linkTarget);
}
//
// Load Complete Listener
// It's important that you render the html after the stylesheet
// and html file has been loaded
public function LoadComplete(evt:Event)
{
htmlsprite.Render();
}
// Load Stylesheet Complete
// Do not use this listener when you use an external stylesheet AND external HTML.
// You can use then the LoadComplete Example
public function StyleComplete(evt:Event)
{
htmlsprite.html = "hello<br/>world";
htmlsprite.Render();
}
// Load HTML Complete
// Do not use this listener when you use an external stylesheet AND external HTML.
// You can use then the LoadComplete Example
public function HtmlComplete(evt:Event)
{
htmlsprite.stylesheet = stylesheet;
htmlsprite.Render();
}
// Render complete
// At this point it's safe to determine width and height of the sprite
// and add it to the displaylist
public function RenderComplete(evt:Event)
{
addChild(htmlsprite);
}
高效程序员的45个习惯
Venkat Subramaniam、Andy Hunt / 钱安川、郑柯 / 人民邮电出版社 / 2010-01 / 35.00元
“书中‘切身感受’的内容非常有价值——通过它我们可以做到学有所思,思有所悟,悟有所行。” ——Nathaniel T. Schutta,《Ajax基础教程》作者 “此书通过常理和经验,阐述了为什么你应该在项目中使用敏捷方法。最难得的是,这些行之有效的实战经验,竟然从一本书中得到了。” ——Matthew Johnson,软件工程师 十年来,软件行业发生了翻天覆地的变化。敏捷......一起来看看 《高效程序员的45个习惯》 这本书的介绍吧!
