Loading...

Archive for January, 2007

  1. Beats the Hell Out of Me
  2. Friends.I'll.Be.There.For.You.(Rembrandts)
  3. I wouldn't normally do this kind of thing
  4. Smelly Cat
  5. Summer
  6. View from the Other Side

《臭臭猫》

主打歌当然是《smelly cat》,不会唱这歌,别说你看过《friends》。

Smelly Cat, Smelly Cat, what are they feeding you?
Smelly Cat, Smelly Cat it's not your fault...
They won't take you to the vet
Your obviously not their favorite pet.
You may not be a bed of roses,
And your no friend of those with noses.
Smelly Cat, Smelly Cat, what are they feeding you?
Smelly Cat, Smelly Cat, it's not your fault!
小家伙,小家伙,他们喂你吃什么?
小家伙,小家伙,臭不是你的错。
病了要自己撑着,
没人管你的死活。
孤独的趴在角落,
永远不会有安乐的小窝。
小家伙,小家伙,他们给你吃什么?
小家伙,小家伙,臭不是你的错!
Read more...

Pages: 1 2 3 4 5 6 7 8 9 10

最近研究一个 Flash 应用, 希望在 DataGrid 中加入图标. 查阅 Flash Help , 其中提到了 List.iconField 和 List.iconFunction , 但我只在 List 组件中试验成功, 虽然帮助中说 DataGrid 也继承了 List 的这两个属性(DataGrid 继承自 List), 但最终也没有实现.

于是问了一下 Google 大师, 找到了这个例子(下载), 是利用 List.cellRenderer 实现的, 通过研究实例, 偶还实现了 DataGrid 中的进度条, 嘻嘻 :D

偶的例子: (下载)

源码:

DataGrid.fla

PLAIN TEXT >> ACTIONSCRIPT:
  1. /*
  2. * DataGrid 中图标和进度条的实现
  3. * Dofy
  4. * 20070130
  5. * dofyyu@gmail.com
  6. */
  7. // 可编辑(为了方便看效果, 可以直接修改进度和状态值观察控件变化)
  8. myGrid.editable = true;
  9. // 表头
  10. myGrid.addColumn("status");
  11. myGrid.addColumn("title");
  12. myGrid.addColumn("guage");
  13. // 显示
  14. myGrid.getColumnAt(0).headerText = "状态";
  15. myGrid.getColumnAt(1).headerText = "标题";
  16. myGrid.getColumnAt(2).headerText = "进度";
  17. // 宽度
  18. myGrid.getColumnAt(0).width = 70;
  19. myGrid.getColumnAt(1).width = 180;
  20. myGrid.getColumnAt(2).width = 100;
  21. // cell renderer
  22. /*
  23. * 这里要特别说明一下
  24. * 后面的 Icon 和 Guage 是库中的两个 MC
  25. * 在 Renderer 文件夹中
  26. * 这是两个 linkage name 分别是 Icon 和 Guage 的
  27. * 分别继承自 IconCellRenderer 和 PerCellRenderer
  28. * 这两个自定义类的空 MC
  29. * 在库中相应的元件上单击右键, 查看 "链接..." 项可以看到相关内容
  30. * ( 两个类的说明看 IconCellRenderer.as 文件 )
  31. */
  32. myGrid.getColumnAt(0).cellRenderer = "Icon";
  33. myGrid.getColumnAt(2).cellRenderer = "Guage";
  34. // data
  35. myGrid.addItem({status:"等待", title:"等待中的项目", guage:0});
  36. myGrid.addItem({status:"失败", title:"失败的项目", guage:70});
  37. myGrid.addItem({status:"完成", title:"完成的项目", guage:100});
  38. myGrid.addItem({status:"我咧", title:"pulapula项目", guage:30});
  39. // button
  40. btn_change.onRelease = function() {
  41.     myGrid.editField(0, "status", "完成");
  42.     myGrid.editField(0, "guage", "100");
  43. };

IconCellRenderer.as

