资源描述:
《how to use an embedded text file in flash – trie edition》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、HowtouseanembeddedtextfileinFlash–Trieedition ThisscriptisthesameasHobeddedtextfileinFlashusingthemethoddescribedinTrieDataStructureinActionscript3 Youcantryitjustreplacingthemainfileinthesourceyoucandopublishingnogoingtomadesomeoptimizationandbenchmarking,andIllletyouknoindifferentsitua
2、tions.package { import flash.display.Sprite; import flash.text.TextField; import flash.text.TextFieldType; import flash.text.TextFormat; import flash.events.Event; public class bedded_text = nebedded_text(); var text_format:TextFormat = neat(); var letters:Array; var at.color=0x000000;
3、 text_format.size=24; text_field.setTextFormat(text_format); letters=[]; ent:*, index:int, arr:Array):void { add(element); } public function get(jumble:String):Array { var results:Array=[]; var root=letters[jumble.substr(0,1)]; if (! root) { return results; } getRec
4、ursively(jumble, 1, root, results); return results; } private function getRecursively(jumble:String,position:uint,root,results:Array):void { var letter:String=jumble.substr(position,1); var child=root.children[letter]; if (! child) { return; } if (child.ble.substr(0, posit
5、ion + 1)); } getRecursively(jumble, ++position, child, results); } public function add(word:String):void { var letter:String=word.substr(0,1); var root=letters[letter]; if (! root) { root=createNode(letter); letters[letter]=root; } addRecursively(word, 1, root); }
6、private function addRecursively(word:String,position:uint,root):void { if (position==word.length) { return; } var letter:String=word.substr(position,1); if (! letter) { return; } var child=root.children[letter]; if (! child) { child=createNode(letter); root.childr
7、en[letter]=child; } if (12下一页[感谢阅读这篇文章,..,]position==eanwhilestudythisone,resultandsourcecodeareuseless..上一页12[感谢阅读这篇文章,..,]