网络软件系统工具应用软件图形图像多媒体类免费游戏安全相关免费音乐网页素材 电子书籍考试考题建站源码
教育教学多媒体类编程开发操作系统游戏天地娱乐天地简历求职站长专区网页设计安全技术图形图像文学驿站
业界资讯 | 图形图像 | 操作系统 | 网络冲浪 | 工具软件 | 办公软件 | 媒体动画 | 精文荟萃 | 认证考试 | 网页设计 | 技术开发 | 专栏
当前位置:热点网络学院媒体动画Director【Director教程】属性列表应用一则
精品推荐
热点TOP10
·Director生成文件减肥技巧
·用Director控制动画GIF
·Director怎样制作自定义光标
·利用director.ini调试应用程序
·director使用mui xtra创建对话框
·director应用技巧
·Director中控制声音音量的几种方法
·DIRECTOR去背技法步步高
·Director 3D 基础(之七)
·Director 3D 基础(之六)
·Director 3D 基础(之五)
·Director 3D 基础(之四)
·Director 3D 基础(之三)
·Director 3D 基础(之二)
·Director 3D 基础(之一)
·Director制作《七巧板》游戏
·【Director教程】lists的使用一则
·【Director教程】属性列表应用一则
·【Director教程】创建随机列表
·【Director教程】解析文本和列表
【Director教程】属性列表应用一则
日期:2006年10月15日 作者: 查看:[大字体 中字体 小字体]
(只是想为多媒体的发展尽一份力。以下是翻译director online 上的一篇关于属性列表的文章,觉得简单有用,所以给大家共享。动机单纯。-------alalala)


  问题
  我需要做一个分类搜索引擎,应用于我的数据列表。列表大概如下:


gdatalist=[[#name:”amanda”,#surname:”allard”,#department:”banking”,#phone:”7777”],_
[#name:”peter”,#surname:”jedrasicak”,#department:”b.i.s”,#phone:”7014”],[#name:”_
neil”,#surname:”cooper”,#department:”marketing”,#phone:”7012”]]

  用户需要填写姓名,然后用搜索键搜索。

  回答
  首先,我把荣誉归给Tab Julius 的书《lingo!》,它教会了我关于lists的知识。这是一本非常不错的书。

  对列表进行分类会使搜索速度加快。一旦进行分类,它就会保留这种性质。窍门在于创建一个有用的索引。

  对你的列表进行分类,你需要做一个复合列表并保证编入列表的数据的索引名称具有唯一性。注意,一旦编好搜索规则你就不能临时改变。所以,用名(first name)来做索引是一个坏的选择,因为可能会出现两个同名的人。用姓(last name)来做选择也不是一个好主意,因为你还是不能保证数据的唯一性。
 
  让你的用户同时输入名(first name)和姓(last name),我假定这样做会保证是唯一的数据------考虑如果在同一办公室出现同名同姓的人,一定会做一下区别(figuring that if there is a coincidence of names at an office one of the \"Bill\"s would be listed as a William.)。我们将用名(first name)和姓(last name)来做索引,将他们转换为复合的记号。如下


set gdatalist=[#jonesbill:[#name:”bill”,#surname:”jones”,#dept:”executive”,#phone:”_
7777”], #AllenWendy:[#name: \"Wendy\", #surname: \"Allen\", #dept: \"Executive\", #Phone: \"_
1234\"], #JedrasicakPeter: [#name: \"Peter\", #surname: \"Jedrasicak\", #dept: \"BIS\", #Phone:_
\"7014\"]]

  现在,对列表排序,只需增加“sort gdatalist”.这会让列表按字母顺序排列,并且以后新增加的也是。


Sort gdatalist
Put gdatalist

  这样,列表就会按字母顺序排列。现在,如果你的用户分别在域“姓(last neme)”和域“名(first name)”输入姓(last name)=”jones”和名(first name)=”bill”,并且按下了搜索键


on mouseup
set comboname=the text of field “inputlast” & the text of field “inputfirst”
set lookup=symbol(comboname)

if voidp(findpos(gdatalist,lookup)) then
alert”此人不在数据库中”
else
set mydatalist=getaprop(gdatalist,lookup)

put the name of mydatalist into field “displayname”
put the surname of mydatalist into field “displaysurname”

end if
end

  很快,是不是。
  注意,如果用户按下了enter或space或return,那将会影响到lookup事件。因此,用keydownscript来忽略他们。


On startmovie
Set the keydownscript to “filterspaces”
End

On filterspaces
Case the key of
“ ”,enter,return
dontpassevent
end case
end

  如果数据量太大,不妨试试v12database xtra(好象是付费的)。

(出处:http://www.vipcn.com

关于我们 | 帮助(?) | 版权声明 | 友情连接 
Copyright 2005-2005 viphot.com All Rights Reserved.
Powered by:mesky