Categories Displayed in Flash

Flash: 4 XML and TextField tips

Tip1:

Which converting back and forth between XML and Objects (e.g parsing), you can't use E4X like primitives e.g.


if(xml.@someAttribute != null) //won't work


Use


if(xml.hasOwnProperty("@someAttribute"){


instead.

Tip2:

Similar when comparing XML nodes you should probably convert it to a string first e.g.


switch(xml.@name.toString()) {

case "config":....

Tip3:

When dealing with TextFields and you to embed text into the fla, but want to scroll a textfield, and avoid loading text. By default the textfield will maximize to fit the size of whatever text is pasted into it, making it hard to layout

A solution is to use two dynamic TextFields, one for the scrolled display, the other a text holder, just paste the text into that making it as big as needed, then hiding it and copying the first textfield. via


body_txt.htmlText = hideMe_txt.text;
hideMe_txt.visible = false;

Tip4:

embed fonts with textfields in a layer masked by another layer with a graphic not over the clip. That way you can be sure what your getting, when working on the Timeline you will see everything, but when published it won't be visible. You can also and get precise letters, rather than embedding the entire font family in the library.

Add a Comment: