home *** CD-ROM | disk | FTP | other *** search
- class application.ui.DynamicTextField extends MovieClip
- {
- var holder;
- var format;
- var format1;
- var dynamicText;
- function DynamicTextField()
- {
- super();
- }
- function build(textW, textH, leftMargin, topMargin, s, holder)
- {
- this.holder = holder;
- this.format = new TextFormat();
- this.format.align = "left";
- this.format.color = 0;
- this.format.font = "Arial";
- this.format.leading = 0;
- this.format.size = 12;
- this.format1 = new TextFormat();
- this.format1.leading = 0;
- this.format1.align = "left";
- this.format1.color = 0;
- this.format1.font = "Arial";
- this.format1.size = 12;
- this.format1.url = "asfunction:onLinkPressed";
- this.createTextField("dynamicText",this.getNextHighestDepth(),leftMargin,topMargin,textW,textH);
- this.dynamicText.setNewTextFormat(this.format);
- this.dynamicText.embedFonts = true;
- this.dynamicText.wordWrap = true;
- this.dynamicText.selectable = false;
- this.dynamicText.multiline = true;
- this.dynamicText.html = true;
- this.dynamicText.border = false;
- var _loc5_ = this.splitString(s);
- this.dynamicText.htmlText = s;
- this.dynamicText.setTextFormat(this.format);
- var _loc2_ = 0;
- while(_loc2_ < _loc5_.length)
- {
- if(_loc5_[_loc2_].style == "format1")
- {
- var _loc6_ = _loc5_[_loc2_].text;
- var _loc4_ = _loc6_.split("<");
- _loc4_ = String(_loc4_[1]).split(">");
- _loc6_ = this.dynamicText.text;
- var _loc3_ = _loc6_.indexOf(String(_loc4_[1]));
- var _loc7_ = _loc3_ + String(_loc4_[1]).length;
- this.dynamicText.setTextFormat(_loc3_,_loc7_,this.format1);
- }
- _loc2_ = _loc2_ + 1;
- }
- s = "<textformat leading=\'0\'>";
- s += this.dynamicText.htmlText;
- s += "<textformat>";
- this.dynamicText.htmlText = s;
- var _loc9_ = this.format.getTextExtent(this.dynamicText.text,textW);
- if(_loc9_.textFieldHeight <= 60)
- {
- this.dynamicText._y = 7;
- }
- else
- {
- this.dynamicText._y = 0;
- }
- }
- function setHolder(holder)
- {
- this.holder = holder;
- }
- function onLinkPressed()
- {
- this.holder.onButtonRelease(this);
- }
- function splitString(s)
- {
- var _loc2_ = [];
- var _loc5_ = s.indexOf("<a",0);
- var _loc3_ = s.indexOf("a>",_loc5_);
- if(_loc5_ != 0)
- {
- _loc2_[0] = {begin:0,end:_loc5_,style:"format",text:s.substr(0,_loc5_)};
- _loc2_[1] = {begin:_loc5_,end:_loc3_ - _loc5_ + 2,style:"format1",text:s.substr(_loc5_,_loc3_ - _loc5_ + 2)};
- if(_loc5_ + (_loc3_ - _loc5_ + 2) != s.length)
- {
- _loc2_[2] = {begin:_loc3_ + 2,end:s.length - (_loc3_ + 2),style:"format",text:s.substr(_loc3_ + 2,s.length - (_loc3_ + 2))};
- }
- }
- else
- {
- _loc2_[0] = {begin:0,end:_loc3_ + 2,style:"format1",text:s.substr(0,_loc3_ + 2)};
- _loc2_[1] = {begin:_loc3_ + 2,end:s.length - (_loc3_ + 2),style:"format",text:s.substr(_loc3_ + 2,s.length - (_loc3_ + 2))};
- }
- return _loc2_;
- }
- }
-