Images Embedded Within Dynamic TextField Not Printing
Not sure if there's already a thread on this, but my issue is that images that are embedded within a dynamic textfield via XML are not showing up when I try to print using PrintJob. The images are showing up properly within the textfield on the screen, but not in the print preview (and of course not in the final print).
The print functionality is fairly straight forward, I have a MovieClip that contains one dynamic textfield. The textfield is populated by XML and CSS files.
ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0
Posted on: 04-23-2008, 02:47 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Dynamic Textfield - Embedded Font - Embedded Characters Problem
Hi everyone,
In AS in flash 8, i'm doing the following : a font "Garamond" in my library,creating a textfielda textformat that is used on my textfieldi define the characters that should be embedded...
This last point doesn't seem to work...
This is my code (you can also check my fla) :
--
var myFormat = new TextFormat();
myFormat.font = "Garamond";
myFormat.size = 20;
myFormat.color = "0xFFFFFF";
createEmptyMovieClip("myContainer",10);
myContainer.createTextField("myText", 11, 0,0,400,500);
myContainer.myText.border=true;
myContainer.myText.autoSize = true;
myContainer.myText.html = true;
_root.myContainer.myText.embeddedCharacters = "ęąłńśźćóĘĄŁŃŚĆŻÓ";
myContainer.myText.htmlText = "test characters : : ęąłńśźćóĘĄŁŃŚĆŻÓ" ;
myContainer.myText.selectable = false;
myContainer.myText.wordWrap = true;
myContainer.myText.embedFonts = true;
myContainer.myText.setTextFormat(myFormat) ;
--
I was also trying with the following :
myContainer.myText.useDeviceFonts = true;
But without problem (otherwise I wouldn't email here, huh?)
Can someone tell me what i'm doing wrong that my embeddedCharacters don't seem to work?
Thanks in advance!
Greetz,
Dzjoepke
Printing A Dynamic TextField
I have a dynamic text field with a UIScrollbar. I am have problems with printing the content of the textField. If I set the print function to print the textField I get the following error -
TypeError: Error #1034: Type Coercion failed: cannot convert flash.text:
Any help would be welcome
Printing A Dynamic TextField
I have a dynamic text field with a UIScrollbar. I am have problems with printing the content of the textField. If I set the print function to print the textField I get the following error -
TypeError: Error #1034: Type Coercion failed: cannot convert flash.text:
Any help would be welcome
Printing A Dynamic TextField
I have a dynamic text field with a UIScrollbar. I am have problems with printing the content of the textField. If I set the print function to print the textField I get the following error -
TypeError: Error #1034: Type Coercion failed: cannot convert flash.text:
Any help would be welcome
Printing A Dynamic TextField
I have a dynamic text field with a UIScrollbar. I am have problems with printing the content of the textField. If I set the print function to print the textField I get the following error -
TypeError: Error #1034: Type Coercion failed: cannot convert flash.text:
Any help would be welcome
Dynamic Textfield Printing And Linking
I have a dynamic textfield which i fill with HTML-text from an XML-file. This exceeds one page, and I would like to print it on several pages. How can I do this, when I use printjob.start it only prints one page...? And is it possible to track a word that is clicked? (to use as a link to other pages..)
Printing Dynamic Textfield Content
There have been some topics with this title but none of them seems to solve the problem of printing the dynamic text content which is by the way also a scrollable text. I manage to print only what is seen but not the whole text.
Is there anyone who could help. I am attaching my fla which is used only for testing purposes.
Thank you in advance
http://www.galahala.com/print2.zip
Dynamic Textfield Printing And Linking
I have a dynamic textfield which i fill with HTML-text from an XML-file. This exceeds one page, and I would like to print it on several pages. How can I do this, when I use printjob.start it only prints one page...? And is it possible to track a word that is clicked? (to use as a link to other pages..)
Printing All Text In A Dynamic Scrollable Textfield
Hi,
I have search alot about solutions for solving the problem about trying to print all text in a dynamic Scrollable Text. There is no answer for this. So, is there a simpel way to print all the text in a dynamic scrollable textfield?
Because the text is dynamic, there is possible that the text can be 1- 100 pages.
Please help me out.
niklas@bafe.nuniklas@bafe.nu
One Dynamic Textfield And Two Colors Or Embedded Fonts?
I am loading Text into my swf.
Works fine so far, but i would need to have two different fonts in one dynamic textfield or use two colors (hopfully easier then fonts) in one dynamic text filed.
I am filling the dynamic field like this:
info_info1 = menu_cfg_xml.firstChild.childNodes[kindProduktzahl].attributes.info1 + menu_cfg_xml.firstChild.childNodes[kindProduktzahl].attributes.info2;
I would like the first part from the xml to be one font or color and the second part (after the +) to be a different font or color.
Thanks in advance!
dex
Position Image Embedded In Dynamic Textfield
Hi all,
Well after searching through the net and forums here and not finding any answer about my query I'm posting it over here.
I have a dynamic text field called a_txt on stage.
And following code
Code:
a_txt.html=true;
a_txt.htmlText="<p>Currently there exists a temporary <p><img src='ico.jpg' height='25px' width='25px'></p>setup to compile the documents in to a self running CD (flash presentation).
So basically I'm embedding an image in the dynamic textfield, which is html enabled using img tag.
However the img sticks either to the left or right border of the textfield (by using align attribute of img).
But if I want to place the image anywhere between the text, tht's not possible.
can anybody help?
Thanks
[MX04] Printing All Text In A Dynamic Scrollable Textfield
Hi,
I have search alot about solutions for solving the problem about print all text in a dynamic scrollable textfield. There is no answer for this. So, is there a simpel, or any way to print all the text in a dynamic scrollable textfield? Not just the text you see on the screen.
Because the text is dynamic, there is possible that the text can be 1-100 printing pages long. So please don't tell me to resize the textfield to match textsize height.
Please help me out.
Dynamic & Static TextField Embedded Font + CSS + HTML, Please Help
Hi Everyone;
ActionScript 3.0 + Flash 9
I'm having trouble with embedded fonts and dynamic textfields when static text is on the stage using the same font.
From the many forums across the net, I've been able to figure out that the problem has something to do with the fact that static text-fields embed the font they are using, but only the characters used in the fields ... and that when i style dynamic text using CSS, the font-family declaration picks up the font embedded for the static fields instead of the one I added to the library.
What I'm doing seems to be pretty strait forward -- yet it just isn't working... Someone please help.
Here's the test scenario:
in the library I've added a 'CG' font class of "Century Gothic" and exported for actionscript in 1st frame;
on the stage are static textfields using "century gothic" (logo + nav)
on the stage is a dynamic textfield that loads simple html content from external files: i.e. "<h1>title</h1><p>content</p>...",
this textfield is styled using a simple stylesheet 'h1 { font-family: "Century Gothic"; font-size:16pt... } p { font-family: "Century Gothic"; font-size: 12pt;...} ...'
dynamic textfield.embedFonts = true;
= dynamic content doesn't show up at all.
If i change the css to use a different embedded font than the one used by the static field everything works fine.
I have to use css because the content has multiple styles (different sizes, colors, etc.), using TextFormat would be a joke.
I have the use the same font for all text because I want the site to be cohesive.
I don't want to change all my static textfields to dynamic textfields because even with embedded fonts & antialiasing, some monitors display dynamic text very poorly, and for something like the logo I want to make sure its nice & quality.
There has to be workaround of some kind. The only thing I've come up with is going into photoshop and creating gif's for each of my static text fields - which seems like a rediculous hack.
Oh FYI, I've tried adding a static & dynamic textfield (with embedded font) off stage with all characters needed - didn't work.
there has to be a way to use an embedded font for dynamic fields that is also used by static fields, i mean common.
ANY help please, thanks.
Dynamic HTML Textfield Renders Blank With Embedded Font
OK, here's the problem:
I want to create paragraphs in a flash movie using dynamic textfields, with HTML formatting. It mostly does the job, but when I set the Textfields to embedFonts = true (so that the text format is the same as the static text in the movie) the text fails to render and I am left with blank boxes. Here's the function I am using:
code:
function createDynamicTemplate() {
_root.createEmptyMovieClip("pageTemplate", 100)
_root.pageTemplate._x = bounds.left;
_root.pageTemplate._y = bounds.top;
var paras = _root.tuts[_root.currentTutorial.name].Body["Page"+_root.currentTutorial.page].attributes.Paragraphs;
var tf = _root.subTitle.subTitle.getTextFormat(1, 2)
for (var i = 0; i<paras; i++) {
var str = checkForTags(_root.tuts[_root.currentTutorial.name].Body["Page"+_root.currentTutorial.page]["Paragraph"+(i+1)][_root.language]);
_root.pageTemplate.createTextField("paraTxt" + (i+1), i + 100, 0, 0, 470, 10)
_root.pageTemplate["paraTxt" + (i+1)]._x = 0
_root.pageTemplate["paraTxt" + (i+1)]._y = _root.pageTemplate["paraTxt"+(i)]._height + 20
_root.pageTemplate["paraTxt" + (i+1)].type = "dynamic"
_root.pageTemplate["paraTxt" + (i+1)].html = true
_root.pageTemplate["paraTxt" + (i+1)].autoSize = true
_root.pageTemplate["paraTxt" + (i+1)].multiline = true
_root.pageTemplate["paraTxt" + (i+1)].wordWrap = true
_root.pageTemplate["paraTxt" + (i+1)].setTextFormat(tf);
_root.pageTemplate["paraTxt" + (i+1)].htmlText = str;
_root.pageTemplate["paraTxt" + (i+1)].embedFonts = true
}
}
The textFormat I use is taken from a dynamic text box (with embedded fonts) already in the movie. If I comment out the "_root.pageTemplate["paraTxt" + (i+1)].embedFonts = true" line then the text shows but obviously not with the required font.
Any ideas how to fix this or is it a known bug?
Cheers for any help.
Vector Printing Of TextField. Part Of TextField Not Printing.
Hi, I hope somebody here can help me.
I have a movieclip with a dynamic textField in it.
I set autoSize = "center" and fill it with text.
Then, if i then use PrintJob.addPage("myPage", {printAsBitmap:false}); , the bottom few lines of the textfield don't print. (The textField shows up fine on the screen.)
The textField shows up fine if I use {printAsBitmap:false}, allbeit in lower quality.
If anyone can make a dynamic textField print properly as vector, please lemme know.
thx,
miguel3d
Printing Dynamic Images
Hi,
I have problem in priting images in Flash. Functionaliy goes this way.
1. There is an xml file cotaining the name of the images and path (/images/xyz.jpg).
2. User can see one image at a time and navigate through next and back buttons
3. There is a print button, clicking on which should print all the images at one go.
Anyone having solution for this one. Here is enclosing a source file describing the problem. I have written few functions and thats how I managed to get dynamic contents printed. But if I use same logic for images it just fails.
Any suggessions would be highly apprecaited.
Thanks in advance
------------
aShISH
[MX04] Embedded Images In Dynamic Textbox Look Blocky
Greetings,
My dynamic text box is populated from a html file (see below), the html uses <img> tag to display a jpg in the runtime directory.
It is displayed however is very blocky, like the resoultion has been changed.
If I drag the original image to a frame it displays fine and is only a small image and will easily fit within the realms of the dynamic text box.
Has anyone else experienced this kind of behaviour before?
Wasnt sure if i should post this in the HTML/CSS section or not
Code:
content=<HTML>
<img src='staffsuni50logo.jpg'>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<font size='8' face='Viner Hand ITC'><b>Fundamentals of software testing</b>
</font>
Thanks
Rob W
[MX04] Embedded Images Dont Show From A Dynamic (xml) Generated List
Hi guys,
URL= http://www.salisbury.ac.uk/media/cad/images.htm
I'm having trouble with the dynamic textbox showing the images embedded into it when it loads, thing is, as soon as you scroll (strange sliver of boxes on the right, I have as yet to sort out the layer heights of the duplicates, just getting the mask to work properly was an arse) ALL the images instantly appear, so it's clearly not an issue with loading times.
The src info is filled from a xml file, and all the src info in that xml file is complete url's (http://www.salisbury.ac.uk/media/cad/name.jpg) and all the files appear when you move up or down so the images are definitely not progressive's.
So, my question is this, am I missing something simple that flash needs to do or what?
Here's the section of the code:
code:
// from here is where the image_instance (the movieClip with three dynamic, html friendly textboxes, one for the image tag, one for the title and one for author) is populated, duplicated in turn until the xml file has eof'ed
image_instance.duplicateMovieClip("image_instance_ "+id,"1"+id,holder);
current_image_instance = "image_instance_"+id;
setProperty(current_image_instance,_x,00);
setProperty(current_image_instance,_y,y);
// THIS is the line that may need magic happening, where I assign the src data to the img field in the thumbfield that is built into the image_instance movieClip
this[current_image_instance].thumbfield.htmlText="<img height='60px' width='75px' src='http://www.salisbury.ac.uk/media/CAD/"+thumb+"'>";
this[current_image_instance].namefield.htmlText=namething;
this[current_image_instance].authorfield.htmlText="created by:<br>"+author;
y=y+91;
image_count++
}
story = story.nextSibling;
}
}
return image_count/y
}
Overlapping Images In Dynamic Textfield
I've noticed a few posts on this isuue, but no solution.
I'm loading text and images dynamically into a textfield. Everything works fine using the basic html tags that flash allows. But for some reason I can't seem to seperate images. When they are loaded up they seem to overlap each other. The only way they don't is if they are seperated with a sentence of text.. forcing the image to load after the text. Wordwrap is on. But if I have 2 or 3 images loading one after another they don't load up that way, just overlapping. Any thoughts?
Images Not Showing In Dynamic Html Textfield
Hi,
I'm loading html dynamically into a textfield. This html is coming from xml into an array value then placed into the htmltext. The html seems to be loading correctly but the images aren't.
I did a test eliminating the xml by hardcoding test html into a variable and the images showed fine. I traced the html from the original and the path of the image is exactly the same in the <image> tag.
Can anyone suggest why this is happening? Thanks
Can You Draw Dynamic Textfield With Embedded Font Into BitmapData ("Offscreen")?
I need to set up a BitmapData/Bitmap that will have a number of dynamic textfields (fed by XML) drawn into it, but the drawing needs to occur while the textfields are off the display list (I will create them in AS3, "on the fly", then I will add the Bitmap to the display list.)
This seems to work fine, but I haven't gotten the embedded font to display correctly -- perhaps this is simply some font issue, but will the above work, i.e. will the embedded font be displayed correctly if I draw into the BMD "offscreen"
Can You Draw Dynamic Textfield W/embedded Font To BitmapData "Offscreen"?
I need to set up a BitmapData/Bitmap that will have a number of dynamic textfields (fed by XML) drawn into it, but the drawing needs to occur while the textfields are off the display list, then I will add the Bitmap to the display list.
This seems to work fine, but I haven't gotten the embedded font to display correctly -- perhaps this is simply some font issue, but will the above work, i.e. will the embedded font be displayed correctly if I draw into the BMD "offscreen"
Embedded Movie Printing, Bookmarking...
Hello All,
I have a swf file embedded in some html and php pages and I would like to be able to script three buttons to...
1. Print the html or php page that is currently in the browser
2. Bookmark the page or site
3. Send an email to a friend about this site
I have some experience with Flash and ActionScript but have never had the opportunity to create buttons with this kind of functionality so any and all help is appreciated.
Thanks
[F8] Printing Content Of Embedded Swf From Main Environment Swf
I am using Flash Professional 8 to develop, and player 8 to view published swf files in an html window. I have looked through the posts, but nothing seems to apply.
OVERVIEW:
I have a main environment which contains a graphical banner, back and next arrows, and a 'Print' popup containing a number of buttons with print code on them. The main environment loads each actual screen of content from separate swf files (path is: screens/screen1.swf).
The following code (on the first frame of main timeline) worked when everything was in one fla file, but no matter what I try, I can't get the correct syntax to work when the movie is in another swf file:
Key.addListener(myListener);
_global.p_sec_1 = _root.attachMovie("printable_screen1", "psection1",100);
_global.p_sec_2 = _root.attachMovie("printable_screen2","psection2", 101);
_global.p_sec_3 = _root.attachMovie("printable_screen3","psection3", 102);
_root.psection1._visible = false;
_root.psection2._visible= false;
_root.psection3._visible= false;
This code was on the button to call the print function:
on (release) {
printAsBitmap("_root.psection1", "bmovie");
}
MY PROBLEM:
I can't figure out the action script code needed to direct the code (located on the print button in the environment) to print the movie clip when it is in an embedded swf.
I would really appreciate it if anyone knows what I would need to replace '_root' with. I have tried the path 'screens/screen1.swf' and a few other things, but am stuck.
Signed, an action script novice.
Thanks
Printing Text From An Embedded Flash File
Hey,
There's a website that has some text embedded in a flash file, and I would like to know if there is a way to print that text. If I right click the flash and press print, it only prints the portion of the text being viewed--I want the entire text printed.
Thanks!
Printing Embedded Exteranl HTML Files
Hi, I have external HTML files embedded in my flash movie. Is there a way to make a print button that will allow a visitor to print out the contents of a particular text box, that holds the external HTML file?
Thanks
Printing Embedded Flash Movie From A Browser
I have a small chart I've embedded into an html page with a table with results below it. When I print the entire page from the browser (Firefox), about 1/3 of the flash movie is cut off. Does any one have a work around for this problem?
thanks,
Dan
Printing An Embedded .swf File In A .html Page
not sure which forum to ask this....so this question may appear in other forums as well.
I have a web page that I built in DreamWeaver using CSS. On this webpage I have a .swf file embedded in one of my <div> tags. When the user hits File>Print, I want only the .swf file to print and not the other areas (i.e. header, footer, nav bar etc.) of the webpage. The following website does exactly what I want.
http://www.chevrolet.com/avalanche/colors/
Can anyone point me in the right direction to solve how to do this?
thanks!
D
Printing Content Of Embedded Swf From Main Environment Swf
I am using Flash Professional 8 to develop, and player 8 to view published swf files in an html window. I have looked through the posts, but nothing seems to apply.
OVERVIEW:
I have a main environment which contains a graphical banner, back and next arrows, and a 'Print' popup containing a number of buttons with print code on them. The main environment loads each actual screen of content from separate swf files (path is: screens/screen1.swf).
The following code (on the first frame of main timeline) worked when everything was in one fla file, but no matter what I try, I can't get the correct syntax to work when the movie is in another swf file:
Key.addListener(myListener);
_global.p_sec_1 = _root.attachMovie("printable_screen1", "psection1",100);
_global.p_sec_2 = _root.attachMovie("printable_screen2","psection2", 101);
_global.p_sec_3 = _root.attachMovie("printable_screen3","psection3", 102);
_root.psection1._visible = false;
_root.psection2._visible= false;
_root.psection3._visible= false;
This code was on the button to call the print function:
on (release) {
printAsBitmap("_root.psection1", "bmovie");
}
MY PROBLEM:
I can't figure out the action script code needed to direct the code (located on the print button in the environment) to print the movie clip when it is in an embedded swf.
I would really appreciate it if anyone knows what I would need to replace '_root' with. I have tried the path 'screens/screen1.swf' and a few other things, but am stuck.
Signed, an action script novice.
Thanks
Printing A TextField
hello :p Me again,
Posting separate messages for each of them problems.
Does anyone know how one can specifically print a dynamic text field, is there a suitable print command which does that. Or, can i have an external text file and print that file(?)
I think flash only offers options to print frames, but the text in the dynamic text field is scrollable and i want to print the entire text with one command.
Thank you.
Abhay
Printing A TextField
hello :p Me again,
Posting separate messages for each of them problems.
Does anyone know how one can specifically print a dynamic text field, is there a suitable print command which does that. Or, can i have an external text file and print that file(?)
I think flash only offers options to print frames, but the text in the dynamic text field is scrollable and i want to print the entire text with one command.
Thank you.
Abhay
Printing A Scrolling Textfield
I've tried targeting the textfield var like so:
on (release) {
printAsBitmap("_root.fader1.containerMC.daTextBox" , "bmovie");
}
but all it does is print out the clip containing it, which is not showing all the text
Any ideas?
Somebody has suggested copying the contents into a new text field which woud be taller than the actual movie, does anybody know how to do this dynamicaly.
Also I am pulling the text in from an html formatted .txt file
cheers
j
Printing A Scrolling Textfield
I need to print a textfield from Flash. I have a multiple choice quiz where the questions and answer choices are loaded from an XML document. The questions are displayed one and a time while the user is going through the quiz, and then at the end a textfield displays all of the questions and answers, as well as which answers are correct and what the user's choice was. Works just fine onscreen, but when I try to print (using a button within the .swf, not using the print option in the browser) the text gets scaled to all fit on one page.
I'm using Flash MX, and the printing code on the print button is:
print("_root.printMe_mc", "bframe");
where printMe_mc is the movieClip containing the textfield, which has one frame with the #p label where the textfield is displayed in its entirety (not scrolling, just one long field).
Printing occurs, the only problem is the scaling of the text. How do you tell Flash not to scale the text, but to print to multiple pages if necessary?
I've tried using "bmax" and "bmovie" for the bounding box parameter, with the same results -- everything scaled to fit on one page.
Do I need to determine how many lines per page I want to print and manually parse through the textfield, dividing it up into "page size" chunks and display those chunks in separate movieclips, created on the fly (maybe?)and then print those?
Any tips, tricks, clues, or brilliant ideas would be greatly appreciated!
Thanks,
Cindy
Printing Textfield Target Instead Of MC
I don't have a printer at home so I can't test this.
I have a client with a scrolling textbox, they want the text in the box to print.
The print function, as I understand prints whatever's in the frame, within the specified bounding box.
If for a target I give it a variable containing text instead of a MC reference, will it just print the text?
Printing A Movie Clip And Textfield?
I have loaded an swf as a variable in a movie clip. This is how:
pic1 = mov1.swf
loadMovie (/ic1, "lp1");
Now I want to print this movie clip which is actually the swf 'mov1'. I have used both print and printasBitmap options, but none works. All I am getting is black lines when using print option and blank page when using printasBitmap option. I am using the following code to print:
on (release) {
printAsBitmap ("lp1", "bmovie");
}
I have taken a second frame in movie lp1 whose label is #b and there I have drawn a rectangle which I believe would be taken as the bounding box for the movie to be printed. Isnt this right??
Could anyone tell me what the problem might be??
Also theres another textfield on the same frame as the movie clip which i want printed, is there a way??
Error Printing TextField With BevelFilter.
Hi,
I have a movie clip with a TextField that has a BevelFilter. When I run my movie everything is OK, but when I use the PrintJob to
send it to the printer it seems the textfield has lost filter properties. In the page printed by the printer has the textfield without the BevelFilter. Why????? Could anyone help me???
I need to solve this problem as soon as possible.
Thanks for everything.
Printing XML In Textfield In List Not Line
ve got my content to print into my text field with no XML using text();
But, it always prints in one long line. How can I tell it to line break after it prints each node?
This is basically my code right now
Code:
function ParseClients(clientInput:XML):void {
//trace("XML Output");
//trace("------------------------");
//trace(clientInput.Client.Automotive);
var clientAttributes:XMLList = clientInput.Client.attributes();
for each (var clientIndustry:XML in clientAttributes) {
clientXML.field_01.text = clientIndustry;
clientXML.field_02.text = clientInput.Client.attributes()[1];
clientXML.clientfield_01.text = clientInput.Client.children().text();
}
}
Odd TextField Behaviour With Embedded Fonts
I am accessing embedded fonts by loading an external .swf file. Most of my dynamically created TextFields work fine, but some, seemingly randomly show only half or none of the text in the textfield.
Like so (top cut off):
It looks like there is something on top of it, but I'm pretty sure there isn't... Anyone seen this happen before?
Printing Hidden Contents Of Scrollable Textfield
Hey guys,
Do you have any idea as to how to print the text inside a dyanamic textfield. now the problem is that the textbox is say 100/100 pixels and has a scrollbar attached to it and is set to multiline. Now is there a way to print all the text of the dynamic textfield.
Please respond ASAP...
Second TextField Completely Breaks My Embedded Fonts
I am working out a font embedding / textfield formatting method that is based on some stuff that Colin Moock outlines in Essential ActionScript 3, chapter 27: Text Display and Input.
I am using Flash CS3, AS3, FlashPlayer 9.
I have gotten everything to run perfectly, but with one critical flaw : the text disappears when I have an additional textfield placed on the stage, which uses one of the embedded fonts as a device font.
For example, if the embedded font I am using in the dynaimcally created textfield is "Arial", then it renders fine until I place a static or dynaimc text-field onto the stage and use the drop-down menu on the properties panel to set the font for that textfield as the device font "Arial" - then that textfield renders fine but it breaks the other one.
The question for me has to do with what specifically "Arial" is referencing, when used in the following line:
Code:
myFormat_fmt.font = "Arial";
-I know it is not refrencing the library name of the embedded font, because when I change the library name to "xArial" that has no effect and everything continues to work.
-I know it is not referencing the class name under linkage either.
-I know my fonts are being embedded correctly because I can trace an Font.enumerateFonts(); successfully, yielding the following output:
Code:
Arial, regular, embedded
Arial, italic, embedded
Arial, bold, embedded
Arial, boldItalic, embedded
The trace I perform is this:
Code:
var fonts:Array = Font.enumerateFonts();
fonts.sortOn("fontName", Array.CASEINSENSITIVE);
for (var i:int = 0; i < fonts.length; i++)
{
trace(fonts[i].fontName + ", " + fonts[i].fontStyle + ", " + fonts[i].fontType);
}
So myFormat_fmt.font = "Arial"; seems to be referencing the name Arial that is outputted in the Font.enumerateFonts--- is there a way to change the name of the font so that Font.enumerateFonts would output something like "xArial"? If I could do that then I could refer to it as myFormat_fmt.font = "xArial"; and that would be successful and it wouldn't get confused with the system device font "Ariel" that is being used by the static text-field on the stage.
If you need more details, here is how I have my project set up:
I have two seperate SWF files:
The first (fonts.swf) contains the font "Arial", with four variations (regular, bold, italic, bold-italic) embedded in the library, linked to actionscript, and then globally registered through code placed on the first and only frame of the timeline, like this:
Code:
Font.registerFont(Arial);
Font.registerFont(ArialBold);
Font.registerFont(ArialItalic);
Font.registerFont(ArialBoldItalic);
The second (test.swf) has an empty library, empty stage, and some code in the first and only frame of the timeline which does the following:
1) loads fonts.swf
2) references "Arial" in the font property of TextFormat
3) creates a dynamic textfield and places it
4) writes htmltext to that dynaimc textfield
5) applies the textformat to the textfield
Like I said, this all works perfectly until I place an additional static or dynaimc textfield onto the stage and set the font for that to "Arial". Now when this renders the initial textfield is blank.
Here my entire code for test.swf:
Code:
<!---BEGIN AS3--->
loadFonts();
function loadFonts ():void
{
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.INIT, initListener);
loader.load(new URLRequest("fonts.swf"));
}
function initListener (e:Event):void
{
showEmbeddedFonts();
outputMsg();
}
function showEmbeddedFonts ():void
{
trace("=======EMBEDDED FONTS=======")
var fonts:Array = Font.enumerateFonts();
fonts.sortOn("fontName", Array.CASEINSENSITIVE);
for (var i:int = 0; i < fonts.length; i++)
{
trace(fonts[i].fontName + ", " + fonts[i].fontStyle + ", " + fonts[i].fontType);
}
trace("============================")
}
function outputMsg ():void
{
/* BEGIN CONFIG FIELD */
var myField_txt:TextField = new TextField();
myField_txt.x = 10;
myField_txt.y = 10;
myField_txt.width = 580;
myField_txt.height = 380;
myField_txt.embedFonts = true;
myField_txt.antiAliasType = AntiAliasType.ADVANCED;
myField_txt.border = true;
myField_txt.multiline = true;
/* END CONFIG FIELD */
/* BEGIN CONFIG FORMAT */
var myFormat_fmt:TextFormat = new TextFormat();
myFormat_fmt.font = "Arno Pro";
/* END CONFIG FORMAT */
/* BEGIN POPULATE & APPLY */
var fontName:String = myFormat_fmt.font;
var myText:String = "<font size='25'>Double Fnord</font><br><br>"
+ "<font size='18'>"
+ "The word is <b>bold</b>!<br>"
+ "The word is <i>italic</i>!<br>"
+ "The word is <b><i>bold-italic</i></b>!<br>"
+ "The word is <u>underlined</u>!<br>"
+ "And this is a <a href='http://www.google.com' target='_blank'>hyperlink</a>."
+ "</font>";
myField_txt.htmlText = myText + "<br><br>Font in use: " + fontName;
trace("Font in use: " + fontName);
myField_txt.setTextFormat(myFormat_fmt);
addChild(myField_txt);
/* END POPULATE & APPLY */
}
<!---END AS3--->
Any Ideas??? Thank you in advance.
Tweening TextField Alpha W/o Embedded Fonts
Hello all,
I am trying to tween a textfield's alpha in Flash CS3 using AS3.
I cannot seem to be able to do this without using embedded fonts.
(Actually, I found it would also tween if I applied a glow filter (likely any kind of filter will do) to the textfield...sort of random).
The particular reason why I don't want to use embedded text is because I have all my text formats defined in an external class as static variables. (and I can't figure out how to get the external class to work with embedded text in the fla.)
Is there a way to not use embedded text and still do the tween?
I would also be grateful for alternate solutions. I suppose, ultimately I can stick all the textformat definitions in the fla, but I don't exactly want to do that (seeing that there are many flas using that same set of textformats, I would rather keep the textformats in an external class).
Thank you
Shengzhi Li
EDIT: One way to still use the external textformats and the embedded font is to set font=new embeddedFont().fontName;
While, this is certainly not a very pretty solution, since it relies on the fla having that embeddedFont embedded, it works. Better (and otherwise alternate) solutions are still welcome. Thanks guys!
Set TextField For Bitmap/Pixel Embedded Font?
Is it possible to set a TextField using an embedded Pixel font to use the 'Bitmap text (no-anti-alias)" from within AS3?
All that antiAliasType gives me is NORMAL and ADVANCED, and playing with gridFitType isn't working either...
Thanks.
TextField And Dynamically Embedded Fonts Issue
I have an app that dynamically loads fonts at runtime. Most of my TextFields look perfectly fine, but a few of them don't display the text properly. On these, the text is displayed on top of the TextField, as if the top border were the baseline. What's more, when they are multi-line TextFields the text does not wrap (wordWrap is set to true). The strange thing is that there is no difference that I can see between the TextFields that work and the ones that don't. In fact, it is the same code that generates these TextFields (they are also dynamic).
When I set embedFonts to false it works fine, just with the wrong font, of course... so I believe it has something to do with this.
[TextField] Word-wrap Trouble With Embedded Fonts
Hi,
maybe someone knows what's going on here: I've got a text field displaying a long text, loaded from an external file. Loads fine. Looks fine (special chars, word-wrap, etc.) if the embedFonts property of the text field is set to false.
If I set embedFonts to true, the text is correctly displayed, shown with the embedded font. But - the word-wrap doesn't work anymore; only the first block of text is word-wrapped. Subsequent paragraphs don't word-wrap (they trail off the right border). Why could this be? Is there a workaround so the word-wrap works also with embedded fonts?
Funny thing is, it word-wraps ok if I embed Times - only with that. It does not if I embed Arial, Verdana and - of course - the Font I must use...
Any hint (code-snippet, link, book, etc.) is much appreciated...
Textfield Woes, How To Anti-Alias A Dynamic Textfield?
this is driving me nuts, even if i have it marked so that my dynamic textfield is anti aliased, it still looks as if its text is aliased. And if i simply make that textfield Static, the text all of a sudden looks amazingly crisp and anti aliased.
How can i fix this?! I am attempting to load xml data into my text fields but its wasted if the text looks like crap..
So can anyone enlighten me on how to do this? i tried searching Flashs help, all i came out with was "Textfield._quality" but i do not understand what the description means exactly.. And i tried coding my textfield to _quality = "BEST";, with no avail.
Please help, i'v seen other websites with what i am sure is dynamically loaded fields, and smooth looking text... so what gives?
Thanks!
Link In Dynamic Textfield To Jump To Section Of Same Textfield
Howdy all,
I know you've all seen this before - you are on a website and you click a link and you stay on the same page but jump down to a different section of the page. Like an FAQ page or something where all the questions are listed above but you click on one and jumps down to the answer below.
Is it possible to do this in a dynamic (scrollable) textfield with externally loaded text files in Flash? I don't have DW and I know that there are limited html tags available but if anyone knows an easy way to do this please let me know!
thanks!
Link In Dynamic Textfield To Jump To Section Of Same Textfield
Howdy all,
I know you've all seen this before - you are on a website and you click a link and you stay on the same page but jump down to a different section of the page. Like an FAQ page or something where all the questions are listed above but you click on one and jumps down to the answer below.
Is it possible to do this in a dynamic (scrollable) textfield with externally loaded text files in Flash? I don't have DW and I know that there are limited html tags available but if anyone knows an easy way to do this please let me know!
thanks!
|