Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




How To Break Up Text When Calling Text Into A Dynamic Text Field



I am calling test in from a .txt and was wonding if there was a way to have a page with a bunch of information and have it obly call an indevidual paragraph or sentance depending on what i want it to ask.


ThnX



FlashKit > Flash Help > Flash General Help
Posted on: 01-06-2006, 02:45 AM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Calling A Text File Into Dynamic Text Field
I'm relatively new to Flash so please forgive any obvious questions! I've searched for ages and come up with lots of results about loading XML into Flash, but my problem is more basic than that.

I'm creating a site where each page is pretty much text. I want to achieve this by loading text files into dynamic text fields, since it's easier for me to maintain text files that regenerate movie clips etc.

I have figured out how to load a text file into a dynamic text field and how to use the 'read as HTML' option to invoke HTML formatting - but I've hit the (apparently common, judging from Google) problem about whitespace. As soon as I have a carriage return in the text file, all subsequent text is ignored.

I'm detailing what I've done below and would really appreciate any help

1. Create flash document
2. Add a dynamic text field
3. Set the instance name of this text field to be 'Text1'
4. Set the 'var' for this text field to be 'Text1'
5. Created a text file in Notepad named 1.txt and saved in same location as the .fla
5. In frame 1 (which also happens to be where the text field is placed) I have the following code:

Code:
loadVariables("1.txt", this);
I THINK I need to add some code somewhere about whitespace but I'm not sure what it is or where it should go...

Most of the above has been achieved through trial and error, copying things I've found online - not through any detailed understanding of what I'm doing so it is quite likely I've been stupid somewhere along the line!

Many thanks

Detect A Line Break In A Dynamic Text Field
I'm bringing in some data dynamically and need to detect if there is a line break after it has been placed in the text field. If there are none, I need to reposition the text box.

Found this code on another site, but can't seem to get it to work:


Code:

