Ultrashock Forums > Flash > ActionScript
AS2 - createTextField embed xml

You are currently viewing our website as a guest which gives you limited access to forums, files and other resources.

Click here to join now for free, and start interacting with our members, download files and much more!

Click here if you are looking for our Flash files and other professional assets.
 
Post Reply | View first unread | Rate Thread Search this Thread | Thread Tools | Display Modes

#1
Bookmark and Share!
AS2 - createTextField embed xml
Old 2008-02-20

Hello Everyone,

I tried finding a solution on the boards but had no success. I am creating a text field using AS and embedding the font; which works perfect. But when I go to import text from xml it does not work if the font is embedded.

Here is the AS code.

PHP Code:
// Create Text Field
        
this.createTextField("tLabel"this.getNextHighestDepth(), 200100200100);
        
tLabel.html true;
        
tLabel.embedFonts true;
        
//tLabel.htmlText = "hello";
        
        
//load XML
myXML = new XML();
myXML.ignoreWhite true;
myXML.onLoad = function(ok){
    
        
tLabel.htmlText this.lastChild.lastChild.lastChild.nodeValue;
    

}
myXML.load("info.xml");

//Text Format
var tfFormatter:TextFormat = new TextFormat();
        
tfFormatter.font "Arial";
        
tLabel.setTextFormat(tfFormatter); 
here is the XML code
PHP Code:
<?xml version="1.0" encoding="utf-8"?>
<text>
<mytext><![CDATA[Some text here<br><font color="#999999">hello1.</font>]]></mytext>
<mytext><![CDATA[Some text here<br><font color="#999999">hello2.</font>]]></mytext>
<mytext><![CDATA[Some text here<br><font color="#999999">hello3.</font>]]></mytext>
</text>
The font is in the library. Any ideas????
postbit arrow 2 comments | 2445 views postbit arrow Reply: with Quote   
Registered User
mehmet22 is offline
seperator
Posts: 282
2003-09-22
Age: 28
mehmet22 lives in United States
mehmet22's Avatar
seperator

Ultrashock Member Comments:
peter-II- peter-II- is offline peter-II- lives in United Kingdom 2008-02-21 #2 Old  
Slightly changed .as
Did you also export the font? Linkage - Export for Actionscript
Code:
// Create Text Field 
        this.createTextField("tLabel", this.getNextHighestDepth(), 200, 100, 200, 100); 
        tLabel.html = true;  
//load XML 
myXML = new XML(); 
myXML.ignoreWhite = true; 
myXML.onLoad = function(ok){ 
     
        tLabel.htmlText = this.lastChild.lastChild.lastChild.nodeValue; 
 	tLabel.setTextFormat(tfFormatter);
}

myXML.load("info.xml"); 

//Text Format
var tfFormatter:TextFormat = new TextFormat(); 
        tfFormatter.font = "Arial";
Hope that helps
Reply With Quote  
mehmet22's Avatar mehmet22 mehmet22 is offline mehmet22 lives in United States 2008-02-21 #3 Old  
Thanks peter II.
Works perfect.
Reply With Quote  
Thread Tools
Display Modes Rate This Thread
Rate This Thread: