View Full Version : Flash MX 2004 related...
Intrigued
12-19-2004, 08:12 PM
I am working on a Web site, which contains some Flash MX 2004 components.
Now, what I am doing is using loadVariablesNum to load in a text (.txt) document.
No problem there. It works like a champ!
The setback is that when the data (from the .txt) file is loaded into my TextField Object... the line spacing is "double-spaced". Now, before you ask (a good question no less) if the data in the text (.txt) file is single-spaced, it is.
But, because this data is dynamically set I have used the property of the TextFormat class below:
myFormat_fmt.leading = n; (where n = (various numbers I have tried).
Now, I know that the Flash MX 2004 (Help) documentation says that .leading has to be a positive number and thus I am seemingly out of luck?
Short of creating several TextField Objects (uhg...), do any of you Flash MX 2004 gurus have a workable solution you care to share?
I would be very appreciative of such!
Thank you in advance, ;)
Corey
12-19-2004, 08:36 PM
My guess is that you are accidentally using device fonts. Make sure to include your font by unchecking "Use Device Fonts" (in the properties palette with the text object selected) and you should be fine. :yes
Intrigued
12-19-2004, 08:49 PM
I was using a device font.
However, here is what I have now (and I know the colors are ugly, this is a test only) and still no go (though I embedded my first font!):
/*
This is a Flash MX 2004 based code chunk.
The code works for the most part, until
I tried to set the 'leading' to get a
"singled-spaced" looked for the dynamically
loaded text (.txt) file. So, as of now,
my project is stuck with "double-spaced" text
in the Dynamic TextField Object.
Any ideas?
*/
loadVariablesNum("load_text.txt", "0");
load_btn.onRelease = function(){
display_txt.text = TXTpage;
};
display_txt.borderColor = 0xff0000;
display_txt.background = true;
display_txt.backgroundColor = 0xffcc00;
myFormat_fmt = new TextFormat();
myFormat_fmt.font = "Font1";
myFormat_fmt = 36;
myFormat_fmt.leading = 5; // not working! Ack! Glitch? What about negative leading?
myFormat_fmt.blockIndent = 10; // Also not working!
display_txt.setTextFormat(myFormat);
It's still not showing singled-spaced though.
:rolleyes
Intrigued
12-19-2004, 08:55 PM
(removed) I see you edited too. D'oh!
Corey thanks for helping me by the way. This is driving me to drink bottled water tonight! :p
Corey
12-19-2004, 08:58 PM
Hi. I made a mistake, device fonts is for static text. Ok make sure you have your text set to "Dynamic Text" ("device fonts" option will disappear) and then click on the "Character" button and embed the outlines for the font characters you need. That should do it. Works fine here. If it doesn't work for you I suggest starting from scratch and eliminating any code you are using to attempt to format the text field...
Intrigued
12-19-2004, 09:02 PM
Ok, after your first reply, I added in the Font1 (font) and did the Linkage on it. Next Iclicked the Character button in the Properties Inspector and selected the first four (upper, lower, num, punct.) and then OK'ed the dialog.
The font's show up ok... it's just the spacing still.
I will now go and do as you suggested, start from scratch.
Thanks for your help Corey nontheless!
:yes
Sincerely,
Intrigued
12-19-2004, 09:13 PM
Same situation after a "from scratch" Corey. (just an update).
I'll try Google'in my way to an answer.
Thanks again for taking a moment or two to work with me on this Corey.
:yes
Corey
12-19-2004, 09:19 PM
Here's a working example attached, perhaps that'll help... :yes
Intrigued
12-19-2004, 09:20 PM
Thanks Corey!
It's got to be something simple.
Corey
12-19-2004, 09:22 PM
No problemo muchacho. Try using Flash.SetVariable from AMS too if you ever need to set text in Flash dynamically within an AMS project. :)
Intrigued
12-19-2004, 09:35 PM
Cory, thank you!
Your version works for me and I then started to compare.
Two things I found (not sure just yet which was the culprit):
1. I had (from another test) 'Render text as HTML' still clicked in the P.I. (D'oh!)
2. I had this variable being used in the text file, TXTpage. Would the 'TXT' confuse Flash maybe?
Corey, the bottom line is that you helped me to solve this dilemma of sorts!
Thank you very much!
Create and put for sale those Flash Training CDs soon please! I did just buy some off eBay recently but, I would like to see more of your (I like your offerings for various reasons) training with regards Flash MX 2004!
Sincerely,
Intrigued
12-19-2004, 09:37 PM
No problemo muchacho. Try using Flash.SetVariable from AMS too if you ever need to set text in Flash dynamically within an AMS project. :)
Thanks for that tip!
I am close to putting into action the FSCommand training I reaped from your Speedy Traning CD#3 the Advanced one, very soon on several small Flash files!
Sincerely,
Intrigued
12-19-2004, 09:46 PM
NOW, when it is all said and done I believe I found the culprit.
I noticed just now I had 'Wordwrap' on in my text editor. When I turned that off while viewing your text file I see you chose to put all of the data on one line.
Ah!
I remember reading a few days ago that Flash can have problems reading data in a text file that is on seperate lines! (where variables are concerned anyway)
*So much to remember.
*And time for a ... Whewwww. *Shoulders slumping in a relaxive manner.
:lol
Corey
12-19-2004, 10:10 PM
No problem. Yes I will make some training CDs for Flash. I believe they wil lbe better than the existing stuff because I will approach it from a usability standpoint, not as a purely technical exchange. Anyhow I have to write the certification exam first which means I have to study but it's been way too busy behind the scenes here at IR lately for that. I should have my first "certified" Flash CD out for about spring realistically. The Flash developers study guide is tough stuff, it's not going to be as easy as I'd hoped. :)
Apaarently the failure rate for the Flash MX2004 developers exam is around 40%... :yes
Intrigued
12-19-2004, 10:17 PM
Well, I wish you the best on the Certs!
And I'll keep my eye pealed for those Flash CBT CDs this spring'ish!
Thanks,
Corey
12-19-2004, 10:33 PM
Thanks Intrigued. :)
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.