lineBreak = MainMovie.Cat2.indexOf('
');

if (lineBreak > -1) {
trace("yes")
}

else {
trace("no");
}




Thanks for your help!

Trying To Pass Text From Form Text Field To A Flash Dynamic Text Field
Hi, I was hoping someone might enlighten me as to how/if I can do this...

Currently I'm using javascript which works fine to pass text from textfield A to textfield B:


Code:
window.onload=function()
{
document.forms.form1.shirtText.value=document.forms.form1.KitGroupID_16_TextOption_38.value
}
Is there a way to pass the textfield A text to a dynamic text input (flash) as I'd like to use the font embedding flash offers. I can make it work when loading a value from a txt file but I'm not sure how to access the value identified above as KitGroupID_16_TextOption_38 and make it appear in a dynamic input box. Eventually I might want to have 3 font choices for the user but I'd like to just see if I can get this working properly first.

Your help/advice would be greatly appreciated,

-Scott

Calling A Link In A Dynamic Text Field...
Hi all,

I've got a dynamic text field displaying some text from a txt file, and I want to make part of the text a link... Can anyone tell me how I can do that, since it doesn't seem to like <'a href=""'> code.

Thanks!

Problems W/ Dynamic Text Field Calling ASP File ..
My sincere apologies if this thread seems simple but for me, an Action Script 2.0 newbie-- I am really struggling.

I have a Dynamic Text Field that is calling an external HTML file with no problem at all -- but I need it to call a (.asp) file into this text box from an external server ..

What code would I place in the Text Field MC to have it call a URL (.asp) into the box and display?

Thank you, Thank you, Thank you!
Any help muchly appreciated !!!!

Loaded Text File Wont Show All Of The Text In Dynamic Text Field
When I load an external text file into flash and display the string in a dynamic text box, not all of the text will show in the text box; and using scroll button to scroll the text doesnt help.

The text that is in the text file is as follows, and as far as I can see there is no reason why all this text shouldnt show in the dynamic text field; by the way all my targets are correct, I know that for fact.


message=Code: Cheat:
BEEPSAGONER Deactivate the censor beeps
DRACULASTEABAGS 50 lives
DUTCHOVENS Frying pan mode
XFYHIJERPWAL IELWZS Debug mode
BOVRILBULLETHOLE Shoot all objects
EASY Easy mode
VERYEASY Very easy mode
SPUNKJOCKEY New death animation
SEXYMANN Birdy & Squirrel scene

Code: Unlock chapter:
PRINCEALBERT Barn Boys
CLAMPIRATE Bats Tower
ANCHOVYBAY Slopranos
MONKEYSCHIN Uga Buga
SPANIELSEARS Spooky
BEELZEBUBSBUM It's War
CHOCOLATESTARFISH The Heist
WELDERSBENCH All chapters and scenes

Code: Unlock Multiplayer character:
WELLYTOP Conker
EASTEREGGSRUS Neo Conker
BILLYMILLROUNDABOUT Gregg the Grim Reaper
CHINDITVICTORY Weasel Henchmen
EATBOX Cavemen
RUSTYSHERIFFSBADGE Sergeant and Tediz Leader
BEEFCURTAINS Zombies and Villagers

Is It Possible To Change A Text Field From Dynamic Text To Static Text At Runtime?
The reason is because the dynamic text appears to be taking up about 90 % of the CPU usuage and I dont know any other way to reduce the CPU usage.

The text areas pull in lots of data from text files which slows down the program.

Any ideas?

Calling Dynamic Text Field On Main Timeline From Inside Movieclip
Hi, this is probably really easy, but I can't seem to figure out how to do it.

I made a little login screen in a separate movieclip on my homepage. When the login is correct, frame 8 of the main timeline is called, and I would like it to say "welcome (name here)." Unfortunately, I don't know how to call the dynamic text field on Frame 8 (instance name "greetings", variable saved as "welcome") from inside the movieclip on Frame 2.

Here's the code from the login button in the movieclip:

on (release, keyPress "<Enter>") {
if (user eq "name" and password eq "password") {
_root.gotoAndStop(8);
//trying to access dynamic text field on frame 8 of main timeline, but nothing works!
_root.greetings.welcome = "Welcome, "+ user;
_root.welcome = "Welcome, " + user;
welcome = "Welcome, " + user;

I just don't know! By the way, this is in Flash MX

Load Text From A Text File Into A Dynamic Text Field
I'm trying to load text from a text file into a dynamic text field. The text field is on the "blog" page of the website. When I test my movie, the first time I go to the blog page, the text from the external text file (AND the CSS styles) show up fine. But when I click from the blog page to go to the "profit calculator" or "contact" pages and THEN click to go BACK to the blog page, the blog page animates back in, and right as the animation ends, the text on the blog page suddenly disappears and won't come back. PLEASE help me figure this out!

How To Add Text To Dynamic Text Field Where Text Cursor Is. Please Help
Hello,

How do you, if possible, can add text to a dynamic text field on where the text cursor.

Example:
| = text cursor
by pressing a button I want to add "How are you?" where the cursor is
____________________________________________
Hello
|
Bye
____________________________________________



Results:
____________________________________________
Hello
How are you?|
Bye
____________________________________________


Please Help!
Thank you in advance!

Find Line Break Into Text Field
Hi everybody,
i have a movie clip with 2 text fields (one input and one Dynamic). The user types something into the Input type textfield and by pressing a button this text moves to the Dynamic Textfield.
I use this to do it:
code:
on(release){
_root.dynamic_text += _root.input_field + "
"
}


Then from this dynamic text i want to find where there is a line break (
) to perform an action (like add something).
Does anybody knows how to do it?

Find Line Break Into Text Field One
Hi everybody,
i have a movie clip with 2 text fields (one input and one Dynamic). The user types something into the Input type textfield and by pressing a button this text moves to the Dynamic Textfield.
I use this to do it:



code:



on(release){

_root.dynamic_text += _root.input_field + "
"

}



Then from this dynamic text i want to find where there is a line break (
) to perform an action (like add something).
Does anybody knows how to do it?

How To Stop Text Floating To Right Side Of An Image Inside A Dynamic Text Field
Hi

I have dynamic text field that loads in a txt file containing
html formatted text including an embedded image.
When I test the movie the text that should appear bellow
the image, instead, runs down the right side of the image.

I have tried adding various html attributes including -


Code:
<br clear="all"><img src="image.gif" /><br >
I have also tried attaching a style sheet and appying the
following class -


Code:
img.allClear {
clear: all;
}
and also redefining the image tag -


Code:
img {
clear: all;
}
None of witch have worked.

Can someone help with this please.

Regards Mydogmax

Button Function - Load Text File To Dynamic Text Field
Hey again,

okay straight into it. I have a few button named b1 b2 b3 and so on. Now these buttons i want to load a text file into a dynamic text field called myText. Now the text files which will be loaded contain html tags, so i want to have that property set.

Now current I have home.text loading into myText automically on swf loading. But when I click any of the buttons the text file won't change over.

Now my menu is seperate to the body. I have 3 swf files, one called base.swf, nav.swf and body.swf. Base.swf loads nav and body onto it.

here is what i have as the script.

Frame1 - body.swf

_root.onData = function(){
myText.html = true;
myText.htmltext = _root.myInfo;
}

loadVariables("home.txt", _root);
loadMovie("scratchy.swf", logo);


Frame1 - nav.swf - gigsbut (button)
on (release) {
loadVariables("gigs.txt", _root.body);
}


can anyone help point out where I am going wrong. I have a feeling I am not targeting the text field right from the button. If you could help point me in the right direction rather then give me the answer that would be good as I would learn better from that. Thanks

Wolfie

PS - Let me know if you want or need more info. Am happy to post it up.

Using Buttons To Change The Text File A Dynamic Text Field Loads?
I have a text field that loads text from a text document which works great for the news section of my site. However, is there a way I can keep that same text field and change it's content based on what button is pressed? For instance, if someone is viewing the "news" section of my site, and then they click on the "links" button, can I unload news.txt and load links.txt into that text field?

Dynamic Text Field Loads Text, Font Not Showing Properly
I have a flash 8 movie in which there is a dynamic text field loading data from the server. The data loads beautifully and appears in a text field formatted as html.

This html-formatted text field uses a stylesheet as well which works great for everything except the font. Using Flash, I have specified a font of DIN-Medium for the dynamic text box on my stage and yet the text that appears when I publish to my hosting provider appears to be Times New Roman. WTF?

My stylesheet does not specify any font family.

Can anyone tell me how I might get the dynamic text box to show the text using the DIN font? Do I need to export the font in the library of my flash movie or something?

Here's my actionscript:

PHP Code:




stop();

import TextField.StyleSheet;
var myStyleSheet:StyleSheet = new StyleSheet();
myStyleSheet.onLoad = function(success:Boolean) {
    if (success) {
//        trace("Styles loaded:");
    } else {
//        trace("Error loading CSS");
    }
};
myStyleSheet.load("styles.css");
txtFilmNews.html = true;
txtFilmNews.styleSheet = myStyleSheet;
txtFilmNews.width = 295;
txtFilmNews.autoSize = true;
txtFilmNews.selectable = false;

var lvFilmNews:LoadVars = new LoadVars();
lvFilmNews.onLoad = function(success) {
    if (success) {
        txtFilmNews.htmlText = lvFilmNews.html;
    } else {
        trace('load failure!');
    }
}
lvFilmNews.load('getHTML.php?q=filmNews');







Here is my stylesheet:

Code:

p {
color: #53301A;
font-size: 12px;
margin-bottom: 0px;
padding-bottom: 0px;
border:none;
}

.title {
font-size: 15px;
text-transform: uppercase;
color: #D06F1A;
font-weight:bold;
}

a {
color: #D06F1A;
font-weight:bold;
}
a:hover {
color: #53301A;
}

Is It Possible To Skew A Dynamic Text Field To Create A Text Percentage Preloader
Hi there.. is it possible to skew a dynamic text field? Im trying to create a preloader with a text percentage... and i want it skewed so that it looks like the font is italic a bit..?

thanks..

Resizing Dynamic Text Field & Maintaining Text Font Properties
I have created a dynamic text field and have specified the height and width in the property inspector. The font is set at Verdana, 12, multiline. After searching these forums I also clicked the Character button and set it to embed font outlines for all characters.

My problem is that when I try to type or paste text into the field it is stretched to fit the field dimensions. I just want to preserve the Verdana 12.

Any help is greatly appreciated.

Dynamic Text Field Loads Text, Font Not Showing Properly
I have a flash 8 movie in which there is a dynamic text field loading data from the server. The data loads beautifully and appears in a text field formatted as html.

This html-formatted text field uses a stylesheet as well which works great for everything except the font. Using Flash, I have specified a font of DIN-Medium for the dynamic text box on my stage and yet the text that appears when I publish to my hosting provider appears to be Times New Roman. WTF?

My stylesheet does not specify any font family.

Can anyone tell me how I might get the dynamic text box to show the text using the DIN font? Do I need to export the font in the library of my flash movie or something?









Attach Code

//Here's my actionscript:
stop();

import TextField.StyleSheet;
var myStyleSheet:StyleSheet = new StyleSheet();
myStyleSheet.onLoad = function(success:Boolean) {
if (success) {
// trace("Styles loaded:");
} else {
// trace("Error loading CSS");
}
};
myStyleSheet.load("styles.css");
txtFilmNews.html = true;
txtFilmNews.styleSheet = myStyleSheet;
txtFilmNews.width = 295;
txtFilmNews.autoSize = true;
txtFilmNews.selectable = false;

var lvFilmNews:LoadVars = new LoadVars();
lvFilmNews.onLoad = function(success) {
if (success) {
txtFilmNews.htmlText = lvFilmNews.html;
} else {
trace('load failure!');
}
}
lvFilmNews.load('getHTML.php?q=filmNews');

//Here is my stylesheet:
p {
color: #53301A;
font-size: 12px;
margin-bottom: 0px;
padding-bottom: 0px;
border:none;
}

.title {
font-size: 15px;
text-transform: uppercase;
color: #D06F1A;
font-weight:bold;
}

a {
color: #D06F1A;
font-weight:bold;
}
a:hover {
color: #53301A;
}

Help With Dynamic Text Field Being Populated From A Button On Same Stage Using Text Files...
I am using the following code:

var ImportsText = "Imports";
Imports.addEventListener(MouseEvent.CLICK,doClick);
function doClick(evt:MouseEvent):void {
List.text = ImportsText;
}

This will generate the word Imports on my List.text dynamic text field.

I have a list of 30 things that need to go in the place of the word imports, one each per line.

Is there a way for me to create a text file and load it instead?

So I have button1 which loads the text from the text file text1.txt and puts it in Last.text
and so button2 loads the text from the text file text2.txt and it is put in last.text

and so on.

Would like the text files to be able to have some formating that is translated to the Last.text


I am very new to AS3.0 so please bar with me. I think I am almost understanding what I need to do but I need a push in the right direction.


Thanks allot in advance.

Tamer Z

Dynamic Text Field: Swap Text With Diff Variable In Same Ext. File
I'm using the recommended


Code:
loadText = new LoadVars();
loadText.load(_global.text_url2);
loadText.onLoad = function(success) {
if(success){}

etc..
which is working well. I just want to attach an action to buttons which will switch the text for different variables in the same text file, in a single text box named archivetitle.

ie.

Code:
archivetitle.text = this.title1;
when button one is pressed



Code:
archivetitle.text = this.title2;
when button two is pressed.


Basically, how do i access an already loaded text object to refresh to a new variable? Thanks!

Dynamic Text Field: Swap Text With Diff Variable In Same Ext. File
I'm using the recommended


Code:
loadText = new LoadVars();
loadText.load(_global.text_url2);
loadText.onLoad = function(success) {
if(success){}

etc..
which is working well. I just want to attach an action to buttons which will switch the text for different variables in the same text file, in a single text box named archivetitle.

ie.

Code:
archivetitle.text = this.title1;
when button one is pressed



Code:
archivetitle.text = this.title2;
when button two is pressed.


Basically, how do i access an already loaded text object to refresh to a new variable? Thanks!

Select Text File From Dropdown List, Content To Show In Swf Dynamic Text Field
I have a php page where there is a form with a dropdown list of all text files in my site. The name of the dropdown is $filename.

The action script in my swf is this:
loadVariablesNum("<?PHP echo $filename; ?>", 0);

but I get nothing. It displays correctly when I replace
<?PHP echo $filename; ?> with the actual value of $filename, for example:
loadVariablesNum("ui_websites.txt", 0);

Any ideas what I'm doing wrong?

Loading External Text File Into Flash Using Links From Dynamic Text Field Link?
I am using a dynamic text field to load in .txt files with html tags. I have a couple "click here" type links that I would like to use to load a different .txt document into the same dynamic text field instead of a url link like it does default. Is this possible? I'm sure I could put a button over the text since its not long enough to need a scrollbar but I would like a more dynamic and flexible way to do this if its possible.

Thanks

Resising A Dynamic Text Field Depending On The Amount Of Text...
Hi all...

I have a flash movie reading a xml file...

i m getting a list of questions and their respective answers...i d like to load those answers into a Mc that contains a dynamic text field ...

the question is:

how can i "resize" (add lines) my dynamic text field depending on the amout of text - i tried getting maxscroll and resizing but that only makes it bigger and doesnt add any additional lines like i d like it to...


thanx 4 ur help

Loss Of Text Formatting When Using Dynamic Text Field & Scroller
Hi all,

Using MX...

Another small problemo im having is when i format text in my dynamic text field and attch the scroller component to it, in preview mode i lose all the text format and it goes to the first text format it encounters and uses that for everything else in the dynamic text box.

Im not actually loading any text into the dynamic text box, im just using it with static text, so i can use the scroller component.(as i understand it, you can only attach the scroller component to a dynamic text box ??)

Why am i losing my text format AND is there a better way to have a scrolling text field when i just want to use static text...???

Thanks guys..hope thats not too confusing

Cheers

Preserving Rich Text... Html In Dynamic Text Field
i have a dynamic text field that gets the text from data.html and i turned on the "render text as html" button, what eltse do i have to do to get it to work?

Html Text Field Write To Flash Dynamic Text Box
I have a dynamic text field in Flash.
I would like to have users type a message in the HTML text field and have it eventually appear in the Flash dynamic text field.
How can I get text from an HTML text field (on the same page as the swf) to write to the Flash dynamic text field?

Using Text File For Dynamic Text Field From External Domain
I have a .SWF file on a (we'll say original.com, for reference purposes)... I have a dynamic text file in that .SWF file, which is currently loading a text file using the loadVariables function. I would like the movie to start loading the text file from another server, which we'll call new.com, for reference purposes.

I'm told that Flash will not load files from external domains, but is that it - end of story? Is there any way I can somehow get this to work?

I know some stuff about PHP, so maybe that'll help?

Any help would be greatly appreciated... Thanks.

Can Text Loaded From Variable Be Scrolled In A Dynamic Text Field ?
Simple problem here.

I put a dynamic text field on the stage. Added a scroll bar component and filled in the values in the parameter box. I typed lots of text directly into the text field, and it scrolled well. So far, so good.

Now I wanted to load that text from an external file, did the necessary action script und assigned the text to a variable, added this variable to the dynamic text field parameters.

Now the text field shows as much of the text as fits in it, but the text can not be scrolled any more. The rest of the text is just cut off.

Why the **** ???

And - can it be made scrollable somehow?

And if not - why the **** not ???

Loading Text Into Dynamic Text Field With Full Justify - Can It Be Done
Hi!

Trying to load in text into a dynamic text field that is html formatted and "full" justify the text.

Cant seem to full justfiy the text.
"full justify": spreads text out to fill up a whole line by automatically setting the spacing between words.

1)
I have tried using html formatting to align the text: <p align="justify"></p>
justify isnt accepted by flash

2)
set the text field in flash to full justify
works fine if text inputted into the dynamic text field before compiling
But if text is loaded in, then the formatting is lost.

Anyone got any ideas how to do this?

I'm thinking of using php's GD lib to create a jpg using text retrieved from a database with the text fully formatted in the jpg image and loading in the jpg image, but then I lose my html formatting.

any other solutions? or have I overlooked something here?

cheers

xiang

Determining Number Of Lines Of Text In A Dynamic Text Field
I'm working on a movie that has a large number of dynamic text fields in it, which are being fed data from .xml sources.

The width of the dynamic text fields are set and cannot be changed, and I need is to find a way to determine how many lines tall each text field will need to be to fit it's data. If I were using a monospaced font this could be done pretty easily, but it has to use a non-monospaced font since the look of the piece is critical.

So.. is there any way to determine when Flash uses a linefeed within a dynamic text field? Or any way to find out how many lines have been filled with text after it's been populated with data?

Thank you.

Dynamic Text Field In My Custom Component Shows No Text In SWF
Flash MX 2004 on MAC platform (not professional version)
------------------------------------------------------------------------
Hi,

I created a custom component in Flash MX 2004, which has two custom text fields defined by variables and one link defined by a variable also (3 variables total).

When I publish my movie, one of the text fields in each instance of my component on the stage is always empty (the same one) ...does anyone have any idea why?

It doesn't make sense to me that i have it working for one text field and not for the other....I don't THINK that I am doing anything differently between them...?

I have uploaded my small FLA here:

http://www.lucid-life.com/my_component.fla.zip

Can anyone help?......

Thanks,

Cheska

[MX04] Dynamic Text Field Not Displaying Text (NOT EMBEDDED)
Hello,

I am working on a Flash portfolio website for myself. I have several dynamic text boxes that display information about the various pieces in my portfolio. The text content of these boxes is loaded from external .txt files. The text fields are set to use "_sans" font and there is NO font embedding.

Recently, while working, I tested the site and noticed that my text boxes were no long displaying data. Through testing the problem I was able to determine that the data is being loaded from the external .txt files and into the correct variables, however, the text is not "appearing" in the text fields at run time.

I tried placing a new dynamic text box on the _root of the movie and writing the following code on the first frame of the ROOT timeline:


Code:
_root.myTest_text.text = "this is a test"
the dynamic text field (with instance name "myTest_text") again appeared blank at runtime. As before, the font was set to _sans and NO embedding was taking place.

I tried the same text box and the same code in the clean, empty file and it worked fine.

Has anyone encountered this problem? Is it a bug? Will I need to rebuild the file from scratch?

If anyone has any assistance or advice to offer I would appreciate it.

Thank you!

Dynamic Text Field In My Custom Component Shows No Text In SWF
HI,

I created a custom component in Flash MX 2004, which has two custom text fields defined by variables and one link defined by a variable also (3 variables total).

When I publish my movie, one of the text fields in each instance of my component on the stage is always empty (the same one) ...does anyone have any idea why?

It doesn't make sense to me that i have it working for one text field and not for the other....I don't THINK that I am doing anything differently between them...?

I have uploaded my small FLA here:

http://www.lucid-life.com/my_component.fla.zip

thanks in advance of any help..

Cheska

Uploading An External Text File Into A Dynamic Text Field
I have created the dynamic text field, Now I need to know the code to upload the text from the txt. file from the server.

Thank You.

Loading Text Files With Hyperlinks Into Dynamic Text Field
I am using Flash 8 and loading external text files in dynamic text fields on my webage. These texts contain html links (<a href="page.html" target="_blank">Click Here</a> and I have "render as HTML" on and "selectable" off in my dynamic text field. Also, I am loading a CSS file. Not only do I not have a hand cursor, but I do not even have any of the text from that piece of html code down. What is going on with this? Please respond asap, as I have been struggling with this for a day now. Here is the Actionscript for loading the CSS:

var flash_css = new TextField.StyleSheet();
flash_css.load("styles.css");
flash_css.onLoad = function(success:Boolean) {
if (success) {
zloc_txt.styleSheet = flash_css;
} else {
trace("Error loading CSS file.");
}
};

var zloc_lv:LoadVars = new LoadVars();
zloc_lv.load("zloc.txt");
zloc_lv.onLoad = function(success:Boolean) {
if (success) {
zloc_txt.text = this.content;
} else {
trace("unable to load text file.");
}
};
zloc_txt.html = true;
zloc_txt.editable = false;
_global.styles.TextArea.setStyle("backgroundColor" , "transparent");
_global.styles.TextArea.setStyle("border styles" , "solid");

Here is a sample of the text file code:

&content=<span class="headline">Northwest Arkansas Locations</span>
121 Main St.
Russellville, AK 77801
(626) 111-1111<br />
<html><a href="

Loading Text Files With Hyperlinks Into Dynamic Text Field
Describes the mood or content of the topic posted 11-22-06 04:41 PM
I am using Flash 8 and loading external text files in dynamic text fields on my webage. These texts contain html links (<a href="page.html" target="_blank">Click Here</a> and I have "render as HTML" on and "selectable" off in my dynamic text field. Also, I am loading a CSS file. Not only do I not have a hand cursor, but I do not even have any of the text from that piece of html code down. What is going on with this? Please respond asap, as I have been struggling with this for a day now. Here is the Actionscript for loading the CSS:

var flash_css = new TextField.StyleSheet();
flash_css.load("styles.css");
flash_css.onLoad = function(success:Boolean) {
if (success) {
zloc_txt.styleSheet = flash_css;
} else {
trace("Error loading CSS file.");
}
};

var zloc_lv:LoadVars = new LoadVars();
zloc_lv.load("zloc.txt");
zloc_lv.onLoad = function(success:Boolean) {
if (success) {
zloc_txt.text = this.content;
} else {
trace("unable to load text file.");
}
};
zloc_txt.html = true;
zloc_txt.editable = false;
_global.styles.TextArea.setStyle("backgroundColor" , "transparent");
_global.styles.TextArea.setStyle("border styles" , "solid");

Here is a sample of the text file code:

&content=<span class="headline">Northwest Arkansas Locations</span>
121 Main St.
Russellville, AK 77801
(626) 111-1111<br />
<html><a href="

How To Change The Text Color Of Certain Word In Dynamic Text Field
i know in html css can done by this <td style="red">You are now at <span style="yellow">home</span></td> .... the "home" word can change to another color .... any one who know this can done in flash , please give some advice or example

Apply Typed Text To A Dynamic Text Field Without Selecting It
I'm trying to make a Dos like flash application, although I'm finding the problem where the cursor in DOS is different the the vertical one in regular text fields like on internet browsers. My attempt was to have an invisible movie clip that said...

onClipEvent (enterframe) {
if (Key.isDown(97)) {
_root.dos = _root.dos + "a"; }
if (Key.isDown(98)) {
_root.dos = _root.dos + "b"; } //...

and etc. But this isn't working, I always get capitcal characters. Is there a more appropriate way to confront this problem? If anyone knows how, please help me :)

Convert Text To Capitals Before Inserting Into A Dynamic Text Field
I am trying to load the titles of blog posts into buttons but before doing so i would like to convert the text to all capitols... is there a way to do this within flash? Thanks!

Loading Text Files With Hyperlinks Into Dynamic Text Field
Describes the mood or content of the topic posted 11-22-06 04:41 PM
I am using Flash 8 and loading external text files in dynamic text fields on my webage. These texts contain html links (<a href="page.html" target="_blank">Click Here</a> and I have "render as HTML" on and "selectable" off in my dynamic text field. Also, I am loading a CSS file. Not only do I not have a hand cursor, but I do not even have any of the text from that piece of html code down. What is going on with this? Please respond asap, as I have been struggling with this for a day now. Here is the Actionscript for loading the CSS:

var flash_css = new TextField.StyleSheet();
flash_css.load("styles.css");
flash_css.onLoad = function(success:Boolean) {
if (success) {
zloc_txt.styleSheet = flash_css;
} else {
trace("Error loading CSS file.");
}
};

var zloc_lv:LoadVars = new LoadVars();
zloc_lv.load("zloc.txt");
zloc_lv.onLoad = function(success:Boolean) {
if (success) {
zloc_txt.text = this.content;
} else {
trace("unable to load text file.");
}
};
zloc_txt.html = true;
zloc_txt.editable = false;
_global.styles.TextArea.setStyle("backgroundColor" , "transparent");
_global.styles.TextArea.setStyle("border styles" , "solid");

Here is a sample of the text file code:

&content=<span class="headline">Northwest Arkansas Locations</span>
121 Main St.
Russellville, AK 77801
(626) 111-1111<br />
<html><a href="

Can't Access Dynamic Text>properties>var (text Input Field) In AS3
Hello,

I got VB to put text in a dynamic text field I created in actionscript 2 but can't get it to work with as3. The difference being that in as2 I can draw a dynamic text field on the stage name the instance 'testField' in properties and then there is a var: text box also in properties where I can add a variable name 'testVar.' As3 won't let me access that var:text box in properties. Why is this? For some reason VB needs both the instance name 'testField' and also the variable name 'testVar.' How do I set the variable name in as3 for a dynamic text field? Is the var:text box in properties to give the dynamic text field a variable name in as2?

Thank you if you can help me clear this up! If something in my questions does not make sense please ask me!

Problem Loading Text Into Rotated Dynamic Text Field
Hi there

With help from Stratification, I've sorted out my previous problem, but alas it grew into a more insidious and tedious mire. Especially, I am sure, for people who know what theyre doing: I'm still rather daunted by Actionscript.

SO, I'm trying to load a text file, one.txt, into a dynamic text field. Simple enough, but this time I wanted to have the field rotated to a specific angle, and this requirement defeats my meagre knowledge. I've got a rotated dynamic text field, but I can only fill it with text typed into the actionscript (I don't know the term for this) as opposed to loaded from an external text file.

Strat kindly gave me the following code:

stop();
loadText = new LoadVars();
loadText.onData = function(src:String) {
if(src != undefined){
my_txt.text = src;
}
else{
trace("Woops, didn't load");
}
}
var my_fmt:TextFormat = new TextFormat();
my_fmt.font = "verd";
this.createTextField("my_txt", this.getNextHighestDepth(), 10, 10, 160, 120);
my_txt.wordWrap = true;
my_txt.embedFonts = true;
//If this text is what we see then something didn't happen correctly.
my_txt.text = "Not Loaded";
my_txt.setTextFormat(my_fmt);
my_txt._rotation = 45;
//Now that everything is set up, load our text
loadText.load("one.txt");

But when I try it, the "Not Loaded" text appears, so something went wrong, and it's beyond me to see what.

If anybody can offer any help I'd really appreciate it.

Cheers!

N

Problem Importing Text Data Into Dynamic Text Field
Head slowly banging into wall on this one. I've done it before but for some reason I'm missing something here.

Particulars -- I've got a flash movie with a menu that jumps to a particular frame to load a page. On that frame, there is a movie clip (instance name: scrollbox_frame), and in that movie clip there is a four-layer animation. One of the layers is not animated but contains a dynamic text box (instance name: about_frame), with multi-line and HTML turned on, and a variable name of "aboutus". This is the code that is triggered by the menu button on the root of the flash movie:


Code:
myVariables = new LoadVars();
myVariables.load("text1.txt");
myVariables.onLoad = function(success){
if(success){
about_frame.text=myVariables.aboutus;
}
}
and this the text1.txt document:


Code:
aboutus=ABOUT US <br>blah blah blah
It's not working, and I've tried seemingly dozens of permutations. What am I missing? Anybody?

Trouble Parsing Name To Dynamic Text Field .text Property
Hia, I'm making a media player with a playlist, when a list item is selected the 'name' (of selected track) should be parsed from the xml into the dynamic text field (title_txt).

What's happening is when the swf starts title_txt contains "level0.title_txt", when you first click an item, title_txt is parsed "undefined".

The trace function I set up to mimic this also brings back "undefined".

I'm not sure what's happening, any help would be really appreciated.

In my fla, I have:a list component inth an instance name of "list"
a video holder with the instance name of "video"
a title box with a var of "title_txt"

its a pretty simple fla.

the list is populated by xml

XML Code:
<xml>    <listitem name="Battle 1" url="streams" thumb="battle1.jpg">        <stream name="battle1.flv" start="0" len="-1"/>    </listitem> 
    <listitem name="Fight!!!" url="streams" thumb="fight.jpg">        <stream name="fight.flv" start="0" len="-1"/>    </listitem>        <listitem name="Marco Diaper" url="streams" thumb="marcodiaper.jpg">        <stream name="marcodiaper.flv" start="0" len="-1"/>    </listitem> 
    <listitem name="Cheetah Cougar" url="streams" thumb="cheetahcougar.jpg">        <stream name="cheetahcougar.flv" start="0" len="-1"/>    </listitem>        <listitem name="Cloning" url="streams" thumb="cloning.jpg">        <stream name="cloning.flv" start="0" len="-1"/>    </listitem>        <listitem name="Run" url="streams" thumb="run.jpg">        <stream name="run.flv" start="0" len="-1"/>    </listitem>        <listitem name="Midgets 1" url="streams" thumb="midgets1.jpg">        <stream name="midgets1.flv" start="0" len="-1"/>    </listitem>        <listitem name="Midgets 2" url="streams" thumb="midgets2.jpg">        <stream name="midgets2.flv" start="0" len="-1"/>    </listitem>        <menu>        <listitem name="Battle 1"/>        <listitem name="Fight!!!"/>        <listitem name="Marco Diaper"/>        <listitem name="Cheetah Cougar"/>        <listitem name="Cloning"/>        <listitem name="Run"/>        <listitem name="Midgets 1"/>        <listitem name="Midgets 2"/>    </menu></xml>

This is my main actionscript file (VideoSourcePro.as), line 65 is where the problem is.

Actionscript Code:
bG_mc.setStyle ("backgroundColor", 0x404040);trans_mc.setStyle ("backgroundColor", 0x404040); 
mx.controls.treeclasses.TreeRow.prototype.drawRowFill = mx.controls.listclasses.SelectableRow.prototype.drawRowFill = function (mc:MovieClip, newClr:Number) {    this.setStyle("backgroundColor", 0x404040);    switch (mc._name) {    case "bG_mc" :        //Alpha when the row is not selected        var tempAlpha = 0;        break;    case "tran_mc" :        //Alpha when the row is selected        var tempAlpha = 10; 
        break;    default :        var tempAlpha = 10; 
    }    mc.clear();    //Here's the trick:    mc.beginFill(newClr, tempAlpha);    mc.drawRect(1, 0, this.__width, this.__height);    mc.endFill();    mc._width = this.__width;    mc._height = this.__height;    //Hide the main bg of component    list.depthChild0._alpha = 0;};//Set up the list box, call function VideoThumb to create the actual thumbnailslist.rowHeight = 70;list.cellRenderer = "VideoThumb";list.selectable = true;list.setStyle("color", 0xFFFFFF);list.setStyle("fontSize", 12);list.setStyle("fontFamily", "Verdana");list.setStyle("backgroundColor", 0x404040);listitem.setStyle("backgroundColor", 0x404040); 
title_txt.setStyle("color", 0xFFFFFF);title_txt.setStyle("fontSize", 12);title_txt.setStyle("fontFamily", "Verdana");title_txt.setStyle("backgroundColor", 0x404040);title_txt.setStyle("backgroundColor", 0x404040);//create new empty listener objectlistListener = {};//Function to handle what happens when an item in the list is selectedlistListener.change = function(evtobj) {    var nav = list.dataProvider[list.selectedIndex];    nc = new NetConnection();    //create a connection    nc.connect(null);    //null connection for progressive download    ns = new NetStream(nc);    //create a stream    video.attachVideo(ns);    //pipe stream to this video object    // walk through the chosen item, build and play it      var reset = true;    for (var i = 0; i < nav.childNodes.length; i++) {        var stream = nav.childNodes[i];        if (stream.nodeName == "stream") {            // build path to flv, and play it            myStreamPath = nav.attributes.url + "/" + stream.attributes.name;            title_txt.text = nav.name;            trace(nav.name + "_" + "title_txt");            ns.setBufferTime(10);            ns.play(myStreamPath);            reset = false;        }            }    };//Add an event listener on the list, when it triggers, run the listListener function to repopulate the listlist.addEventListener("change", listListener);//Function that loads the XML file, parses it, and builds the list of available video clipsvar xmllist = new XML();//setup a variable to hold the XMLxmllist.ignoreWhite = true;xmllist.load("playlist-demo-1.xml");//load the XML file//The following gets called when the XML has been loadedxmllist.onLoad = function(status) {    if (!status) {        trace(status);    }    var entries = this.childNodes[0];    var playlists = {};    var nav = [];    for (var i = 0; i < entries.childNodes.length; i++) {        var entry = entries.childNodes[i];        if (entry.nodeName == "listitem") {            //builds array of video clip names            playlists[entry.attributes.name] = entry;        } else if (entry.nodeName == "menu") {            //builds array of available videos            for (var j = 0; j < entry.childNodes.length; j++) {                nav[j] = playlists[entry.childNodes[j].attributes.name];            }        }        //end else if        }    //end if    //sends the array of videos to the listbox UI    list.dataProvider = nav;};//end xmllist.onload 
//resizes the video object to the width and height of the clip function onVideoResize() {    if (video.width != video._width || video.height != video._height) {        video._width = video.width;        video._height = video.height;        //center video in playback area        newx = (400 - video._width) / 2;        newy = (335 - video._height) / 2;        video._x = newx;        video._y = newy;    }}setInterval(onVideoResize, 200);//keeps checking video size

And this is the actionscript file which gets the thumbnails for the list (VideoThumb.as)

Actionscript Code:
class VideoThumb extends mx.core.UIComponent {    static var symbolName = "VideoThumb";    var label:Object;    // the new text label we'll use    var listOwner:Object;    // reference to the tree - supplied by the tree    var thumb;    var nc;    // NetConnection    var ns;    // NetStream    var streamurl;    function VideoThumb() {        // nothing needed - we're extending v2;    }    function init() {        // nothing needed - we don't have any instance variables to initialize    }    function createChildren(Void):Void {        // attachMovie (linkageID, new name, depth)        var v = this.attachMovie("VideoHolder", "thumb", 0);        v._width = 80;        v._height = 60;        v.styleName = listOwner;        var c = createLabel("label", 1);        c.styleName = listOwner;        c.selectable = false;    }    // pass all sizing from the tree to the cell    function size(Void):Void {        label.setSize(label.getPreferredWidth(), label.getPreferredHeight());        label._x = thumb._width + 10;        label._y = thumb._height / 2 - label._height / 2;    }    // str is the suggested string to render from the tree (based on the node)    // node is the entire XMLNode for the row    // sel is the selected state (not usually used)    function setValue(str:String, item, sel) {        _visible = item != undefined;        if (!_visible) {            return;        }        label.setValue(item.attributes.name);        //trace(item.attributes.name);        // Thumbnail is picked up as the first frame of the playlist        var url = item.attributes.url;        var stream = item.attributes.thumb;        var start = item.attributes.thumbpos;        //grab jpg thumbnail instead of initiating stream        var newClip = this.createEmptyMovieClip("thumbie", this.getNextHighestDepth());        newClip.loadMovie("thumbs/" + stream);        // If explicit thumb is not specified use the        // start frame of the first stream        if (stream == undefined) {            stream = item.childNodes[0].attributes.name;            start = item.childNodes[0].attributes.start;        }        // Give up if we still don't have valid thumb info         if (stream == undefined) {            return;        }        // Render the thumbnail only if necessary         if (streamurl == url + "/" + stream) {            return;        }        streamurl = url + "/" + stream;        //trace( streamurl );        trace(stream); 
            }    // ensures the cell is centered vertically properly - luckily, the label also implements this method.    function getPreferredHeight() {        return 60;    }    function getPreferredWidth() {        return label.getPreferredWidth();    }}

I've also zipped up the source files and uploaded them, they can be downloaded from here.

Thank you in advance.
James

Flash Text Field List. Line Break Makes Another Bullet
Hi yah, got a text field issue.
Bascically I have a dynamic html enabled text box with a list in it. The problem is that if I put a break tag in a list item it puts a line break in the text, but it also adds a bullet point to the beginning of the the new line.

Is there any way to have it not do this? It looks like there are two list items now, but i only want a break in the list items text.

Select ALL Text On Entry Into Dynamic Text Field
Is there a way to have ALL text selected when clicking into a dynamic text field? Tab works but i also need all the text to be highlighted when clicked on in the first place. Any ideas?

Justifying Html Text In Dynamic Text Field
i as'ed html text into dynamic text field, but i can only get it to align left, right or center.

is there anyway to justify the html text so that it looks good?

the example i'm talking about is seen here:

http://www.eight.nl/ttb/ttb.html

Copyright © 2005-08 www.BigResource.com, All rights reserved