LoadVars() w/ Dynamic Text
OK. My text file is: Who_txt=<HTML><BODY> yadda
yadda </HTML></BODY>
First frame code:
var txtWho_lv = new LoadVars();
txtWho_lv.onLoad = function() {
who_txt.htmlText = Who_txt;
txtWho_lv.load("../folder/folder/Who.txt");
When tested, I am only getting the following message in my
textbox:
level0.whotxt
I suggest you do not temp the Flash HTML parser with tags it
does not
understand. <html> and <body> are not understood
and may be the reason you
are seeing nothing as what happens in a web browser when you
feed it tags it
does not understand.
See:
http://livedocs.macromedia.com/flash/8/main/00001459.html
for supported
tags. You can go beyond that list with styles and CSS or
TextFormat.
Add a trace before the assignment to see what is in the value
From LuigiL's correct notation:
who_txt.htmlText = this.Who_txt; // this points to the
LoadVars object
trace (this);
trace ("this.Who_txt = ["+ this.Who_txt +"]");
The this inside of txtWho_lv.onLoad refers to txtWho_lv
Lon Hosford
www.lonhosford.com
May many happy bits flow your way!
"beevyarr" <[email protected]> wrote in
message
news:e2j0tr$ao$[email protected]..
actually, <HTML><BODY> work fine. All the tags
that I had prior weren't
supported.
And adding "this." prevents anything from being loaded into
the textField.
I
haven't really instantiated anything as "this." --- so...to
make things even
more difficult, once I get the text to load properly, I will
be placing the
movie within another movieClip, and will have to retarged
where the
LoadVars()
will load.
ps. Also having trouble getting my text to present as Full
Justified. I
have
it an Input TextField, Font embedded, and it appears Full
Justified when in
author mode, but onced published returns to Left Justified.
If I adjust to
Right or Center, they will publish, but Full Justified text
still won't.
Similar Messages
-
Help with delivering dynamic text through an external file, through XML?
I'm struggling to find the best way to deliver dynamic text
from an external file, through XML, to a Flash file.
I use small Flash pieces to deliver multiple sets of content
through a single .swf file. An example is here:
http://www.esi-intl.com/public/government/federal.asp
In the .swf file at the bottom, I'm using a three-scene .fla
file. I'm putting the actionScript in the Actions layer atop each
frame. Example:
stop ();
loadVarsText = new LoadVars();
loadVarsText.load("fedNews.txt");
//assign a function which fires when the data is loaded:
loadVarsText.onLoad = function(success) {
if (success) {
trace("done loading");
//Now that we know the data is loaded,
//set the text content of the Text Field
//with the instance name "scroller" equal to the
//contents of the variable
scroller.html=true;
scroller.htmlText = this.var1;
} else {
trace("not loaded");
In that .txt file, I'm putting the information like this:
var1=<font face="tahoma,verdana,sans-serif" size="11px"
color="#000000"><b><a href='
http://www.esi-intl.com/public/classroomtraining/dau.asp'>DAU
Grants ESI Course CON353
Equivalency</a></b><br>Advanced Business Solution
in Contracting (CON 353) is an equivalency for DAU's CON 3535
course, Advanced Business Solutions for Mission Support. <a
href='
http://www.esi-intl.com/public/classroomtraining/dau.asp'><U><font
color="#996633">Continue</font></U></a></font>
So much of this is pick-ups from what I've researched in
Google. I'm looking for a way I can feel more confident in my code,
and also have that code follow CSS.
Lastly, I recognize the problems in XML with using single
quotes / double quotes, and the & symbol. This is one of my
largest time sucks, and I'd like to find a better way to do this.
Thank youHi,
Did you ever find a resolution to this? I'm having a similar
issue that I can't seem to get multiline dynamic text working in
CS3.
The font is embedded but it just displays the first line, and
then a blank. I'm sure this worked fine in Flash MX.
Cheers, Ant -
Using loadVariables() to populate a Dynamic Text in a MovieClip
Hello everyone,
I am trying to populate a Dynamic Text with data from a
remote database. I have no problem populating the Dynamic Text with
the data from the remote database if the Dynamic Text is placed in
the main timeline using the following code.
loadVariables ("php/attorney.php", "");
Once I move the Dynamic Text into a Movie Clip with instance
name of “MC_But_1” I am only able to populate the
Dynamic Text if I place the above code in the movie clip. Since it
is going to take sometimes for the data to be transferred from the
remote database I rather to do this on the main timeline before the
MC_But_1 is shown. I have used the following code but for some
reason it is not working.
loadVariables ("php/attorney.php", _root.MC_But_1);
Can someone be kind enough to tell me where I am going wrong?
Thank you very much and have a great day.
Khoramdin> Since it is going to take sometimes for the data to be
> transferred from the remote database
That is one of the best arguments for abandoning
loadVariables() in
favor of LoadVars(). Check that out in the manual. It's
better because
there are events that get triggered when a data transfer has
completed
and you can write an event handler script to deal with server
responses.
Christian Scholz-Flöter -
Dynamic Text Feild with Dynamic Scroll Bar
I have a Dynamic Text Feild with a dynamic Scroll bar.
It loads a simple ASCI text file with some html formating.
but I still can not manage to get the text to format.
The biggest problem with the format is a big space between
paragraphs.
I am not sure why but I think the Frame must need a var to
render to html.
Can anybody help please?My text had the following, similar but no parsing string.
I guess
yourstring.split("\n\r").join("\r").split("\r\n").join("\r");
takes out the carrage returns or <br>?
I notice the one I had just say's String.
I assume that would be the text that is the string?
Thank you for sharing your knowledge of this.
var my_lv:LoadVars = new LoadVars();
my_lv.onData = function(src:String) {
if (src != undefined) {
myTxtFeild.text = src;
} else {
myTxtFile.text = "Error loading text.";
my_lv.load("CadnetPage1_html.txt"); -
Dynamic Text with external .txt files
I need help getting dynamic text to display. I've used the
following tutorials (among others).
http://www.kirupa.com/developer/mx/dynamic_scroller.htm
http://www.kirupa.com/developer/mx/multiple_dynamictext.htm
In Flash 8 on last frame of maintimeline of movie, I have a
layer with a background image, 2 buttons and a dynamic textbox
(made scrollable) with scrollbar component. Textbox is given a var
of "content", and an instance name of "textBox", which is
referenced in scrollbar parameters.
I have created 3 text .txt files, and saved them to same
folder with movie .swf file. Text in files is preceeded by
"content=" on line preceeding text to correspond with var of
dynamic textbox. The files were created in Rich text format on Mac
OSX4.11 and saved with .rtf extension, then file extension was
changed to .txt (wouldn't save as .txt)
I've added the following actionscript to this last frame:
loadText = new LoadVars();
loadText.load("TEXTintro.txt");
//creating the loadVarsText function
loadText.onLoad = function(success){
if (success){
textBox.text = this.content;
else{
trace("Error loading external content");
Buttons have an instance name assigned with the following
actionscript:
on (release) {
loadText = new LoadVars();
loadText.load("TEXT1.txt");
loadText.onLoad = function(success){
if (success){
textBox.text = this.content;
else{
trace("Error loading external content");
When I test movie, I can see buttons on last frame of movie,
but they don't load any text when pressed, and "undefined" text
appears in upper left corner of text box before I press either
button.
I am getting the following Output errors:
**Error** Scene=MoonOfWintertime, layer=TextBox,
frame=2500:Line 1: Statement block must be terminated by '}'
on (release) {
**Error** Scene=MoonOfWintertime, layer=TextBox,
frame=2500:Line 11: Syntax error.
**Error** Scene=MoonOfWintertime, layer=TextBox,
frame=2500:Line 1: Statement block must be terminated by '}'
on (release) {
**Error** Scene=MoonOfWintertime, layer=TextBox,
frame=2500:Line 11: Syntax error.
Total ActionScript Errors: 4 Reported Errors: 4No more output errors, buttons still not working, but I got
my intro .txt file to load in textbox that loads with frame using
the following code I tried from another tutorial:
loadText = new LoadVars();
loadText.onLoad = function() {
textBox.html=true;
textBox.htmlText = this.textContent;
loadText.load("TEXTintro.txt");
Tried the following code with buttons, but doesn't work.
Other code suggestions?
on (release) {
loadText = new LoadVars();
loadText.onLoad = function() {
loadText.load("TEXT2.txt");
on (release) {
loadText = new LoadVars();
loadText.onLoad = function() {
textBox.html=true;
textBox.htmlText = this.textContent;
loadText.load("TEXT1.txt");
} -
Dynamic Text Boxes / Resizing text boxes
I have a site with a dynamic text box that I have initialized
(I'm not sure that that is the correct term) at the beginning with:
myText = new LoadVars();
myText.onLoad = function()
{ textBox_txt.htmlText = this.content;
myText.load("text/bio.txt");
stop();
Then I have just used a text box throughout with the same
instance name, although sometimes I have it on a new keyframe. I
assumed I could just keep loading text into it on different frames
with:
stop();
myText.load("text/performances.txt");
This appears to be working, except that sometimes it seems to
be confused and the text box on a certain frame has the wrong text
in it. Do I have to initialize one for each frame in order for them
to display the right code? What could be causing it to load another
text file if it's frame action is telling it to load something
else? It seems unnecessary to have to re-initialize it for a new
text box instance in every new frame, but is that the way it has to
be done?
Also, I'm not clear on resizing text boxes. It seems like if
I use the width and height numbers to resize this text box on
different pages then it changes the size of the text inside, and
the scroll bar (the UIScrollbar) is a little squishy looking
sometimes. How does this work?
Thanks for any help.You will find it much better to create a new LoadVars object
for each of the frames, just call them myText1 myText2 etc.
The name of the text box instance in this case is irrelevant
but best practice would be to give them individual names.
As for the stretching effect use setSize() for UI
components. -
I'm having a small problem in my dynamic text box. For some
reason numbers are not being displayed correctly. I am working with
the Render Text as HTML box checked and am trying to get this
result :
01/15/09: No Meeting
01/15/09: Camping Trip
simple enough, however this is what i am ending up with:
1/1/: No Meeting
1/1/: Camping Trip
Here is the code i am using which returns the above result:
main_info.htmlText ="<p>01/15/09: No
Meeting</p>01/15/09: Camping Trip";
For whatever reason its not liking my numbers, is there
something that i am supposed to put in front of a set of numbers so
it displays it without thinking it is html code ?
Thanks for any help you can offer.I use this piece of code:
//Load Text
Stage.scaleMode = "noScale";
articleData = new LoadVars();
articleData.onLoad = function() {
box.htmlText = this.job1;
title.htmlText = this.title;
And its works fine on my computer(local), but when i upload
the files the text
dont appear.
I have tried to do another swf to test and the problem still
and i try to use
http://....same problem -
I am planning on building a website in flash with 90 percent
of the site in dynamic text. Will flash read the html tags in a
text file as text or html and code it as a browser would.yes, Flash will accept HTML tags, and there are a couple of
different methods to make this work. But in my limited experience,
it's a little tricky, and both require a little extra Actionscript
to make them function. I read some info about this in some of the
tutorials, but I can't point to them at the moment.
First, one can use use the ' yourtext_txt.htmlText =
yoursource_txt; ' method to read a plain text line that contains
HTML tags. However there are some parameters that need to be set up
before it will function properly, and there are several optionals
to choose from, but it seems most importantly to set the HTML
property to true as in ' yourtext_txt.html = true; ' but there
still are several different things requried, especially if your
looking for dynamic on-the-fly changes to different sections of
text. here's a snipit I'd been working on that uses a similar
system with arrays:
did that work, huh? thought I was adding code.
Another method is to use a CSS or by defining your own
stylesheet tags within Flash Actionscript. This method seems to
work better when using LoadVars, where you would define the
ContentStyle. First you define the StyleSheet, then apply it to the
dynamic text area (I'll try this again), here's a snipit: (OK I
think i get it the code will attach to the end of this post, so I
post the second set in a following post)
These are just some examples though, from my own
experimentations, and of course onw would define thier own
variables. I'm no expert, but I hope this gets you going, just a
few ideas. -
HTML links won't display in Dynamic Text Field
I am 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="
http://www.mapquest.com"
target="_blank">Click Here for Driving
Directions</a></html><br />
Thanks for the help,
ChuckThe error is here:
zloc_txt.text = this.content;
Even if you rendered the textfield as HTML, you still need to
tell flash that the variable you are inserting is HTML. Therefore
you need to use the htmlText property.
zloc_txt.htmlText = this.content; -
Getting Dynamic Text To Act Like Static Text
Hi, need help.
I currently have 7 text/symbols that each move to the right
when a button beneath expands in a mouseover.event.
Working fine.
With one exception: I need to set the text value of that text
dynamically using loadVars (the text is dates that vary).
No problem, I can do that with dynamic text, except for a few
somewhat ugly problems.
Problem 1 - I want the text just to display. The dynamic text
gets the I-Beam mouse cursor.
Problem 2 - Dynamic text lets the user select some or all of
the text, which then shows in highlighted color.
I don't want the user to have any interaction with the text,
and I'd like to have the "hand" mouse pointer over it, which
carries through from the button underneath, just like the static
text currently does.
I've tried the label component, but when you move it, it
evaluates the HTML that sets the color too slowly, so you only see
the start and end points. I've tried on (load) and on (draw), and
the text looks like it's taking a huge hop from starting point to
ending point, instead of moving gracefully across the real estate
(default is black, html makes it white).
Any idea how I can get text to move, to format, to get its
text at startup and still look like and act like it's the text on
top of a button?
I'd very much appreciate any help!
Thank you. Sign me stymied! :-)
Alan Arthur KatzProblem 1 and 2: Set the textfields to not be selectable in
the Properties panel. If that's not a solution, say a little more
about how you have it pieced together. -
How to load dynamic text inside a movie clip?
hello all - i have a main stage where on the first frame my
"home" movie clip displays. i did this by dragging/dropping, and
then i put a stop action. all works fine.
inside this home movie clip on the main stage, there are
links to other movie clips. for example, to get to my faq's page -
you click that button, then it takes you to frame 4 on my main
stage, where my faq's movie clip (followed by stop action) has been
dragged/dropped and displays properly.
within the faq's movie clip this process is repeated, with
buttons taking to you various pages (different frames where
different movie clips play - all works fine).
so now i want to add a dynamic text field within my faq's
movie clip. i have read numerous tutorials where i have created the
text file but i have not been able to display it with success
within my faqs movie clip.
here is some code that my dvd tutorial instructs me to place
on main stage as i practice getting this to work:
var myMCL:MovieClipLoader = new MovieClipLoader ();
var myListener:Object = new Object();
myMCL.addListener(myListener);
var myLV:LoadVars = new LoadVars();
myLV.onLoad = function (success:Boolean) {
if (success) {
_level5.loadedInfo.htmlText = myLV.info;
} else {
_level5.loadedInfo.text = "There has been an error loading
the requested information. Please contact the webmaster.";
and here is some code that i place on the faqs button within
my main movie clip that takes me back to main stage and plays faq
movie clip all successfully:
on (release) {
//Movieclip GotoAndPlay Behavior
_root.gotoAndPlay("4");
//End Behavior
and finally, here is some code that i place within my faqs
movie clip in an attempt to display my dynamic text within the faqs
movie clip - so far unsuccessful:
_level0.myLV.load("vars/faqs.txt");
NOTE:
i have published this to view - not working.
i have my faqs text file starting as info=
i have eliminated white space within my text file
i am using flash 8 pro
can anyone offer some sugestions? thanks!hmmmmm lemme double check as i seem to be a bit lost now.
// this is my actions layer code on frame 4 of main timeline:
stop();
var myLV:LoadVars = new LoadVars();
myLV.onLoad = function (success:Boolean) {
if (success) {
_level5.loadedInfo.htmlText = myLV.info;
} else {
_level5.loadedInfo.text = "There has been an error loading
the requested information. Please contact the webmaster.";
myLV.load("vars/faqs.txt");
1. fyi - at frame 4 on main timeline, one layer beneath the
actions layer where i dragged/dropped my faqs movie clip i gave my
faqs movie clip an instance name of "mainfaqs" - although nowhere
do i refer to this specific mc within my code.
2. where would i replace/insert the following code?
_level0.faq_mc.loadedInfo.text = myLV.info;
3. i didn't know about embedding font but i saw the option
and embedded it - still no results.
4. i'm not sure how to do the following:
_level5.loadedInfo.text ='test'; //although I would still
change the path as above
To see if your getting a return from the load call adn text
file, use a trace statment before the success condition and see
what it returns:
trace(myLV);
sorry to be such a pain - i really have looked around for
answers through previous postings and i googled it and i've been
taking instruction through lynda.com and dvds but i seem to be
stuck here.... as always - thanks for your time -
Hello
I've created a button "link1" and a dynamic text box
"my_dynamic_text". When i click on the link i want it to load my
text. For the text loading I followed this link
EXAMPLE
But i get some errors
**Error** Scene=poetry, layer=link1, frame=1:Line 5:
Statement must appear within on handler
myData = new LoadVars();
**Error** Scene=poetry, layer=link1, frame=1:Line 7:
Statement must appear within on handler
myData.onLaod = function(success){
**Error** Scene=poetry, layer=link1, frame=1:Line 15:
Statement must appear within on handler
myData.load("C:/Users/Shevi/Web Sites/Archi
Baldo/photo1.txt");
Total ActionScript Errors: 3 Reported Errors: 3
any idea??
Thank youHi Brian,
thanks for your help, this works.
But, do you know if I can specifiy the file path in an database field and crystal reports will load the file from the specific path.
Background:
I have descriptions for items and every item has its own description file.
If I create the report for item 1 I want to show the item description for item 1, when I create the report for item 2 then I want to show the item description of item 2 etc.
Thanks
Jacqueline -
Dynamic text doesnt load in container
hey,
like the headline says i have a problem wit a dynamic text which i load from a .php file
Just in a container, if I load it on its own it works correctly
example: www.borgball.at.tc (Gästebuch)
www.borgball.at.tc/gaestebuch.swf
its the same file both times.
Structure: Main(root)-->container
code:
count = new LoadVars();
this.onEnterFrame = function(){
if(main.maxscroll > 1){
main_balken._visible = true;
}else{
main_balken._visible = false;
count.load("count_guestbook.txt?nocache="+new Date().getTime(), 0);
count.onLoad = function(ok_1) {
if (ok_1) {
counter.text = this.zahlguestbook;
} else {
counter.text = "0";
read = new LoadVars();
//read.load("guestbook.txt?nocache="+new Date().getTime(), 0);
read.load("auslesen.php?nocache="+new Date().getTime(), 0, "POST");
read.onLoad = function(ok_2) {
if (ok_2) {
mainframe.htmlText = this.main;
} else {
mainframe.htmlText = "<b><br>Keine Einträge vorhanden!</b><br>Text konnte nicht geladen werden!";
signal = 0;
stop();this is the index.html page that i'm loading and it's not correct:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Powered by FlashVillage.com</title>
<style type="text/css">
<!--
* { margin:0; padding:0; }
html { height:100%;}
body {
height: 100%;
overflow:hidden;
.Stil1 {color: #000000}
-->
</style>
</head>
<body>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="100%" height="100%" id="index" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="index.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#000000" />
<embed src="index.swf" quality="high" bgcolor="#000000" width="100%" height="100%" name="index" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</body>
</html> -
Put PHP Content into Dynamic Text Field
How do I put the contents of a php document into a dynamic
text field in a Flash document? Thanks.
GDo you mean an html document generated from a PHP script?
Do you mean the source of a PHP script?
Probably you mean you want to format a page such as a PHP
script would do.
That is done either manually inside a Flash movie or
dynamically via
Actionscripting. Then you only send data back and forth
between PHP and
Flash using either the LoadVars or the XML Actionscript
classes. You can use
HTML inside of Flash TextField objects but again that will be
data sent from
the PHP server script.
Here are some basic examples I use in Flash seminars you can
look at:
http://www.hosfordusa.com/ClickSystems/courses/flash/examples/LoadVars/LoadVarsEx01.php
http://www.hosfordusa.com/ClickSystems/courses/flash/examples/LoadVars/Ex02/LoadVarsEx02.p hp
http://www.hosfordusa.com/ClickSystems/courses/flash/examples/GenerateFlashObjectsFromPHP/ Ex01/GenerateFlashObjectsFromPHPEx01_Doc.php
http://www.hosfordusa.com/ClickSystems/courses/flash/examples/XMLPHP/EX01/XMLPHPEchoEx01_D oc.php
You also want to look at the docs for LoadVars and XML
sendAndLoad methods:
XML
http://livedocs.macromedia.com/flash/8/main/00002879.html
LoadVars
http://livedocs.macromedia.com/flash/8/main/00002336.html
Lon Hosford
www.lonhosford.com
May many happy bits flow your way!
"gena.wenli" <[email protected]> wrote in
message
news:e5g6av$lpv$[email protected]..
How do I put the contents of a php document into a dynamic
text field in a
Flash document? Thanks.
G -
Tables in dynamic text field???
Hi,
I am trying to organize an html text in flash dynamic text
field into tables, I tried using
testText=<textformat
tabstops='[50,100]'><b>Name\tAge\tDepartment</b>\nTim\t32\tFinance\n<u>Edwin</u>\t46\tMar keting</textformat>
but this works only when text variable testText is set inside
flash script. When loaded dynamicly using LoadVars all
<textformat tabstops... tabs are just not seen and are omitted.
I tried to google some answers and I found that textformat tabs
work only for embedded text. Ok, so I used actionscript command
myText.embedFonts = true;
but then I lost all visible text. How come that Flash doesn't
have some easy way to create so basic thing as tables? Thanks for
any answer,
Zbynek
here is my fla script:nobody any ideas?!
Maybe you are looking for
-
PO line item text copied into Line item text on MIRO
i have entered line item text on the PO that i would like to get copied over to the line item of the invoice when created either thru MIRO or MIR7. I have looked and it looks like the copy rule for item text is in TEFP, but i have not got it to work
-
I have 2 external HD firewire: 120Gb Firewire 400 and 500Gb Firewire 800. They work fine EXCEPT when I connect both HD to my PB. I have to use 1 at a time, not together. Do I have to do something to use them togheter? Its both LaCie HD PB G4 17" 1.67
-
Basic query regarding work-area and select query
hi dear sdn members, thanks too all for solving all my query's up till now i am stuck in a problem need help 1) why basically work-area has been used ? the sole purpose 2) different types of select query ? only coding examples note: no links pls re
-
Delivery Type Not Defined.
Dear All, User has created a (subsequent del.free of charge) sls order. Fine. At the time of creating delivery, system shows the del screen but it doesnt fetch the data frm the order, when i see the log it cries "Del type zsdf is not defined" . Obvio
-
Regarding Event Flow in Flex.
Hi all, i have a doubt may be silly but i need an clear idea on this, Actually coming to events the event flow occurs in 3 phases capturing,targeting and bubbling phases. Now suppose inside my application (Main Applic