473,785 Members | 2,887 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

NEED SOME HELP HERE... embedded fonts, css, xml, textfields, dynamic content

2 New Member
I'm dying here trying to figure this out for days.
Here's the scenario:

1) External script.as file dynamically imported to loader.swf file that creates a textfield

(createTextFiel d)
2) Content for the text field should be provided by an XML file
3) Content styled by external css file
4) Fonts need to be embedded so as to apply anti-alias

I can get the XML & CSS to apply to the text field, but can't get the content to use the embedded font. It

usually comes back "undefined" if the embedded font works. Otherwise, when I comment out the embed font, the

content work, but of course, not the anti-aliasing. Ugh. I've tried doing all kinds of forum searches, but

nothing has clarified this for me. I'm intermediate at AS and this is something new to me. Any help will be

GREATLY appreciated and I will send good juju your way.
Here's a sampling of some of the script I have been using:

ACTIONSCRIPT:

mf = new TextFormat();
mf.font = "arial_font ";
Stage.scaleMode = "noScale";

this.createText Field("news_txt ", 99, 50, 50, 450, 300);
news_txt.border = true;
news_txt.html = true;
news_txt.multil ine = true;
news_txt.wordWr ap = true;
news_txt.embedF onts = true;
news_txt.autoSi ze = true;
news_txt.setNew TextFormat(mf);


// Load CSS
var styles:TextFiel d.StyleSheet = new TextField.Style Sheet();
styles.load("he ading.css");

// Load XML apply to headingText
var banner_xml:XML = new XML();
banner_xml.igno reWhite = true;
banner_xml.onLo ad = function(succes s:Boolean):Void {
if (success) {
news_txt.styleS heet = styles;
news_txt.text = banner_xml;
} else {
trace("Error loading XML.");
}
};
banner_xml.load ("heading.xml") ;



XML:

<story>
<title></title>
<mainBody>
<heading>Headin g Text</heading>
<tagline>Clev er tagline goes here</tagline>
</mainBody>
</story>



CSS:

heading {
color:#000000;
font-family:"Frankli n Gothic Book", Arial, sans-serif;
display: block;

font-size: 50pt;
margin: 0px;
padding: 0px;
letter-spacing: -5px;
}

tagline {
color:#000000;
font-size: 20pt;
font-family:"Frankli n Gothic Book", Arial, sans-serif;
display: block;
font-weight: bold;
}

So, if I turn off the xml/css and use htmlText to create content for the text field, the text uses the

embedded font and is anti-aliased. If I keep the xml/css but comment out embedFonts, then the content works

but is not anti-aliased. I need both of these to work at the same time. PLEASE HELP!!

peace
Jun 28 '07 #1
1 5617
xNephilimx
213 Recognized Expert New Member
I'm dying here trying to figure this out for days.
Here's the scenario:

1) External script.as file dynamically imported to loader.swf file that creates a textfield

(createTextFiel d)
2) Content for the text field should be provided by an XML file
3) Content styled by external css file
4) Fonts need to be embedded so as to apply anti-alias

I can get the XML & CSS to apply to the text field, but can't get the content to use the embedded font. It

usually comes back "undefined" if the embedded font works. Otherwise, when I comment out the embed font, the

content work, but of course, not the anti-aliasing. Ugh. I've tried doing all kinds of forum searches, but

nothing has clarified this for me. I'm intermediate at AS and this is something new to me. Any help will be

GREATLY appreciated and I will send good juju your way.
Here's a sampling of some of the script I have been using:

ACTIONSCRIPT:

mf = new TextFormat();
mf.font = "arial_font ";
Stage.scaleMode = "noScale";

this.createText Field("news_txt ", 99, 50, 50, 450, 300);
news_txt.border = true;
news_txt.html = true;
news_txt.multil ine = true;
news_txt.wordWr ap = true;
news_txt.embedF onts = true;
news_txt.autoSi ze = true;
news_txt.setNew TextFormat(mf);


