<script type="text/javascript"> /*<![CDATA[*/ if(top.location != self.location){ top.location = self.location; } var myref = encodeURIComponent("http://hi.baidu.com/longth%5Flang/blog/item/43faf3c39578393de5dd3bab%2Ehtml"); /*]]>*/ </script> /*<![CDATA[*/ #usrbar{padding:4px 10px 3px 0;font-size:12px;height:19px;line-height:19px;color:#000000;font-family:Arial;text-align:right;background:#ffffff;filter:alpha(opacity=65);-moz-opacity:0.5;width:auto !important;width:100%;letter-spacing:normal} #usrbar a,#usrbar a:link,#usrbar a:visited{color:#0000CC;text-decoration:underline} #ft{clear:both;height:20px;line-height:20px;color:#666666;font-size:12px;font-family:Arial;text-align:center} #ft a,#ft a:link,#ft a:visited{color:#7777CC;text-decoration:underline} #usrbar,#usrbar a,#usrbar a:link,#usrbar a:visited,#ft,#ft a,#ft a:link,#ft a:visited{letter-spacing:normal} /*]]>*/
百度空间 |
百度首页 <script type="text/javascript"> document.write('| <a href="https://passport.baidu.com/?login&tpl=sp&tpl_reg=sp&u=http://hi.baidu.com' + encodeURIComponent('/longth%5Flang/blog/item/43faf3c39578393de5dd3bab%2Ehtml') + '" οnclick="BdUtil.relogin(); return false;">登录</a>'); </script> |
登录
<script type="text/javascript"> BdUtil.ns_tracker("usrbar","nm_20091208_topNavClick"); </script> <script type="text/javascript"> function set_cookie_4_bdtip(index/* start from one */, value){ var bdtip = document.cookie.match(/(^| )BDTIP=([^;]*)(;|$)/); if(!bdtip){ bdtip=new Array(index); for(var i=0,n=bdtip.length;i<n;i++) { if(bdtip[i]=="" || bdtip[i]==null) bdtip[i]=0; if(i == index - 1){ bdtip[i] = value; } } }else{ bdtip = bdtip[2].split('-'); if(index > bdtip.length) bdtip.length= index; for(var i = 0, j = bdtip.length; i < j; i ++){ if(bdtip[i]=="" || bdtip[i]==null) bdtip[i]=0; if(i == index - 1){ bdtip[i] = value; } } } bdtip = bdtip.join('-'); document.cookie = "BDTIP=" + bdtip+ ";expires=Wed, 28-Nov-37 01:45:46 GMT;path=/;"; } </script>
向TileList中动态添加图片
2009-05-17 14:28
最近想用Flex3做一个扑克牌游戏,于是选用了TileList控件作为显示窗口。可是如何才能将图片绑定到控件上呢,官方的例子中用的是mxml标签的形式:
<mx:dataProvider> <mx:Array> <mx:Object label="Nokia 6630" icon="{phone1}"/> <mx:Object label="Nokia 6680" icon="{phone2}"/> <mx:Object label="Nokia 7610" icon="{phone3}"/> <mx:Object label="Nokia LGV" icon="{phone4}"/> <mx:Object label="Nokia LMV" icon="{phone5}"/> </mx:Array> </mx:dataProvider> 但是想动态改变数据源用上面的方式是很麻烦的,因此在官方有给出了用ActionScript的方式:
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="450"> <mx:Script> <![CDATA[ import mx.collections.*; import mx.controls.Image; private var catalog:ArrayCollection; private static var cat:Array = [ "../assets/Nokia_6820.gif", "../assets/Nokia_3595.gif", "../assets/Nokia_3650.gif", "../assets/Nokia_6010.gif" ]; /* Initialize the HorizontalList control by setting its dataProvider property to an ArrayCollection containing the items parameter. */ private function initCatalog(items:Array):void { catalog = new ArrayCollection(items); myList.dataProvider = catalog; } ]]> </mx:Script> <!-- A four-column HorizontalList . The itemRenderer is a Flex Image control. When the control is created, pass the cat array to the initialization routine. --> <mx:HorizontalList id="myList" columnWidth="100" rowHeight="100" columnCount="4" itemRenderer="mx.controls.Image" creationComplete="initCatalog(cat)" /> </mx:Application> 要想改变图片的大小可以修改columnWidth和rowHeight属性即可。
|
类别:Flex3 |
|
添加到搜藏 |
分享到i贴吧 | 浏览(
76 ) |
评论 (0) <script> /*<![CDATA[*/ var pre = [true,'关于Flex3中的dataProvider', '关于Flex3中的dataProvider','/longth%5Flang/blog/item/b3cab032800352f01a4cff98.html']; var post = [true,'用java写的语法分析程序','用java写的语法分析程序', '/longth%5Flang/blog/item/aa21fb113b0c74f4c3ce79b7.html']; if(pre[0] || post[0]){ document.write('<div style="height:5px;line-height:5px;"> </div><div id="in_nav">'); if(pre[0]){ document.write('上一篇:<a href="' + pre[3] + '" title="' + pre[1] + '">' + pre[2] + '</a> '); } if(post[0]){ document.write('下一篇:<a href="' + post[3] + '" title="' + post[1] + '">' + post[2] + '</a>'); } document.write('</div>'); } /*]]>*/ </script>
/*<![CDATA[*/ #in_related_doc a { text-decoration:none; } /*]]>*/ <script type="text/javascript"> /*<![CDATA[*/ function HI_MOD_IN_RELATED_DOC_CALLBACK(arg){ if(arg.length <= 1) return false; var hasMore = arg[0]; var D=function(A,B){A[A.length]=B;} if(arg.length % 2 == 0) D(arg, ["","","",""]); var html = ['<div id="in_related_doc"><div class="tit">相关文章:</div>']; D(html, '<table cellpadding="0" cellspacing="3" border="0">'); for(var i = 1, j = arg.length; i < j; i += 2){ D(html, '<tr>'); D(html, '<td width="15px"><a style="font-size:25px" >•</a></td><td><a href="http://hi.baidu.com/' + arg[i][3] + '/blog/item/' + arg[i][2] + '.html" target="_blank" title="' + arg[i][0] + '">' + arg[i][1] + '</a>'); D(html, new Array(10).join('/u3000')); D(html, '</td>'); if(arg[i + 1][0] != "") D(html, '<td width="15px"><a style="font-size:25px" >•</a></td><td><a href="http://hi.baidu.com/' + arg[i + 1][3] + '/blog/item/' + arg[i + 1][2] + '.html" target="_blank" title="' + arg[i + 1][0] + '">' + arg[i + 1][1] + '</a></td>'); else D(html, '<td> </td><td> </td>'); D(html, '</tr>'); } if(hasMore) D(html, '<tr><td colspan="4"><a target="_blank" href="/sys/search?pageno=1&type=7&sort=1&word=%CF%F2TileList%D6%D0%B6%AF%CC%AC%CC%ED%BC%D3%CD%BC%C6%AC&item=43faf3c39578393de5dd3bab">更多>></a></td></tr>'); D(html, '</table></div><div class="line"> </div>'); var div = document.getElementById('in_related_tmp'); if(div){ div.innerHTML = html.join(''); while(div.firstChild){ div.parentNode.insertBefore(div.firstChild, div); } div.parentNode.removeChild(div); } window.setTimeout("tracker_init('in_related_doc')",100); } if(RelatedDocData == -1){ // not supported xhr var script = document.createElement('script'); script.type = 'text/javascript'; script.src = '/sys/search?type=8&word=%CF%F2TileList%D6%D0%B6%AF%CC%AC%CC%ED%BC%D3%CD%BC%C6%AC&item=43faf3c39578393de5dd3bab&t=' + new Date().getTime(); document.getElementsByTagName('HEAD')[0].appendChild(script); }else if(RelatedDocData == null){ GetAndEval = true; }else{ eval(RelatedDocData); } /*]]>*/ </script>
最近读者:
<script> var g_spAnnony=true; var g_read=[ {} ]; g_read.length=g_read.length-1; var _rh1=""; var _rh2=""; function wrreader(){ _rh1 += '<table width="100%" ><tr>'; _rh2+='<tr>'; if(g_spAnnony){ _rh1+='<td align="center" width="10%" ><img border="0" width="55" height="55" src="https://i-blog.csdnimg.cn/blog_migrate/54406254f9eed4e545f11f701d50c07e.jpeg"></td>'; _rh2+='<td> </td>'; if(g_read.length>0){ _rh1+='<td align="left" width="12%">'; }else{ _rh1+='<td align="left" width="100%">'; } _rh1+='<a href="https://passport.baidu.com/?login&tpl=sp&tpl_reg=sp&u='+myref+'" target="_self" οnclick="BdUtil.relogin(); return false;">登录</a>后,您就出现在这里。</td>'; _rh2+='<td> </td>' } if(g_read.length==0){ if(!g_spAnnony){ _rh1+='<td align=left width="100%">最近还没有登录用户看过这篇文章……</td>'; _rh2+='<td> </td>'; } }else{ for(i=0,len=g_read.length;i<len;i++){ _rh1+='<td align="center" valign="bottom" width="10%" class="user"><a href="/'+g_read[i][0]+'" target="_blank" class="ucard" pid='+g_read[i][1]+'><img border="0" src="http://himg.baidu.com/sys/portraitn/item/'+g_read[i][1]+'.jpg"></a></td>'; _rh2+='<td align="center" valign="top" class="user"><a href="/'+g_read[i][0]+'" target="_blank" class="ucard" pid="'+g_read[i][1]+'">'+g_read[i][2]+'</a></td>'; } } _rh1+='<td width="100%"></td></tr>'; _rh2+='<td></td></tr></table>'; document.write(_rh1+_rh2); } wrreader(); </script>
| 登录 后,您就出现在这里。 | |
| | |
<script> allkey=allkey+"6033150094a2d2071c95833d_43faf3c39578393de5dd3bab_"; </script>
<script> function initBlogTextForFCK(){ //fck init music if(window.Node){Node.prototype.replaceNode=function(Node){this.parentNode.replaceChild(Node,this);}} var imgBox=document.getElementsByName('musicName'); var isAutoPlay=true; for(var i=0,n=imgBox.length;i<n;i++){ var img=imgBox[i]; if(img.getAttribute('rel')){ var musicSrc=img.getAttribute('rel'); var musicDiv = document.createElement("SPAN"); var tmp=musicSrc.substr (musicSrc.indexOf('#')+1, 1); var tmpAutoPlay=(tmp=='1'); if(isAutoPlay&&tmpAutoPlay){ isAutoPlay=false; tmpAutoPlay=true; }else{ tmpAutoPlay=false; } var shtml=creatbgmusic(musicSrc.substr(0,musicSrc.indexOf('#')),1,true,false,tmpAutoPlay,tmpAutoPlay,'FckMusicHelper'); shtml=shtml.replace('width=100%','width=200').replace('width="100%"','width=200 height=45'); img.replaceNode(musicDiv); musicDiv.innerHTML=shtml; i--;n--; } } //document.getElementById('blog_text').style.display=''; } initBlogTextForFCK(); </script> <script> <!-- var hstr="/longth%5Flang/brwstat?key1=1"; document.write("<script src='"+hstr+"&key2="+allkey+"'><//script>"); //--> </script>
©2010 Baidu
<script> if(document.getElementById("m_blog")) { var imgarray = document.getElementById("m_blog").getElementsByTagName('img'); var imgw = document.getElementById("m_blog").offsetWidth; imgw =imgw-40; for(var i=0; i<imgarray.length; i++){ if(imgarray[i].className=="blogimg" && imgarray[i].width>=imgw) { imgarray[i].width=imgw; } } } // Fix ff bugs var blog_text = document.getElementById('blog_text'); blog_text.innerHTML = blog_text.innerHTML.replace(/href/s*=/s*("|')?(/././//././/)/gi,"href=$1../$2"); gotoreply(); </script>
![](http://c.baidu.com/c.gif?t=6&p=3)
<script type="text/javascript"> /*<![CDATA[*/ var Session = Session||{}; baidu._sp_extend(Session,{ spaceURL: "/longth%5Flang", pageURL: "http://hi.baidu.com/longth%5Flang/blog/item/43faf3c39578393de5dd3bab%2Ehtml", isHost: "", userName: "longth_lang", userNameEnc: "longth%5Flang", visitorPortrait:'00000000', visitorName: "", visitorURL: "/index.html", // refer: "http://www.google.cn/search?hl=zh-CN&source=hp&q=ActionScript+TileList+Icon&aq=f&aqi=&aql=&oq=", spBasicURL:"longth_lang", spBasicURLEnc:"longth%5Flang", isDrag: false }); baidu.space.mycard.init( {cancle: Session.isDrag} ); baidu.space.mycard.bind('m_blog',Session.visitorPortrait); /*]]>*/ </script>