Home
Home Page
Processing of tags html in TextField
Web 2.0 for designers
That in exchange
Keshirovanie registrations
Semantic web. A note about logical and illogical imposition
XHTML, speak?
Lessons of ASP-technologies
Often asked questions (FAQ) about ASP
Complex  regular expressions
Receptions of network defense on PHP
Receptions of network defense on PHP - 2
Development objective orientirovannosti PHP
Banner business
Use Output Buffering in PHP
Use Output Buffering in PHP
Doloj procedural programming, you allow object-oriented!
How to learn{find out}, whence there came visitors
Links


Processing of tags html in TextField


It is ready to argue, that almost everyone who worked with text fields in Flash'?, have paid attention that they are able "to understand" some html-tags. For the same who has missed this moment, we shall lead{we shall carry out} brief digression.


At dynamic substitution of the text in TextField there is an opportunity to set formatting of his{its} separate fragments. For this purpose it is necessary to specify, that in a text field html-tags should be processed. To make it it is possible in two ways: inclusion of button Render text as HTML or the instruction{indication} in Action Script imja_tekstovogo_polja.html=true;. Specifying what text it should be displayed in a text field, to address it is necessary to property htmlText, instead of text.




For example, the code for a conclusion in Action Script looks fat italics of the name of operational system as follows:

// We admit{allow}, that the text field is called txt

txt.html=true;

txh.htmlText = ' <b> <i> Mac OS X </i> </b> ';


Text fields support the following html-tags with all their attributes:

<a>, <b>, <br>, <u>, <i>, <font>, <li>, <p>, and since version Flash MX 2004 the tag <img> is supported.



Magic tag from Macromedia


Whether founders Flash'? have heard numerous entreaty, whether have guessed, that the above-named tags insufficiently - it is not known. But it is for certain known, that the tag <textformat> has appeared. He possesses various properties for adjustment of spaces of the text, interlin`jazha and positions of tabulation. All of them are in details enough described in the standard help, us positions of tabulation most of all interest.


To set positions it is possible, having written down their values in property of a tag tabstops:

<textformat tabstops = ' [30,70,80] '>

Values of spaces are considered from a left edge of a text field in pixels.


That the text in this tag was displayed by columns, it is necessary to separate each following recording in line from previous a symbol of tabulation, and every line to stop a tag of carry of a line (<br>). Macromedia advises to use for tabulation a combination simolov t, that, certainly, logically, but it is not absolutely convenient at dynamic data transfer in Flash. Ctoit only to think of the same stripslashes (), and me throws in cold sweat.


Fortunately, Flash supports one more tag which developers - <tab> have held back. From his{its} name it is possible to understand, that function of a tag consists in replacement of a symbol of tabulation. Doloj stripslashes () and cold sweat!



The tables which have been written down HTML


Cummiruja all vysheprevedennoe we shall make a code which will deduce{remove} such table on the screen:




1. In the first the staff we shall create a text field with the switched on properties multiline and Render text as html. A field we shall name txt.




2. In actions the first staff we shall write down the following code:

head = " <b> <i> ¹ <tab> the Name <tab> the Price </i> </b> <br> ";

line1 = " 1 <tab> EHpikurejstvo <tab> years 20 <br> ";

line2 = " 2 <tab> Riches <tab> soul <br> ";

line3 = " 3 <tab> the Image <tab> 127 Kb <br> ";

total = " <tab> <i> Total: </i> <tab> Eternity ";

txt.htmlText = " <textformat tabstops = ' [20,170] '> " +head+line1+line2+line3+total + " </textformat> ";


3. If now to start a roller in him the accurate tablet similar on above mentioned will appear.

4. Now it is possible to go and prepare all for tea. To me three spoons of sugar and half of lemon.



The spoon of tar and flank of honey


Advantages of a similar method of a conclusion of the information, undoubtedly, are high, but he{it} has also lack. In a cell there can be one line of the text and if the text appears more widely specified in <textformat> width of a cell he will simply shift to the right the text following it{him} which should be displayed in the next column. It is quite possible, that this lack can be bypassed, not selling soul to a devil, but me this method is meanwhile unknown.


At last I want to pay attention that by transfer of a html-code in Flash with use XML, it it is necessary to write tags of a transmitted code in format XHTML (to close unary tags, for example, <br/> or <img src = "pic.jpg"/>). Otherwise Flash cannot correctly distinguish a XML-file, and in fact it not to what we aspired all conscious life.



Prospects?


To deduce{remove} tables with the greater flexibility it is possible using component Flash MX 2004 DataGrid, but in that case the table you will not insert in the middle of the text. Also there are commercial and not absolutely components for drawing up and a conclusion of tables of a standard html-code, at which same lacks, as at DataGrid. Besides it is necessary to pay for the majority of them.


Let's hope, that the command of developers will think up something to facilitate a conclusion of the text with complete support XHTML as available source codes of similar things are sold for 40-50 dollars on site Macromedia Exchange;)