// Load CSS
var styles:TextFiel d.StyleSheet = new TextField.Style Sheet();
styles.load("he ading.css");

// Load XML apply to headingText
var banner_xml:XML = new XML();
banner_xml.igno reWhite = true;
banner_xml.onLo ad = function(succes s:Boolean):Void {
if (success) {
news_txt.styleS heet = styles;
news_txt.text = banner_xml;
} else {
trace("Error loading XML.");
}
};
banner_xml.load ("heading.xml") ;



XML:

<story>
<title></title>
<mainBody>
<heading>Headin g Text</heading>
<tagline>Clev er tagline goes here</tagline>
</mainBody>
</story>



CSS:

heading {
color:#000000;
font-family:"Frankli n Gothic Book", Arial, sans-serif;
display: block;

font-size: 50pt;
margin: 0px;
padding: 0px;
letter-spacing: -5px;
}

tagline {
color:#000000;
font-size: 20pt;
font-family:"Frankli n Gothic Book", Arial, sans-serif;
display: block;
font-weight: bold;
}

So, if I turn off the xml/css and use htmlText to create content for the text field, the text uses the

embedded font and is anti-aliased. If I keep the xml/css but comment out embedFonts, then the content works

but is not anti-aliased. I need both of these to work at the same time. PLEASE HELP!!

peace
I was having the very same problem, I think it's caused by Flah's poor HTML parsing. It only allows certain tags, like <b>, and <a>, unordered list's, paragraphs and I think that's all, if you have content in other tags, like <i> the text won't be displayed. Also sometimes the font you choose is not properly displayed, Trebuchet MS is one that works alright, but it's kinda random. The solution I managed is to make a function to rebuild the HTML tags, since Flash sometimes wrecks it all up, and up till now it works fine.

This is the AS part of an app I've been working in, it's a relevant search:

Expand|Select|Wrap|Line Numbers
  1. Stage.scaleMode = "noScale";
  2.  
  3. var home:MovieClip = this;
  4. var searching:Boolean = false;
  5. var totalresults:Number = 0;
  6.  
  7. var xml:XML = new XML();
  8. xml.ignoreWhite = true;
  9. xml.onLoad = parseXML;
  10.  
  11. buscar.onRelease = function() {
  12.     search(q.text);
  13. }
  14.  
  15. function search(str:String) {
  16.     searching = true;
  17.     clearLastSearch();
  18.     xml.load("rs-xml.php?q=" + str);
  19. }
  20.  
  21. function parseXML() {
  22.     if(searching) {
  23.         var nodes:Array = xml.firstChild.childNodes;
  24.  
  25.         for (i = 0; i < nodes.length; i++) {
  26.             var titulo:String = nodes[i].firstChild.firstChild;
  27.             var texto:String = nodes[i].childNodes[1].firstChild;
  28.             var relev = nodes[i].childNodes[2].firstChild;
  29.  
  30.             var r:MovieClip = attachMovie("result","r"+i,i);
  31.             r._x = 35 + r._width/2;
  32.             r._y = 150 + (r._height*i);
  33.             r.titulo.text = titulo;
  34.             r.texto.htmlText = rebuildHTML(String(texto));
  35.             r.relev.text = "Relevancia: " + relev + "%";
  36.  
  37.             totalresults = (i+1);
  38.         }
  39.     }
  40. }
  41.  
  42. function clearLastSearch() {
  43.     for(i = 0; i < totalresults; i++) {
  44.         home["r"+i].removeMovieClip();
  45.     }
  46. }
  47.  
  48. function rebuildHTML(theText:String):String {
  49.     var tempText:String = theText;
  50.     var chunks:Array = new Array();
  51.  
  52.     chunks = tempText.split("&lt;");
  53.     tempText = chunks.join("<");
  54.     chunks = tempText.split("&gt;");
  55.     tempText = chunks.join(">");
  56.     chunks = tempText.split("&amp;");
  57.     tempText = chunks.join("&");
  58.  
  59.     chunks = tempText.split("href=&quot;");
  60.     tempText = chunks.join("href=\"");
  61.     chunks = tempText.split("&quot;>");
  62.     tempText = chunks.join("\">");
  63.     return tempText;
  64. }
  65.  
