Loading Data From A Text File Into A TextArea
I'm actually tryin to load links (from an array) from a text file into a textArea... This is basically so that I can "edit" the html in the textArea, then I have a save Changes button then php saves the text file on the server. But I cant get the data to load into the textArea. Could somebody help me out with that?
FlashKit > Flash Help > Flash ActionScript
Posted on: 12-23-2005, 09:05 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Pls Help~ Loading Data From Text File Outside
Hi there,
As you can see from my file. It's a map made in flash.
I need to use the external text file to control which country is under "alert" mode and play the animation.
I've created the flash able to trigger single country alert. However, it's not enough and I need to make it detectable for multiple country on alert mode.
First I think of using Array to assign each country as follow:
areaArray = new Array();
areaArray[0] = "australia";
areaArray[1] = "bangladesh";
areaArray[2] = "brunei";
.
.
.
etc.
then I dont know how to get the data from the text file and checking which country is turnned on alert.
I know my explaination isn't clear as I am from hong kong. I hope anyone could help me here.
Please get my fla and txt file and help me on this. Thanks alot!!!
Pls Help~ Loading Data From Text File Outside
Hi there,
As you can see from my file. It's a map made in flash.
I need to use the external text file to control which country is under "alert" mode and play the animation.
I've created the flash able to trigger single country alert. However, it's not enough and I need to make it detectable for multiple country on alert mode.
First I name all the movie clips instance in different country names
then I use the Array to assign each country as follow:
areaArray = new Array();
areaArray[0] = "australia";
areaArray[1] = "bangladesh";
areaArray[2] = "brunei";
.
.
.
and so on.
//then i use the following to get the number from txt.file also use this no. to make the movie instance play the alert animation
var externalData:LoadVars = new LoadVars();
externalData.load("data1.txt");
externalData.onLoad = function(){
mydata = externalData.val;
trace(mydata);
i = eval(areaArray[mydata]);
i.gotoAndPlay("alert");
}
but I dont know how to make it working in multiple countries in alert mode.
I know my explaination isn't clear as I am from hong kong. I hope anyone could help me here.
Please get following files and help me on this. Thanks alot!!!
Loading Data From A Text File Into An Array?
I thought I had it working but alas no I don't.
I've got an Array called
mun = new Array();
I some dynamic text fields that I have called mun[0] mun[1] and so on....
I have a text file that has
mun[0]=Toronto&mun[1]=Barrie...and so on
when I run my flash file I can see that the textfields get filled in with the loaded data properly but I also have a button that when you rollover it, it executes the action
municipality = mun[0];
I have a text field named municipality but it seems my rollover doesn't work with the loaded variables.. But it does work when I create the array within flash...
mun = new Array("Toronto","Barrie");
Help me pleasee....
thanks
Jason
Loading Text File, Want Numeric Data
Greetings All
I am trying to load some data out of two different text files, and display it to the screen, when this displays i get NaN, but when displaying just Variable A, I get "undefined".
The two text files, A.txt contain the number 1, B.txt contains the number 10 (only no other text)
How do I import the data from a text file to a numeric variable i can use elsewhere?
Here is the code I have:
var A_Pull:LoadVars = new LoadVars();
A_Pull.load("A.txt");
A_Pull.onData = function(NA) {
var A:Number = NA;
};
var B_Pull:LoadVars = new LoadVars();
B_Pull.load("B.txt");
B_Pull.onData = function(NB) {
var B:Number = NB;
};
var The_Total_Count:Number = A + B;
_root.display.text = The_Total_Count;
Problems Loading In Data From Text File
Hi all,
Im trying to read from a text file into a number of dynamic text boxes.
I pass the function below the:
file name,
name of the dynamic text field ( minus the index number , eg box, for a set of box1, box2...) ,
name of the fields in the text document (minus index number as above),
Number of dynamic text boxes.
with this function call:
loadTextFile( "myText.txt", "dymTextBox", "field", 3 );
Code:
// Creates a new instance of the LoadVars object and assigns it to the variable lv.
var lv = new LoadVars();
// Assign _parent property with the line lv._parent = this.
lv._parent = this;
loadTextFile = function( fileName, textBoxName, fieldName, numTextBox )
{
var newTextBox;
var newField;
lv.onLoad = function()
{
if( lv.load( fileName ) )
{
for( var i = 1; i <= numTextBox; i++ )
{
textBoxName.concat( i ).text = lv.fieldName.concat( i );
}
}
}
lv.load( fileName );
}
The problem is that nothing happens. Could it be that that the names for the text boxes have become dissasociated with the actual text box objects?
Im stumped.
Dave.
[F8] Loading Data From Text File Into ListBox
I have data in a text file that I want to load into a listbox... I have fully mastered handling strings and arrays so I'm going to need some help...
I was wondering how do I get flash to load a text file that contains the data below.. and display it line for line like I want it to list down the component
"Launch;7.1.7.6"
"Engine;7.1.7.6"
"OSX;7.0.0.2" (or something close to that)
and I was wondering how do i just get it to take it fromt he file.. line for line from where it says exeversion in the file and list it in the listbox...
I'm really thankful to anybody that helps.
Data in text file:
Code:
exeversion=Launch;7.1.7.6;
exeversion=Engine;7.1.7.6;
exeversion=LinuxX86;7.0.0.2;
exeversion=LinuxPPC;7.0.0.2;
exeversion=LinuxMIPS;7.0.0.2;
exeversion=OSX;7.0.0.2;
exeversion=Config;7.1.7.6;
exeversion=UI;7.1.7.7;
exeversion=JAVA;7.0.4.5;
Loading In Array Data From A Text File.
I'm trying to use a text file to load in some configuratin data (using actionscript 3) I have it working ok for simple stuff like gamename=Chess&gamescore=100 , etc... but some of the data needs to be in an array. Can someone please point me in the right direction to how I can read in an array from a text file?
Thanks!
Loading Data From Text File Into ListBox
I have data in a text file that I want to load into a listbox... I have fully mastered handling strings and arrays so I'm going to need some help...
I was wondering how do I get flash to load a text file that contains the data below.. and display it line for line like I want it to list down the component
"Launch;7.1.7.6"
"Engine;7.1.7.6"
"OSX;7.0.0.2" (or something close to that)
and I was wondering how do i just get it to take it fromt he file.. line for line from where it says exeversion in the file and list it in the listbox...
I'm really thankful to anybody that helps.
Data in text file:
quote:exeversion=Launch;7.1.7.6;
exeversion=Engine;7.1.7.6;
exeversion=LinuxX86;7.0.0.2;
exeversion=LinuxPPC;7.0.0.2;
exeversion=LinuxMIPS;7.0.0.2;
exeversion=OSX;7.0.0.2;
exeversion=Config;7.1.7.6;
exeversion=UI;7.1.7.7;
exeversion=JAVA;7.0.4.5;
Loading Html Data From A Text File
i have a code that will load text from a text file and put it in a dynamic text field:
loadText = new loadVars();
loadText.load("main.txt");
// creating the loadVarsText function
loadText.onLoad = function() {
Content.text = this.start;
};
Thats good and all but, i want it to load it and process it as html cause i was going to put this in the text file(main.txt)...
Hello, contact me at <a href="me@myserver.com">My Email address</a>
I dont want it to say exactly that, i want it to say it as text with a link, i dont want to make the text filed html like that button does becuase it goes all white and i want the background like there would be on a text field,
Note: this text field is dynamic
Loading Data From Text File Into Variables
Hey,
I am trying to load variables from a text file into a variable in my Flash movie, and then parsing that data into an array. I can get the read to work fine if I read the data into a dynamic text field, but not when I just want to read it into a variable behind the scenes in Flash.
The text document contains something like the following:
news=Item 1|||Item 2|||Item 3
Then in Flash I have:
Code:
loadVariablesNum("news.txt", 0);
someArray = news.split("|||");
I have a text field called txt1, and if I change the var in the text document to txt1=... then the text field becomes equal to the value of the text. This is not what I want however, as I need to parse the data first.
Any ideas what I am doing wrong?
Thanks!
Loading Data From Text File To Multidimensional Array
New to Actionscript here so please bear with me, I'm trying to learn. I'm developing a simple application which loads specific information based on user input. The code below works fine and does exactly what I want, however, I want to be able to load the raceInfo multidimensional array information from an external text file. I've read alot about doing this but have not been successful and am somewhat frustrated. Can someone help me and teach me how to get that information from a text file? Thanks in advance!
//Multidimensional Array
raceInfo=[["1","Bob Smith","Fast","Slow as Lightening"],["2","John Doe","Speedy Car","Running Fast"]];
var testText1 = testText1_txt.text;
var testText2 = testText2_txt.text;
//trace(testText1);
//trace(testText2);
loadBtn.onRelease = function () {
for(i=0;i<raceInfo.length;i++) {
if(testText1 == raceInfo[i][0]) {
_root.createEmptyMovieClip("container1",1);
container1.loadMovie("/scoutpics/" + testText1 + ".jpg");
container1._x = 150;
container1._y = 150;
scoutName1_txt.text = raceInfo[i][1];
carNumber1_txt.text = raceInfo[i][0];
carName1_txt.text = raceInfo[i][2];
slogan1_txt.text = raceInfo[i][3];
}
}
for(i=0;i<raceInfo.length;i++) {
if(testText2 == raceInfo[i][0]) {
_root.createEmptyMovieClip("container2",2);
container2.loadMovie("/scoutpics/" + testText2 + ".jpg");
container2._x = 650;
container2._y = 150;
scoutName2_txt.text = raceInfo[i][1];
carNumber2_txt.text = raceInfo[i][0];
carName2_txt.text = raceInfo[i][2];
slogan2_txt.text = raceInfo[i][3];
}
}
resetBtn.onRelease = function () {
testText1_txt.text = "";
testText2_txt.text = "";
container1._visible = false;
container2._visible = false;
scoutName1_txt.text = "";
scoutName2_txt.text = "";
carNumber1_txt.text = "";
carNumber2_txt.text = "";
carName1_txt.text = "";
carName2_txt.text = "";
slogan1_txt.text = "";
slogan2_txt.text = "";
}
}
How Can I Get The Selected Text Data From A Textarea In Flash 8?
Hi All,
Im using a text area and we are having some kind of embedding the swf in MFC application doing all the communication through external interfacing and adding callbacks to the nth degree. Joking..
Fine, I need to copy the selected text from the text area to the clipboard. I could could copy the whole text from the textarea to the clipboard, but how can i copy only the selected text to the clipboard? I couldnt find any textarea.selectedText or any help online for selected text manipulation.
Can anyone here help me??
Thanks in advance,
Kolar
Saving Data And Loading Data From A .txt File...
Hi,
I know there's a way to do it but i just couldn't get the right tutorial around..
I have read through Shared Objects but i couldn't get it work...
I just have to save my data, maybe array into .txt file and later on
retrieve from the same .txt file...
Anyone here have an example or some source code so i can have reference on it?
Thanks for the help provided....
Regards,
Lacus
How Is Externel Text File Loaded Into TextArea?
Hi, Flash gurus,
I want to ask how could I use TextArea component for loading HTML formating text from externel .txt file (or other text containing file format)?
If it is possible, write step-by-step tutorial, because I have only "under basic" knowledges about how Flash works.
P.S. Sorry for possable grammatical mistakes. English is not my native language.
Thanks,
mademan.
Is There Anyway To Read Data In From A Text File And Populate An Array With The Data?
hello,
i'm new to flash, and i'm trying to create a photo gallery. however, the photos may not always be the same, and i need to have a way to easily change the pictures without having to go back into flash to change the code everytime. i thought a good way to do this would be to read the names of the pictures in from a text file and then use those names to populate an array, similar to the tutorial on creating a photo gallery on kirupa.com. the problem is, i have no idea how to do this. anyone have any ideas?
thanks
Is There Anyway To Read Data In From A Text File And Populate An Array With The Data?
hello,
i'm new to flash, and i'm trying to create a photo gallery. however, the photos may not always be the same, and i need to have a way to easily change the pictures without having to go back into flash to change the code everytime. i thought a good way to do this would be to read the names of the pictures in from a text file and then use those names to populate an array, similar to the tutorial on creating a photo gallery on kirupa.com. the problem is, i have no idea how to do this. anyone have any ideas?
thanks
Loading Html Text To TextArea Component With Xml
I played around with this Macromedia tutorial - Bike Trips Sample Application: Using the XMLConnector Component in Flash MX Professional 2004
In the tutorial, the TextArea loads the text straight from the XML file.
I'm thinking of using the XML file to call in a HTML file to be loaded into the TextArea component. Is it possible?
In the attached sample, I turned on TextArea component html to true. And add in myscript to load mystyles.css for the Text Area component. But I have to copy my test example HTML file (article1.htm) codes into the XML data file.
I wanna skip the copy-and-paste and simply link the <description> in the XML file to a path or url to load the HTML file like article1.htm
Possible?
Thanks in advance.
Attached test example
Load Text File Data (No Variable In Text File )
Hi everyone,
In Flash Mx,
How can i load data from the text file ??
I know its easy using variables but..
There is only text, no varibales like -- Name=bla bla
in the text file
So, how can i load all the data from the text file in a varibale(I am not getting any variable from the text file, getting only data) ??
Thanx in advance,
$hailesh Mewada
Loading Data From XML File
Hello all,
I have a flash file does the following:
- reads from an XML file
- parses the data into two arrays (one containing the paths to 3 images, the other array contains the paths to 3 different websites)
- rotates the display of the three images (when clicking on the first image, user will be directed to the corresponding website, etc.).
I noticed that my flash file was loading slowly. I tried lots of things to speed it up and realized that the reading of the XML file was actually slowing it down significantly. If I hard code all the values in the array, the flash file takes very little time to load, whereas with the XML file it lags.
I have pasted below this message the code I'm using to open/parse my xml file. Also, for your knowledge, my XML file is very small. It only contains three records (one for each item), each of which contains a couple of attributes.
I would really appreciate it if someone could take a look and share any best practices when using XML to populate data in a flash file.
Many thanks in advance!
---
xml_file = new XML();
xml_file.ignoreWhite=true;
xml_file.load('index.xml');
xml_file.onLoad = parse;
function parse(success) {
if (success) {
//root element of xml file:
root = xml_file.firstChild;
//sets total number of items to cycle through:
_global.numberItems = root.attributes.items;
// PARSE XML:
itemNode = root.firstChild;
i = 0;
while (itemNode != null) {
_global.imagesArray[i] = itemNode.attributes.image;
lv = new LoadVars();
lv.load(_global.imagesArray[i]);
_global.linksArray[i] = itemNode.attributes.link;
i++;
itemNode = itemNode.nextSibling;
}
}
}
Loading Data From A Php File
So I have created a php file which grabs data from a MYSQL database. I just need to know the syntax for reading in my data.
count is specified in my output of my php file.
Code:
myData = new LoadVars();
myData.onLoad = function()
{
getData();
};
myData.load("flash_helper.php");
getData = function()
{
count = parseInt(myData.count);
for (i=0; i < count; i++)
{
//THIS LINE IS THE PROBLEM, RIGHT NOW MY OUTPUT IS 0,1 INSTEAD OF THE COLLEGE NAME
myListBox.addItemAt(i, myData.collegeName+i);
}
};
Thanks
Loading Data From Xml File - Please Help
Hi, I am new to attempting to get data from an xml file load in flash. I followed a tutorial in a new fla and it seemed to work fine, I then tried to adapt it to my own needs which worked fine. But then when trying to implement this into my news section it doesn't seem to work.
I am trying to make a news section, that displays the date and news article. This is in within a movie clip, I even tried putting it in the timeline of the scene but still nothing.
- I have 2 dynamic text boxes, date_txt and news_txt
- The xml file is named news.xml,
- both the fla and the xml are in the same folder
This is the actionscript I am using:
function loadXML(loaded) {
if (loaded) {
_root.thedate = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
_root.thenews = this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
date_txt.text = _root.thedate;
news_txt.text = _root.thenews;
} else {
trace("file not loaded!");
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("news.xml");
This is what I have in the xml document:
<?xml version="1.0"?>
<news>
<article>
<date>date</date>
<news>newentry.</news>
</article>
<article>
<date>Doug Engelbart</date>
<news>Invented the mouse at the Stanford Research Institute</news>
</article>
</news>
Does anyone perhaps have any ideas of what the problem could be?
Help much appreciated.
Edited: 01/26/2008 at 07:34:20 PM by sammyfb
Loading Data From External Txt File
Hey everyone --
I wrote a dynamic menu builder in Flash that takes in a whole slew of variables from an external text file. It's posted at http://speed.doit.wisc.edu/~scferman/dmb/ (swf, fla, and txt files) if you want to take a look. Briefly, I have a loop running to make sure it gets to the end of the external variable file before the menus are built. Here are several problems I've encountered in trying to use this menu system. These problems seem to occur MOSTLY when the code is used on an HTML page with a lot of other stuff on it.
1. Variables don't always appear to get loaded... sometimes the text labels (which are strings stored in those external variables) don't appear.
2. Sometimes the entire thing doesn't show up in Netscape. specifically, Netscape 4.7 on a laptop, slower connection.
3. I'm using a getBounds() technique to track if the mouse is over a button (not using the on (rollover) on a button) but that seems to be a little jumpy.... it seems as if my mouse pointer position isn't registered as quickly as I'd like, so the sub menus sometimes don't disappear when I roll off, or mousem movement within a single sub menu sometimes causes that sub menu to disappear even though I'm technically still on the sub menu.
4. Positioning of duplicated movie clips looks fine in Flash but sometimes has gaps or is slightly off when used in an HTML page with a bunch of other stuff.
If anyone has a chance or wants to help alleviate my extreme frustration, these are the issues I'm having. I sincerely appreciate any advice you can give! And if you want further documentation on how I built this, or if you want to use it, please let me know, it's yours!
Thanks in advance!
Shannon
Loading Only String Data From TXT File
I am familiar with loading variables in from an external TXT file, where the variables are defined within the TXT file, but how would I go about loading a text file so that the entire contents of the text file are taken in as one string?
Mainly, I need to get data in from a text file and I CANNOT add variables into this text file. Is there any way to do this?
URL Data Into TextArea
I'm using a simple text form to feed info to an active page. A sample URL string would be:
http://website.com/active.asp?name=someone&thing=something&place=here
where the variables are: <%=name%> <%=thing%> <%=place%>
I know how to pull data from an XML file to display in a TextArea in Flash, but I can't figure out how to make the transition to pulling the data from a URL string. Any help or guidance would be appreciated. Thanks.
Loading External Data From A .txt File Hosted Elsewhere
I'm trying to access this following .txt file on another site of mine. The argonews.com site is one of mine which currently hosts the Flash program - and it works there. But if I load this elsewhere, it doesn't load the file.
_root.loadVariables("http://www.argonews.com/mondo/update.txt");
Am I missing something? Or does remote access not work.
Thanks in advance...
Jonas Stoltz
Loading External Data From A .txt File Hosted Elsewhere
I'm trying to access this following .txt file on another site of mine. The argonews.com site is one of mine which currently hosts the Flash program - and it works there. But if I load this elsewhere, it doesn't load the file.
_root.loadVariables("http://www.argonews.com/mondo/update.txt");
Am I missing something? Or does remote access not work.
Thanks in advance...
Jonas Stoltz
Loading Data From Xml File...strange Conflict?
Hi,
I am loading some data from an xml file into an array in the second frame. In the third frame I am loading data from a text file.
When I go back to the 2nd frame from the third the data no longer seems to be in the array from the xml file.
I am honestly not competely sure that is the problem as things are getting convulated...BUT does anyone see anything inherently wrong with the setup described above?
Thanks,
Fed
Loading And Saving Data From External File
http://www.kirupa.com/developer/mx/externaldata.htmi saw this tutorial in this website. But i am just wondering what if i have more than 1 records, how do i load it from the text file, and how do i save multiple records into the text file ? can anyone provide a simple guide to teach me how to do it ?? thanks a lot ~~
Problem With Loading Data From Xternal Txt File
HiThis is the script that I use to load data from 2 txt files to a dynamic text:
Quote:
myData = new LoadVars ()
myData.onLoad = function () {
myText.html = "true"
myText.htmlText = this.var1
}
btn1.onRelease = function () {
myData.load("file1.txt")
}
btn2.onRelease = function () {
myData.load("file2.txt")
}
How to make btn2 load var2 from the txt file1, I know that I can make it if I attached a script on each button, but this is not what I want to do .
can I create a function that call the specific peace of data relating to the btn name from one txt file ?
so btn1 call var1 from txtfile1, btn2 call var2 from the same txt file1 and so on …?
i tried to make like this :
Quote:
btn2.onRelease = function () {
myData.load("file1.txt")
myText.htmlText = this.var2
}
but it didn't work .
i hope that you can help me .
Thank you for your help in advance.
Loading Data Into Flash Array From An XML File
Hi,
To keep things simple I will just ask the question verses explaining why I want this functionality.
Say I have:
var sString:String = "1,2,3,4,5,6"
var aArray:Array = new Array(sString)
When I trace the aArray.length, obviously it is 1. What I would like is if aArray would see the string as if I did this:
var aArray:Array = new Array("1","2","3","4","5","6")
I understand that I could run a for loop on the string and with each iteration put in the data, but this seems sloppy, is there a better way?
Thanks,
waffe
Loading Data From Xml File...strange Conflict?
Hi,
I am loading some data from an xml file into an array in the second frame. In the third frame I am loading data from a text file.
When I go back to the 2nd frame from the third the data no longer seems to be in the array from the xml file.
I am honestly not competely sure that is the problem as things are getting convulated...BUT does anyone see anything inherently wrong with the setup described above?
Thanks,
Fed
Loading And Saving Data From External File
http://www.kirupa.com/developer/mx/externaldata.htmi saw this tutorial in this website. But i am just wondering what if i have more than 1 records, how do i load it from the text file, and how do i save multiple records into the text file ? can anyone provide a simple guide to teach me how to do it ?? thanks a lot ~~
Sending And Loading Data Form A Php File
Hi
I don't know how i could send data between a flash file and a php file.
I know that I need to use the FileReference class.
But I don't know how to use that.
I'f search on the internet but i could not find a good tutorial.
Thanks in advance.
Loading Data Into Flash Array From An XML File
Hi,
To keep things simple I will just ask the question verses explaining why I want this functionality.
Say I have:
var sString:String = "1,2,3,4,5,6"
var aArray:Array = new Array(sString)
When I trace the aArray.length, obviously it is 1. What I would like is if aArray would see the string as if I did this:
var aArray:Array = new Array("1","2","3","4","5","6")
I understand that I could run a for loop on the string and with each iteration put in the data, but this seems sloppy, is there a better way?
Thanks,
waffe
Loading Binary Data Into Flash From An External File.
Does anyone know if it is possible to load binary data into flash from an external file, it has been sugested maybe using XML commands - like when you load a ROM into an emulator. It doesn't have to be whilst running though it could be when it is compiled however it would be nice to be parsed on the fly like a proper emulator!
Any help would be great so thanks in advance to anyone who helps.
Gary
Loading Data From An External File - Formatting Options
I am Loading data from an external text file into my Dynamic Text Boxes and would like to inquire about Text Formatting Options for the txt file.
Customer is editing plain text in the txt file and then uploading to the server. We have no control of how the text looks besides using the "&" for returns and to start and end the var names.
Do I have any control over how the text is displayed?
I understand that I can set font size, color within the Dynamic Text box itself but I want to control layout and everything from the text file.
If not, are we talking XML? If so, what are those options.
Much Thanks!
Daniel
Loading Data From An External File - Formatting Options
I am Loading data from an external text file into my Dynamic Text Boxes and would like to inquire about Text Formatting Options for the txt file.
Customer is editing plain text in the txt file and then uploading to the server. We have no control of how the text looks besides using the "&" for returns and to start and end the var names.
Do I have any control over how the text is displayed?
I understand that I can set font size, color within the Dynamic Text box itself but I want to control layout and everything from the text file.
If not, are we talking XML? If so, what are those options.
Much Thanks!
Daniel
Calling A List Of XML Data Into A TextArea
I'm planning to call a list of data from an XML file but when I duplicate the content inside the <data></data> it is not showing anything
ActionScript Code:
import fl.controls.ComboBox;
import fl.controls.TextArea;
import fl.containers.UILoader;
//Component Style
import fl.managers.StyleManager;
var xmlLoader:URLLoader = new URLLoader();
var dataURL:URLRequest = new URLRequest("data.xml");
xmlLoader.addEventListener(Event.COMPLETE,xmlLoaded);
xmlLoader.load(dataURL);
var tFormatHead:TextFormat = new TextFormat();
tFormatHead.bold = true;
tFormatHead.size = 12;
tFormatHead.font = "Arial";
var albumFormat:TextFormat = new TextFormat();
albumFormat.font = "Arial";
albumFormat.size = 12;
albumFormat.bold = true;
//StyleManager.setStyle("textFormat", albumFormat);
var dataXML:XML = new XML();
dataXML.ignoreWhitespace = true;
// Choose Style Drop-Down
var cbStyle:ComboBox = new ComboBox; // Combobox
cbStyle.x = 755;
cbStyle.y = 260;
cbStyle.width = 100;
addChild(cbStyle);
// Choose Style
var tfStyleTxt:TextField = new TextField();
tfStyleTxt.x = 750;
tfStyleTxt.y = 240;
tfStyleTxt.autoSize = TextFieldAutoSize.LEFT;
tfStyleTxt.text = "Choose Style";
addChild(tfStyleTxt);
tfStyleTxt.setTextFormat(tFormatHead);
var txtFldPassage:TextArea = new TextArea(); // Text Area Description
txtFldPassage.x = 30;
txtFldPassage.y = 120;
txtFldPassage.width = 700;
txtFldPassage.height = 250;
txtFldPassage.editable = false;
txtFldPassage.condenseWhite = true;
addChild(txtFldPassage);
var txtFldQuestions:TextArea = new TextArea(); // Text Area City
txtFldQuestions.x = 30;
txtFldQuestions.y = 440;
txtFldQuestions.width = 600;
txtFldQuestions.height = 200;
txtFldQuestions.editable = false;
addChild(txtFldQuestions);
var txtFldFeedback:TextArea = new TextArea(); // Text Area feedback
txtFldFeedback.x = 650;
txtFldFeedback.y = 440;
txtFldFeedback.width = 300;
txtFldFeedback.height = 200;
txtFldFeedback.editable = false;
addChild(txtFldFeedback);
function xmlLoaded(evt:Event):void
{
dataXML = XML(xmlLoader.data);
for (var tripName:String in dataXML.list)
{
cbStyle.addItem({label:dataXML.list[tripName].@style});
}
txtFldPassage.htmlText = dataXML.list[0].passage;
txtFldQuestions.text = dataXML.list[0].question;
txtFldFeedback.text = dataXML.list[0].feedback;
}
function selectStyle(evt:Event):void
{
trace ("selected" + evt.target.selectedIndex);
txtFldPassage.htmlText = dataXML.list[evt.target.selectedIndex].passage;
txtFldQuestions.text = dataXML.list[evt.target.selectedIndex].question;
txtFldFeedback.text = dataXML.list[evt.target.selectedIndex].feedback;
}
cbStyle.addEventListener(Event.CHANGE, selectStyle);
Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<data>
<list style="Bold">
<question>the thing that will turn into a chicken after hatching</question>
<feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
<passage>What is a <b>baby</b> frog called? Where does it come from? How does a baby frog grow into an adult frog? This is the story of the life cycle of the frog.</passage>
</list>
<list style="Underline">
<question>a living creature that is not human</question>
<feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
<passage>What is a baby frog called? Where does it <u>come</u> from? How does a baby frog grow into an adult frog? This is the story of the life cycle of the frog.</passage>
</list>
<list style="Bracket">
<question>small</question>
<feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
<passage>What is a baby frog called? Where does it come from? How does a baby <i>[frog]</i> grow into an adult frog? This is the story of the life cycle of the frog.</passage>
</list>
<list style="Font Color ">
<question>the seeds of frogs</question>
<feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
<passage>What is a baby frog called? Where does it come from? How does a baby frog grow into an <font color="#FF0000">adult</font> frog? This is the story of the life cycle of the frog.</passage>
</list>
<list style="All Style ">
<question>an animal that can live on land and in water</question>
<feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
<passage>What is a <b>baby</b> frog called? Where does it <u>come</u> from? How does a baby <i>[frog]</i> grow into an <font color="#FF0000">adult</font> frog? This is the story of the life cycle of the frog.</passage>
</list>
</data>
<data>
<list style="Bold">
<question>the thing that will turn into a chicken after hatching</question>
<feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
<passage>What is a <b>baby</b> frog called? Where does it come from? How does a baby frog grow into an adult frog? This is the story of the life cycle of the frog.</passage>
</list>
<list style="Underline">
<question>a living creature that is not human</question>
<feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
<passage>What is a baby frog called? Where does it <u>come</u> from? How does a baby frog grow into an adult frog? This is the story of the life cycle of the frog.</passage>
</list>
<list style="Bracket">
<question>small</question>
<feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
<passage>What is a baby frog called? Where does it come from? How does a baby <i>[frog]</i> grow into an adult frog? This is the story of the life cycle of the frog.</passage>
</list>
<list style="Font Color ">
<question>the seeds of frogs</question>
<feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
<passage>What is a baby frog called? Where does it come from? How does a baby frog grow into an <font color="#FF0000">adult</font> frog? This is the story of the life cycle of the frog.</passage>
</list>
<list style="All Style ">
<question>an animal that can live on land and in water</question>
<feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
<passage>What is a <b>baby</b> frog called? Where does it <u>come</u> from? How does a baby <i>[frog]</i> grow into an <font color="#FF0000">adult</font> frog? This is the story of the life cycle of the frog.</passage>
</list>
</data>
<data>
<list style="Bold">
<question>the thing that will turn into a chicken after hatching</question>
<feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
<passage>What is a <b>baby</b> frog called? Where does it come from? How does a baby frog grow into an adult frog? This is the story of the life cycle of the frog.</passage>
</list>
<list style="Underline">
<question>a living creature that is not human</question>
<feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
<passage>What is a baby frog called? Where does it <u>come</u> from? How does a baby frog grow into an adult frog? This is the story of the life cycle of the frog.</passage>
</list>
<list style="Bracket">
<question>small</question>
<feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
<passage>What is a baby frog called? Where does it come from? How does a baby <i>[frog]</i> grow into an adult frog? This is the story of the life cycle of the frog.</passage>
</list>
<list style="Font Color ">
<question>the seeds of frogs</question>
<feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
<passage>What is a baby frog called? Where does it come from? How does a baby frog grow into an <font color="#FF0000">adult</font> frog? This is the story of the life cycle of the frog.</passage>
</list>
<list style="All Style ">
<question>an animal that can live on land and in water</question>
<feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
<passage>What is a <b>baby</b> frog called? Where does it <u>come</u> from? How does a baby <i>[frog]</i> grow into an <font color="#FF0000">adult</font> frog? This is the story of the life cycle of the frog.</passage>
</list>
</data>
Thanks in advance.
Calling A List Of XML Data Into A TextArea
I'm planning to call a list of data from an XML file but when I duplicate the content inside the <data></data> it is not showing anything
Here's the ActionScript 3.0
Code:
import fl.controls.ComboBox;
import fl.controls.TextArea;
import fl.containers.UILoader;
//Component Style
import fl.managers.StyleManager;
var xmlLoader:URLLoader = new URLLoader();
var dataURL:URLRequest = new URLRequest("data.xml");
xmlLoader.addEventListener(Event.COMPLETE,xmlLoaded);
xmlLoader.load(dataURL);
var tFormatHead:TextFormat = new TextFormat();
tFormatHead.bold = true;
tFormatHead.size = 12;
tFormatHead.font = "Arial";
var albumFormat:TextFormat = new TextFormat();
albumFormat.font = "Arial";
albumFormat.size = 12;
albumFormat.bold = true;
//StyleManager.setStyle("textFormat", albumFormat);
var dataXML:XML = new XML();
dataXML.ignoreWhitespace = true;
// Choose Style Drop-Down
var cbStyle:ComboBox = new ComboBox; // Combobox
cbStyle.x = 755;
cbStyle.y = 260;
cbStyle.width = 100;
addChild(cbStyle);
// Choose Style
var tfStyleTxt:TextField = new TextField();
tfStyleTxt.x = 750;
tfStyleTxt.y = 240;
tfStyleTxt.autoSize = TextFieldAutoSize.LEFT;
tfStyleTxt.text = "Choose Style";
addChild(tfStyleTxt);
tfStyleTxt.setTextFormat(tFormatHead);
var txtFldPassage:TextArea = new TextArea(); // Text Area Description
txtFldPassage.x = 30;
txtFldPassage.y = 120;
txtFldPassage.width = 700;
txtFldPassage.height = 250;
txtFldPassage.editable = false;
txtFldPassage.condenseWhite = true;
addChild(txtFldPassage);
var txtFldQuestions:TextArea = new TextArea(); // Text Area City
txtFldQuestions.x = 30;
txtFldQuestions.y = 440;
txtFldQuestions.width = 600;
txtFldQuestions.height = 200;
txtFldQuestions.editable = false;
addChild(txtFldQuestions);
var txtFldFeedback:TextArea = new TextArea(); // Text Area feedback
txtFldFeedback.x = 650;
txtFldFeedback.y = 440;
txtFldFeedback.width = 300;
txtFldFeedback.height = 200;
txtFldFeedback.editable = false;
addChild(txtFldFeedback);
function xmlLoaded(evt:Event):void
{
dataXML = XML(xmlLoader.data);
for (var tripName:String in dataXML.list)
{
cbStyle.addItem({label:dataXML.list[tripName].@style});
}
txtFldPassage.htmlText = dataXML.list[0].passage;
txtFldQuestions.text = dataXML.list[0].question;
txtFldFeedback.text = dataXML.list[0].feedback;
}
function selectStyle(evt:Event):void
{
trace ("selected" + evt.target.selectedIndex);
txtFldPassage.htmlText = dataXML.list[evt.target.selectedIndex].passage;
txtFldQuestions.text = dataXML.list[evt.target.selectedIndex].question;
txtFldFeedback.text = dataXML.list[evt.target.selectedIndex].feedback;
}
cbStyle.addEventListener(Event.CHANGE, selectStyle);
and here's the XML
Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<data>
<list style="Bold">
<question>the thing that will turn into a chicken after hatching</question>
<feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
<passage>What is a <b>baby</b> frog called? Where does it come from? How does a baby frog grow into an adult frog? This is the story of the life cycle of the frog.</passage>
</list>
<list style="Underline">
<question>a living creature that is not human</question>
<feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
<passage>What is a baby frog called? Where does it <u>come</u> from? How does a baby frog grow into an adult frog? This is the story of the life cycle of the frog.</passage>
</list>
<list style="Bracket">
<question>small</question>
<feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
<passage>What is a baby frog called? Where does it come from? How does a baby <i>[frog]</i> grow into an adult frog? This is the story of the life cycle of the frog.</passage>
</list>
<list style="Font Color ">
<question>the seeds of frogs</question>
<feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
<passage>What is a baby frog called? Where does it come from? How does a baby frog grow into an <font color="#FF0000">adult</font> frog? This is the story of the life cycle of the frog.</passage>
</list>
<list style="All Style ">
<question>an animal that can live on land and in water</question>
<feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
<passage>What is a <b>baby</b> frog called? Where does it <u>come</u> from? How does a baby <i>[frog]</i> grow into an <font color="#FF0000">adult</font> frog? This is the story of the life cycle of the frog.</passage>
</list>
</data>
<data>
<list style="Bold">
<question>the thing that will turn into a chicken after hatching</question>
<feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
<passage>What is a <b>baby</b> frog called? Where does it come from? How does a baby frog grow into an adult frog? This is the story of the life cycle of the frog.</passage>
</list>
<list style="Underline">
<question>a living creature that is not human</question>
<feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
<passage>What is a baby frog called? Where does it <u>come</u> from? How does a baby frog grow into an adult frog? This is the story of the life cycle of the frog.</passage>
</list>
<list style="Bracket">
<question>small</question>
<feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
<passage>What is a baby frog called? Where does it come from? How does a baby <i>[frog]</i> grow into an adult frog? This is the story of the life cycle of the frog.</passage>
</list>
<list style="Font Color ">
<question>the seeds of frogs</question>
<feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
<passage>What is a baby frog called? Where does it come from? How does a baby frog grow into an <font color="#FF0000">adult</font> frog? This is the story of the life cycle of the frog.</passage>
</list>
<list style="All Style ">
<question>an animal that can live on land and in water</question>
<feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
<passage>What is a <b>baby</b> frog called? Where does it <u>come</u> from? How does a baby <i>[frog]</i> grow into an <font color="#FF0000">adult</font> frog? This is the story of the life cycle of the frog.</passage>
</list>
</data>
<data>
<list style="Bold">
<question>the thing that will turn into a chicken after hatching</question>
<feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
<passage>What is a <b>baby</b> frog called? Where does it come from? How does a baby frog grow into an adult frog? This is the story of the life cycle of the frog.</passage>
</list>
<list style="Underline">
<question>a living creature that is not human</question>
<feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
<passage>What is a baby frog called? Where does it <u>come</u> from? How does a baby frog grow into an adult frog? This is the story of the life cycle of the frog.</passage>
</list>
<list style="Bracket">
<question>small</question>
<feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
<passage>What is a baby frog called? Where does it come from? How does a baby <i>[frog]</i> grow into an adult frog? This is the story of the life cycle of the frog.</passage>
</list>
<list style="Font Color ">
<question>the seeds of frogs</question>
<feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
<passage>What is a baby frog called? Where does it come from? How does a baby frog grow into an <font color="#FF0000">adult</font> frog? This is the story of the life cycle of the frog.</passage>
</list>
<list style="All Style ">
<question>an animal that can live on land and in water</question>
<feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
<passage>What is a <b>baby</b> frog called? Where does it <u>come</u> from? How does a baby <i>[frog]</i> grow into an <font color="#FF0000">adult</font> frog? This is the story of the life cycle of the frog.</passage>
</list>
</data>
<data>
<list style="Bold">
<question>the thing that will turn into a chicken after hatching</question>
<feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
<passage>What is a <b>baby</b> frog called? Where does it come from? How does a baby frog grow into an adult frog? This is the story of the life cycle of the frog.</passage>
</list>
<list style="Underline">
<question>a living creature that is not human</question>
<feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
<passage>What is a baby frog called? Where does it <u>come</u> from? How does a baby frog grow into an adult frog? This is the story of the life cycle of the frog.</passage>
</list>
<list style="Bracket">
<question>small</question>
<feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
<passage>What is a baby frog called? Where does it come from? How does a baby <i>[frog]</i> grow into an adult frog? This is the story of the life cycle of the frog.</passage>
</list>
<list style="Font Color ">
<question>the seeds of frogs</question>
<feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
<passage>What is a baby frog called? Where does it come from? How does a baby frog grow into an <font color="#FF0000">adult</font> frog? This is the story of the life cycle of the frog.</passage>
</list>
<list style="All Style ">
<question>an animal that can live on land and in water</question>
<feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
<passage>What is a <b>baby</b> frog called? Where does it <u>come</u> from? How does a baby <i>[frog]</i> grow into an <font color="#FF0000">adult</font> frog? This is the story of the life cycle of the frog.</passage>
</list>
</data>
Thanks in advance.
Displaying Mysql Data In Textarea
I am prototyping a site here and would like to have the calendar contents (coming from mysql) display inside a flash textarea box that scrolls. The final site design may have the pages' dimensions fixed. Hence the use of flash. Although I suppose a frame or iframe might work but I want the challenge.
I've read a little bit about bringing strings from php into flash. How straightforward, or not, is this going to be ?
Would it be better to convert the output from php/mysql to XML and then parse that data for display instead? If yes, any general recommendations are appreciated. I'm a flash newbie.
Load Variables From Text Then Loading Image File With The Filename Given In Text File
The problem is, that i need flash to load variable from text file, eg: info.txt, with image=gt.jpg in it.
Then I want flash movie to load a gt.jpg into a blank movie.
The point is that after i change filename in txt file, i want movie to load that img.
I wrote AS:
loadVariablesNum("info.txt", 0);
loadMovieNum(image, 0);
but it's not working
After i traced variable image, debugger showed that this variable undefined, but if i put textbox with image as variable, it shows "gt.jpg".
Please help
[MX2004] TextArea Component Does Not Display Data.
I created a simple flash doc as follows:
1 txtArea with instance name: testTxt
======================
on 1st frame of action layer I put in the code:
==================================
// load text file
var exData:LoadVars = new LoadVars();
exData.onLoad = function(success) {
if(success) {
_root.testTxt.txt = exData.txtTest;
} else
trace("Load failed");
}
exData.load("../xml/test.txt");
stop();
my Text file is: test.txt
==================
txtTest=This is a test, blah. blah,blah.....
Running in the debug mode I can see that the data is being loaded correctly
but it does not display in the textArea at all. Any Ideas ???? please advise
Format External Data In Flash 2004 TextArea
I want to pull external data into a Flash 2004 Pro textArea. The data will need some formatting. Specifically line breaks, Bold Text, and Paragraph Breaks. What are my options for doing this. I have heard that html tags are whacko in 2004 pro.
Thanks for your help
How Update Text File With New Data?
I'm able to load the variables I have in a text file into my Flash movies, but once the values are changed in my .swf, how do I update them in my text file? :-(
Thanks!
Rick
Putting Data TO A Text File.
I have this interesting situation where I want to update a website remotely. By saying remotely I mean that I want to plug chuncks of information into a text file in my computer.
The effect will be the same of creating a Log.
The end result is not to be on a website but for an html.. I want non-techie persons being able to update a static website from a Flash aplication with a basic and attractive GUI.
It wont have a database since is static and it will just be pluging a table with 2 rows, one with a title class (CSS) the other just a general <'p> tags and plug it at the top of the website.
I was thinking on using variables, however it might even be easier if we can make an actionscript with the strings and use the variables to plug on the html.
Sending Data To A Text File
I want someone to be able to type in some text and save it to a text file using ASP. Howeverif they type "&", when Flash reads the textfile it doesn't read anything beyond the "&" sign because it thinks it is the end of the variable..... anyway, is it possible to use this character and somehow write it to the text file where it doesn't show up as a "&" for code, but an "&" for simple text? Thanks.
Formats For Text File Data
i would have searched for this topic, but the search page just hangs, so here's my question:
i have traditionally used this format for text file data incoming to flash
Code:
&var1=value1&var2=value2&var3=value3&
but a developer i'm working with says he uses a format like this:
Code:
name, value
ID1, "Participant Notification"
ID2, "Voice Mail"
ID3, "Email"
ID4, "Instant Messenging"
ID5, "Other Communication Tools"
ID6, "Required Participant Information"
i've never seen this. he defines the variables and their values totally differently. how is this done on the flash code end for reading data arranged in this fashion?
thanks
|