-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest.txt
116 lines (88 loc) · 5.5 KB
/
test.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
const htmlStr:String="<font size=25 color=0x360112><b>T-STUDIO[唐]</b></font>"+
"<p>官网:<a href='http//:www.tang-studio.com'>http//:www.tang-studio.com</a><br/>"+
"博客:<a href='http://blog.sina.com.cn/tangstudio2012'>http://blog.sina.com.cn/tangstudio2012</a></p>"+
"<img width='180' height='180' src='assets/images/logo.jpg'/>"+
"<p><br/>T-STUDIO[唐]互媒创意工作室是一家新锐的商业互动媒体设计及品牌形象推广机构,<br/>"+
"始终从市场的角度及客户的需求出发,<br/>"+
"为企业提供全方位、多领域的创意设计服务。<br/>"+
"帮助企业和产品从硝烟弥漫的商战中脱颖而出,成为业界翘楚。</p>"
var TLF1:TLFControlSprite= TLFControlSprite.fromHTML(htmlStr,null,350);
addChild(TLF1);
TLF1.addEventListener(TLFFlowEvent.LINK_TOUCHED,linkTouched);
//TLF1.showBoundaries = true;
////////////////////////////////////////////////////////////////////////////////////////////////////
//xml标签布局方法:onLinkTouched不支持====================================================================
////////////////////////////////////////////////////////////////////////////////////////////////////
//<--TextFlow的xml用法可以去adobe官方参考
const xmlStr:String='<TextFlow lineBreak="toFit" whiteSpaceCollapse="preserve" xmlns="http://ns.adobe.com/textLayout/2008">' +
'<p><span color="#000000" fontSize="30" fontWeight="bold">T-STUDIO[唐]</span><a href="http//:www.tang-studio.com">http//:www.tang-studio.com</a>' +
'<img width="180" height="180" source="assets/images/logo.jpg"/></p></TextFlow>'
var TLF2:TLFControlSprite = TLFControlSprite.fromTextLayout(xmlStr,null,350);
TLF2.y =400;
addChild(TLF2);
////////////////////////////////////////////////////////////////////////////////////////////////////
//load外部html文件布局方法===========================================================
/////////////////////////////////////////////////////////////////////////////// /////////////////////
//<--onComplete和onLinkTouched使用------------------------------------------------------
TLFControlSprite.loadFromHtmlTextLayout("assets/textLayout/htmlLayout.html",null,350).onComplete(function(tlf01:TLFControlSprite):void{
tlf01.x = 400;
addChild(tlf01);
}).onLinkTouched(linkTouched);
//<--update使用-------------------------------------------------------------------------
TLFControlSprite.loadFromHtmlTextLayout("assets/textLayout/htmlLayout02.html",null,350).update(function(tlf02:TLFControlSprite):void{
if(!contains(tlf02)){
tlf02.x = 400;
tlf02.y = 400;
addChild(tlf02);
}
}).onLinkTouched(linkTouched);
//<--linkTouched-----------------------------------------------------------------------------------
function linkTouched(e:TLFFlowEvent):void{
var linkElm:LinkElement = e.data as LinkElement;
trace("link:"+linkElm.href);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
//load外部html文件布局方法:onLinkTouched不支持=======================================================
////////////////////////////////////////////////////////////////////////////////////////////////////
//<--onComplete和onLinkTouched使用------------------------------------------------------
TLFControlSprite.loadFromXMLTextLayout("assets/textLayout/xmlLayout.xml",null,350).onComplete(function(tlf03:TLFControlSprite):void{
tlf03.x = 750;
tlf03.y = 15;
addChild(tlf03);
});
//<--update使用-------------------------------------------------------------------------
TLFControlSprite.loadFromXMLTextLayout("assets/textLayout/xmlLayout2.xml",null,350).update(function(tlf04:TLFControlSprite):void{
if(!contains(tlf04)){
tlf04.x = 750;
tlf04.y = 400;
addChild(tlf04);
}
});
////////////////////////////////////////////////////////////////////////////////////////////////////
//feathersUI组件上的用法=======================================================
////////////////////////////////////////////////////////////////////////////////////////////////////
// <--直接使用--------------------------------------------------------------
var sTLFs01:TLFControlSprite = TLFControlSprite.fromHTML(htmlStr,null, 400);
var scrollContainer:ScrollContainer = new ScrollContainer();
//iTLFs2.showBoundaries = true;
//iTLFs2.oversizeClickArea = true;
//iTLFs2.overSizeInPx = 10;
scrollContainer.width = 410;
scrollContainer.height = 200;
addChild(scrollContainer);
scrollContainer.addChild(sTLFs01);
sTLFs01.addEventListener(TLFFlowEvent.READY,function(e:TLFFlowEvent){
scrollContainer.addChild(sTLFs01);
sTLFs01.addEventListener(TLFFlowEvent.LINK_TOUCHED,onLinkTouched);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////
//<--超链接扩展方法:当你不使用“TLFFlowEvent.LINK_TOUCHED”-----------------------------------------------
sTLFs02.addEventListener(TouchEvent.TOUCH,onTxtInSCTouch);
function onTxtInSCTouch(e:TouchEvent):void
{
var touches:Vector.<Touch> = e.touches;
if(touches[0].phase == TouchPhase.BEGAN){
sTLFs.hitLinkDetection(touches[0].globalX-sc.x+sc.horizontalScrollPosition,touches[0].globalY-sc.y+sc.verticalScrollPosition);
}
}