There are some spanish words in it, sorry about that, I'm from Argentina...
"texto" means text, "buscar" means serch, "relevancia " means "relevance" , sorry if I missed some.

I hope it serves to you.
Jun 29 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1895
by: Philip | last post by:
Hi, I am trying to output certain nodes inside another. I have an xml template with field definitions for a form, and this includes textfields, labels, checkboxes etc plus fieldssets. I defined them like this: >>>> XML SNIPPET >>>> <fields>
4
4250
by: Clive Everett | last post by:
I thought it would be rather fun to try out @font-face, but I cannot get it to work. I used Microsoft WEFT to generate several embedded fonts and find that the example below works when I use my Win XP development machine as both the browser and Web server. However if I try to display the same page from another machine (Mac OS X, Win 2000, or Win XP) using the Win XP development machine as the Web server then I get the default font...
13
1613
by: Joe Black | last post by:
Just to inform you guys that i have only like 2 weeks that i took my first classes in c++, and my proffesor now is asking me to solve this problem: /// Using a function create a Win32 Console Application which outputs asterisks (*)on the screen displaying your name like a matrix screen. it has to be in a top down-design style. PLS HELP THIS AMATEUR STUDENT. *_* if you can help me just send the source code... even that i cant do that...
3
2136
by: marsandys | last post by:
Hello, I have this code below, which I am trying to have it send HTML formatted mail with embedded images. I can get this to send the mail, but it spits out a bunch of junk . I know this should be pretty simple, but I have been pulling my hair out for hours with this. :/ Can someone smart pleaseeee help me tweak this code to work? <?php // Read POST request params into global vars
1
1778
by: Hasani \(remove nospam\) | last post by:
The way the system works is, you create a user control (ascx) that will be a template and must implement the interface IPageTemplate. You then create one or more user controls (ascx) that implement the IPageContent interface. A page (aspx) must then be created that loads (using Page.LoadControl) the page template, and the page content. The page content adds itself to the page template. The page template is then added to the aspx's control...
10
1489
by: pcthug | last post by:
Hi All, I am creating multi-tier app in vb.net using visual studio .net. I create a invoice.vb class file with properties, events and methods. This also has a line item collection class (lineitem.vb & lineitems.vb). I create a form (form1.frm) and write the corresponding code to initialize an invoice object, there are textboxes on the form to display the data, an update and load button. My data is stored in an access database.
20
4285
by: mike | last post by:
I help manage a large web site, one that has over 600 html pages... It's a reference site for ham radio folks and as an example, one page indexes over 1.8 gb of on-line PDF documents. The site is structured as an upside-down tree, and (if I remember correctly) never more than 4 levels. The site basically grew (like the creeping black blob) ... all the pages were created in Notepad over the last
6
1944
blazedaces
by: blazedaces | last post by:
Hey, so here's an example of what I want to do: This "window" if you will, or simple gui, will accept an ArrayList<String> and in turn spit out for every one of them a checkbox and a text field where you can rename it to whatever name you chose (later I'll add something to check and make sure none of the names are the same... but for now it doesn't matter). I'm not very familiar with GUI in java so I don't know the best way of doing this. ...
0
2847
by: richard12345 | last post by:
Hi Guys I have problem with site I am building. The sidebar with menu and other thinks is overlapping footer. The footer move with the content and but it dos it dos not move with the sidebar. Here is the website: holtz-realty And also the html file and css file. Anny help will by mostly appreciated. I did try everything I can think of. HTML:
0
10330
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10153
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10093
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9952
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8976
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7500
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.