PLAIN TEXT >> ACTIONSCRIPT:
  1. // 引入类
  2. import mx.core.UIComponent;
  3. // 创建继承自 UIComponent 的类
  4. class IconCellRenderer extends UIComponent {
  5.     var Icon:MovieClip;
  6.     function IconCellRenderer() {
  7.         // nothing
  8.     }
  9.     private function createChildren(Void):Void {
  10.         // 行被创建时触发
  11.         trace("创建");
  12.         Icon = createEmptyMovieClip("Icon", 1);
  13.         Icon.createTextField("txt", 2, 20, 0, 50, 20);
  14.         Icon.txt.selectable = false;
  15.     }
  16.     private function size(Void):Void {
  17.         // 单元格大小被改变时触发
  18.         trace("大小");
  19.         //Icon.setSize(16, 16);
  20.         Icon._x = 3;
  21.         Icon._y = 2;
  22.     }
  23.     private function setValue(str:String, item:Object, sel:Boolean):Void {
  24.         // 改变值时调用
  25.         // str 是绑定该 CellRenderer 的单元的值
  26.         // item 是整个行对象
  27.         Icon._visible = (item != undefined);
  28.         Icon.attachMovie(getIcon(item.status), "icon", 1);
  29.         Icon.txt.text = str;
  30.         size();
  31.     }
  32.     private function getIcon(str:String):String {
  33.         // 这是一自定义函数
  34.         switch (str) {
  35.         case "等待" :
  36.             return "icon_wait";
  37.         case "完成" :
  38.             return "icon_complete";
  39.         case "失败" :
  40.             return "icon_failed";
  41.         default :
  42.             return "icon_unknow";
  43.         }
  44.     }
  45. }

Here’s a sampling of what’s in the new version:

  • Autosave makes sure you never lose a post again.
  • Our new tabbed editor allows you to switch between WYSIWYG and code editing instantly while writing a post.
  • The lossless XML import and export makes it easy for you to move your content between WordPress blogs.
  • Our completely redone visual editor also now includes spell checking.
  • New search engine privacy option allows you take you to indicate your blog shouldn’t ping or be indexed by search engines like Google.
  • You can set any “page” to be the front page of your site, and put the latest posts somewhere else, making it much easier to use WordPress as a content management system.
  • Much more efficient database code, faster than previous versions. Domas Mituzas from MySQL went over all our queries with a fine-toothed comb.
  • Links in your blogroll now support sub-categories and you can add categories on the fly.
  • Redesigned login screen from the Shuttle project.
  • More AJAX to make custom fields, moderation, deletions, and more all faster. My favorite is the comments page, which new lets you approve or unapprove things instantly.
  • Pages can now be drafts, or private.
  • Our admin has been refreshed to load faster and be more visually consistent.
  • The dashboard now instantly and brings RSS feeds asynchronously in the background.
  • Comment feeds now include all the comments, not just the last 10.
  • Better internationalization and support for right-to-left languages.
  • The upload manager lets you easily manage all your uploads pictures, video, and audio.
  • A new version of the Akismet plugin is bundled.

-- 转自 WordPress.org

司文 - 太刺激2007(饭特稀版)
作词:徐琦 作曲/编曲:司文

天苍苍 野茫茫
风吹草低狼爱上羊
东风破 花田错
群星夜宴找替裸
郭德刚 黄建祥
搞笑石头最疯狂
李宇春 周笔畅
我行我秀有师洋
菊花飞 战鼓擂
满城尽带黄金甲尽是大波妹
霍霍霍霍霍霍霍霍
他不是一个人 他不是一个人
霍霍霍霍霍霍霍霍
你是愿意听啊还是愿意听
吼吼吼吼吼吼吼吼
洗刷刷 洗刷刷
吼吼吼吼吼吼吼吼
崩溃 崩溃啊! Read more...

T-Shit !

by Dofy

T-Shit!

Blog 时间长了, Archives 栏越来越长, 眼看着 sidebar 超过了 content 的长度, 实在观之不雅, 怎么办? 别急, WordPress 早就内置了将 Archives 以 option 形式输出的功能了, 具体操作如下:

进入 WordPress 后台, 选择 Presentation 项, 再进入 Theme Editor 编辑你当前使用的样式, 在侧栏中选择 Sidebar 然后搜索 "<h2>Archives". 默认情况下 Archives 下的代码为:

PLAIN TEXT >> HTML:
  1. <li><h2>Archives</h2>
  2.     <ul>
  3.     <?php wp_get_archives('type=monthly'); ?>
  4.     </ul>
  5. </li>

我们要做的是将代码修改为(参考注释):

PLAIN TEXT >> HTML:
  1. <li><h2>Archives</h2>
  2.     <ul>
  3.     <!-- 添加 select 标签, 并设置 onchange 的动作 -->
  4.     <select onchange="location.href=this.value;">
  5.     <!-- 添加一个空行, 以便于选中列表中的第一项 -->
  6.     <option value="">--------------</option>
  7.     <!-- 增加 format 参数, 值为 option -->
  8.     <?php wp_get_archives('type=monthly&format=option'); ?>
  9.     <!-- select 结束标签 -->
  10.     </select>
  11.     </ul>
  12. </li>

看, 我们的 Sidebar 是不是清爽了很多 :D

Next Page »