Help With Formatting External Text With Actionscript
I am attempting to take text written as a short story and place it into virtual "pages" in a Flash movie. The user can click ahead or behind and there are animations of the pages flipping. The only problem is figuring out how to separate the text into separate pages dynamically using actionscript. Is there perhaps a way when actionscript can tell when _x_ number of lines of text have been displayed and then stop displaying there, saving the rest for the next page?
I hope this is clear enough. If not, I can provide more detail- please contribute any thoughts on the subject.
Thanks,
Dusty
FlashKit > Flash Help > Flash ActionScript
Posted on: 05-17-2002, 04:36 PM
View Complete Forum Thread with Replies
Sponsored Links:
Text Formatting Actionscript
I've got a question about some actionscript. I'm making a backend/content editing app and was wanting my text box to display "<br>" instead of actually carriaging a line. I can get it to append, but the carriage still takes place. Is there a way to stop this or get around it (ie. virtually press backspace) or something?
thanks for your help.
View Replies !
View Related
Formatting External Text
Is there any way to format text in Flash that is from an external source? More so than just picking the font and size... for instance changing the letting(the space between lines), or the space after a paragraph, etc. Or is it possible to have multiple sizes of fonts?
thanks a lot for your time,
Trevor
View Replies !
View Related
Help With Formatting External Text
I have built a site so that it loads in content from text documents. I set it to format it is html and use the html tags in the text documents. When I test on my PC it looks fine, but once I upload to the server I lose the Parragraph formatting, bold and ittalics are ok.
The reason this is important is that I have invisiable buttons over certain dynamically loaded text which controlls the flash movie and when the parragraph formatting is lost the buttons are no longer in the correct position.
Have I gone about this the wrong way, is there an easier way to use specific text from a dynamically loaded text document to control the flash movie?
Any help or insight is appreciated. This is the first time I have used dynamic text in a flash page.
Cheers.
View Replies !
View Related
Formatting External Text
Greetings all-- I'm using an external text file, and I was wondering if there's any way to do a 'soft return' instead of a full paragraph break. I.E.:
"A line like this
And another like this"
in my text file end up like
"A line like this
And another like this"
Any suggestions?
Thanks,
JT
View Replies !
View Related
External Text Formatting
I'm working on a website that has externally referenced text loaded in as a variable. The client wants to make part of it bold and another part italicized. Anyone have any suggestions on how to do this?
View Replies !
View Related
Help With Formatting External Text
I have built a site so that it loads in content from text documents. I set it to format it is html and use the html tags in the text documents. When I test on my PC it looks fine, but once I upload to the server I lose the Parragraph formatting, bold and ittalics are ok.
The reason this is important is that I have invisiable buttons over certain dynamically loaded text which controlls the flash movie and when the parragraph formatting is lost the buttons are no longer in the correct position.
Have I gone about this the wrong way, is there an easier way to use specific text from a dynamically loaded text document to control the flash movie?
Any help or insight is appreciated. This is the first time I have used dynamic text in a flash page.
Cheers.
View Replies !
View Related
Actionscript GetURL Is Sending Text Formatting ?
Hi everyone,
Have tried to get some info on this but no luck.... I've created a simple contact form in Flash, but the URL which it's generating contains the text formatting from the text input fields. As a result the script that processes the mail send doesn't work. How do I strip the text formatting out of text1, text2 and text3 before I use getURL() ??
on (release) {
url_var = "your_name="+text1+"&your_e-mail="+text2+"&message="+text3;
getURL("contact.php?"+url_var, "_blank", "GET");
text1 = "";
text2 = "";
text3 = "";
}
View Replies !
View Related
Formatting Text With Actionscript, Bold Not Working...
I seem to be having some trouble with bolding or unbolding some embedded text. when using the formatting feature in flash.
I have the folloing code:
Code:
format2 = new TextFormat();
format2.font = "Arial";
format2.italic = false;
format2.align = eval("item"+i).txtalign;
format2.size = _root.maintxtsize;
format2.bold = false;
format2.color = parseInt(eval("item"+i).txtcolor, 16);
eval("item"+i).lableText.autoSize = true;
eval("item"+i).lableText.type = "static";
eval("item"+i).lableText.selectable = false;
eval("item"+i).lableText.antiAliasType = "normal";
eval("item"+i).lableText.embedFonts = true;
eval("item"+i).lableText.setNewTextFormat(format2);
I had saved a font to be exported with my flash on fist frame with ID of Arial, I checked the Bold box and the Italic Box so it embeds those characters too, but it seems to be ignoring my commands and puts in the "Arial" type in Bold and Italic, instead of going by my formating options.
Case and point, it is rendering my text in "bold & italic" as the font was checked when I am telling it not to do so with my code.
Do I have to export 5 different versions of the font in various options (ie: bold, italic, plain, bold italic, plain italic) and use an if statement to figure out what one to display? if so, that's querky and stupid!
anyone have a solution for this?
View Replies !
View Related
Formatting Text Loaded From An External Text File
Hi:
I have a scrollable, dragable, mini-window that uses multilined, dynamic text updated from an external text file. I also have word wrap, selectable, and HTML enabled for the text.
My question is how do I format the text? Specifically, even though word wrap is enabled, the words are being cut off at the right border. How can I prevent this??? BTW, there is no masking involved, and the text is on the top layer. Also, I experience this same problem, whether the text is loaded from an external file, or if I just type it into the action panel.
Any help will be greatly appreciated.
http://www.atlantaroadcma.org/dragwin2a.html
James
If you confess with your mouth the Lord Jesus Christ, and believe in your heart that God raised him from the dead, you shall be saved.
View Replies !
View Related
Formatting Text From External File
I have a textbox that is loading variables from an external textfile... when I typed out the textfile, I used an & before the variables..
I have been trying to figure out how I can format the text.. I saw on a tutorial on here that the guy used HTML coding to change font size and color.. but in his tutorial he did not use an & before the variables, so i figure this had something to do with the HTML coding not working for me..
can someone please explain this to me..
thanks
f.e.
View Replies !
View Related
MX Scroll Box W/ External Text/Formatting
Here's my question:
I've been trying to figure this out for a while now and been having no luck..
i'm trying to get a scrollable Dynamic text box reference an external source AND have it read the hatml coding in the source file.
I've been told i can do this and some of my buddies have done it and attempted to explain it to me, but with no luck.
Does anyone have any answers?
all i want is some HTML formatted text read into a Scrollable Dynamic text box.
Thanks a ton!
jamey
View Replies !
View Related
Formatting An External Text File
Hi.
I'm in the process of creating an interactive map, with hover-over locations. When you hover over them, the place name displays.
I've got this working fine, but i'm going to go a step further and also make them clickable, at which point, a pop-up window (in flash) appears with the full details of the place / office.
I want to pull the addresses from an external text file, but i'm not sure how to format the text file.
I've got about 100 locations. I presume it's to do with adding dynamic text boxes, with vars named 'location' 'address1' 'address2' 'postcode' (i'm english by the way) 'telno' etc.......
Do I format the file something like:
&location=London
&address1=Westminster
etc.....
Also, because i've got about 100 locations, i'm presuming that the field 'location' acts as the identifier e.g.
&location=Newcastle etc.........
But how do I differentiate between locations?
I'm probably not making much sense here, but hope that someone can understand what i'm rambling on about. I've attached an example of the text file i'll be using, it's probably totally wrong but anyway, have a look.
What i'm not sure about is do I need to incriment each entry e.g. location, location 1, location 2 and so on, but if this is the case, how do I only use one dynamic text field in flash called 'location'
Thanks
View Replies !
View Related
Trouble Formatting External Text
for some reason i can't seem to figure out how to use css or just format my text i'm calling from an external .txt file. i'm sure it is the way i'm calling the file but i'm pretty new to this. first off i'm loading the text like so:
loadVariablesNum("text.txt", 6);
then on my dynamic text boxt in the var section i have
_level6.text
and the scrolling buttons are linked to _level6.text as well but for whatever reason when i try and html format it or load css nothing changes, the dynamic text box is set to recoginize html tags
why can't i get this to work
thanks
atom
View Replies !
View Related
External Text Not Formatting Correctly
I just got my scrolling text to work here, but it isn't formatting the way I want. I think I have code correct, but maybe just in the wrong place. AS3 gods, please point me correctly -- I'm learning.
var external_txt:TextField = new TextField();
var myFormat:TextFormat = new TextFormat();
var externalReq:URLRequest = new URLRequest("external.txt");
var externalLoad:URLLoader = new URLLoader();
externalLoad.load(externalReq);
externalLoad.addEventListener(Event.COMPLETE, textReady);
up_btn.addEventListener(MouseEvent.CLICK, scrollUp);
down_btn.addEventListener(MouseEvent.CLICK, scrollDown);
myFormat.font = "Frutiger";
myFormat.color = 0xFFFFFF;
myFormat.size = 14;
external_txt.x = 0;
external_txt.y = 0;
external_txt.border = false;
external_txt.width = 600;
external_txt.height = 375;
external_txt.wordWrap = true;
addChild(external_txt);
external_txt.setTextFormat(myFormat);
function textReady(event:Event):void
{
external_txt.text = event.target.data;
}
function scrollUp(event:MouseEvent):void
{
external_txt.scrollV --;
}
function scrollDown(event:MouseEvent):void
{
external_txt.scrollV ++;
}
View Replies !
View Related
External Text Formatting Hell
I have text loading from an external UTF-8(also tried saving as UNICODE and ANSI) text file into a dynamic flash text field. the text loads fine, but the formatting of the text file doesnt match what shows up in flash. Whenever i edit and hit ENTER in the text file flash displays it as double spaced instead of single lined. so i cant get line breaks directly under previous lines. heres the code im using
readText.onLoad = function () {
myText_txt.htmlText = this.myText;
readText.load ("www.randomsite.com/copy.txt");
}
is there also a way to set up the text file to have bold characters as well as larger type in some places? the flash help file as well as other posts are very vague and general when it comes to working with HTML type and tags and stuff and how exactly text files that have these tags should be saved.
using flash pro 8
View Replies !
View Related
External Text File Formatting
here is how im trying to load a text file:
loadText = new LoadVars();
loadText.load("http://www.tenbyten.org/Data/Now/words.txt");
loadText.onLoad = function() {
news_txt.text = this;
};
words.txt has text arranged like this:
iraq
killed
military
american
....
....
news_txt should contain some random words from the text file (which is external and i can't edit it)-- so is there anyway i can import random lines from the file. right now, the news_txt displays (iraq0Akilled0Amilitary0Aamerican....) i want duplicate movie clips of news_txt to display one word each from this file (randomly).
also, why i am getting "0A" between every keyword when i render the flash file- any idea ?? (iraq0Akilled0Amilitary0Aamerican....) please help.
View Replies !
View Related
[AS] Formatting External Loaded Text
Hi,
I've learnt a lot from this great forum just by browsing old posts, but now I've got this issue:
How can text which is loaded from an external text file be formatted with an embedded font? The AS below gives me unexpected results: The hardcoded text will be displayed ok - formatted and unformatted. The loaded text will only be shown if embedFonts is set to false - then, it will be shown unformatted in the textField. Therefore, it can't be the font-embedding, I seem to miss something fundamental here I guess.
Any help on why this is so is much appreciated!
ActionScript Code:
tc = createEmptyMovieClip("textContainer_mc", 3);
tc.createTextField("project_txt", 4, 640, 60, 200, 400);
tc["project_txt"].border = true;
tc["project_txt"].borderColor = 0x000000;
tc["project_txt"].embedFonts = false;
// If embedFonts is set to false, the dynamically loaded text is displayed in the text field (with no formatting at all) as expected.
// but, if embedFonts is set to false, the hardcoded text gets at least "some formatting", just without the right font.
tc["project_txt"].selectable = false;
tc["project_txt"].textColor = 0x666666;
tc["project_txt"].wordWrap = true;
var loadText = new LoadVars();
loadText.onLoad = function(success) {
if (success)
{
tc["project_txt"].text = this.loadMe;
}
else
{
tc["project_txt"].text = "didn't load";
}
};
loadText.load("demo.txt");
//tc["project_txt"].text = "If this line of hardcoded text is used (and not line 22 with dynamically loaded text), it looks right if embedFonts is set to true.";
dkTextFormat = new TextFormat();
dkTextFormat.align = "left";
dkTextFormat.font = "testFont";
dkTextFormat.leftMargin = 10;
dkTextFormat.rightMargin = 10;
dkTextFormat.size = 16;
tc["project_txt"].setTextFormat(dkTextFormat);
View Replies !
View Related
Unable To See Formatting From External Text File
I have a flash site that I have built, and it contains dynamic text areas that load information for a text file. It is able to load the information fine, however, when I apply formating such as bold or italic tags, it does not work. I checked to make sure I had HTML check in the "Text Options" pane, but it was already checked. I then noticed something very odd. It does not work on my Windows computers, but works fine on my Linux computer running Netscape 4.7. Could this be an issue, or am I just missing something.
The site is http://fs.mmwa-sicw.com
Any help would be greatly appreciated.
View Replies !
View Related
Formatting Text That's Loaded From External Source.
I have a news page which a client updates themselves by editing a txt file and uploading it. The problem with this is that the text is all in the same font / color / size.
Is there a way round this problem? Maybe using a html file instead of a txt file? (I'm not sure how I'd do that). What about using multiple variables? I don't know!? I'd be very grateful to anyone that can help.
thanks.
Note: I don't want to use any php / asp etc
View Replies !
View Related
External Text Source Html Formatting
A movieclip with a textbox in it is loading text from a php script using:
Movie_mc.loadVariables("script.php", this, "GET");
The text the php script echos back has basic, supported HTML tags in it. Flash will either show the text with the tags as if it were normal text, or it will not show the text at all.
Using:
"text_txt.html = true;" and "text_txt.htmltext" does not work.
Selecting 'Render text as HTML' for the textbox makes no text appear at all.
When the font is not embedded, the text does not display.
When the font is embedded, the text shows up with the tags visible.
Does anyone know another method that should work?
View Replies !
View Related
External Text Source Html Formatting
A movieclip with a textbox in it is loading text from a php script using:
Movie_mc.loadVariables("script.php", this, "GET");
The text the php script echos back has basic, supported HTML tags in it. Flash will either show the text with the tags as if it were normal text, or it will not show the text at all.
Using:
"text_txt.html = true;" and "text_txt.htmltext" does not work.
Selecting 'Render text as HTML' for the textbox makes no text appear at all.
When the font is not embedded, the text does not display.
When the font is embedded, the text shows up with the tags visible.
Does anyone know another method that should work?
View Replies !
View Related
Problem With Dynamic Text Formatting From An External Txt File.
I'm reposting this with a different title because I didn't get many responses last time:
I looked around for a topic similar to this, but I had no luck, so I'm sorry if this question has been answered before. The problem I'm having is merely cosmetic, and not that important, but I'm a perfectionist and its driving me crazy. I'm using two dynamic text fields that load variables from an external text file. They both aren't displayed at the same time. When you click the button to view the data from the other text file, for a split second, the old text file assumes the formatting of the new text before changing to the new text. I'm sure this sounds very confusing so if you want to see it go to www.mindcontrolmusic.com when the site loads it should be on news. Click on the sub menu at the top to see lyrics and you'll see exactly what I mean, go back to news, and it does the same thing. Thanks in advance to anyone who can help me
View Replies !
View Related
Adding Html Formatting To External Text Field
Hi, apologies if you read this post in my previous entry, i should have started it as a new topic..
I've got a dynamic textfield calling an external text file from the server OK, but I want to add a bit of formatting e.g. bolding the titles. I've read a few posts on this, but am getting a headache working out what I change in my code! Or do I change something in the external file itself?
The textfield is called load_txt (the var: my_lv)
The action applies to the layer is:
my_lv = new LoadVars();
my_lv.load("http://www.europahost.net/nrg/load_txt.txt");
my_lv.onLoad = function(success) {
if (success) {
load_txt.htmlText = this.load_txt;
trace("loaded");
} else {
trace("not loaded");
}
};
Thanks in adv
andy
View Replies !
View Related
Formatting External Text File:Weird Problem
Hi there,
Strange problem. Have external text files loaded into dynamic text fields (rendered as HTML) in my SWF. The formatting is perfect when uploaded to my test site. Have now uploaded to client site and all formatting has changed. Specifically, I've ended up with an extra line break (or carriage return in typewriter speak) at every line, for no particular reason. It's frustrating the hell out of me because I can't see why. This is going to get tricky for the client when they update text themselves.
All suggestions for rectifying gratefully accepted.
Many thanks
Q
View Replies !
View Related
Formatting Text Loaded From External Txt File As Html In Flash
I need to format and display a large piece of essay in flash. i feel the best way is to create a txt file with html formatting then declare it as a variable in the txt file, then laodvariable into the flash file calling for the txt file, while refering the flash textfield to the variable declared. The problem is, after saving the large piece of essay in html format using either word, or dreamweaver, it contains A LOTA crap/useless tags that will not be recognized by the flash engine, thus screwing up the field, rendering nothing to be displayed. If I take out those tags such as <p> then it will work fine. However, as I mentioned this is a large piece of data it is literally impossible to do it manually. While I want to preserve the "italics" (actually this is the only format I wanna preserve) I need to get rid of the other junk, is there an easy way to do this?
Thank you for your time
View Replies !
View Related
Formatting External Text File As Html When Loading A TextField
I'm new to actionscript and I'm having trouble finding code examples of what I'm trying to do.
I'm loading a textField with addChild in a movieClip and want the external text file I am loading into this textField to render in the textField as HTML. I have attached the code I am using. If anyone can help or has some example code I would greatly appreciate it. Thanx
Attach Code
stop();
var plannerExt_txt:TextField = new TextField();
var plannerExtReq:URLRequest = new URLRequest("planner_Ext.txt");
var plannerExtLoad:URLLoader = new URLLoader();
var plannerUp_btn:MovieClip = new mc_upScroll
var plannerDown_btn:MovieClip = new mc_downScroll
plannerExtLoad.load(plannerExtReq);
plannerUp_btn.buttonMode = true;
plannerDown_btn.buttonMode = true;
plannerExtLoad.addEventListener(Event.COMPLETE, plannerExtReady);
plannerUp_btn.addEventListener(MouseEvent.MOUSE_DOWN, plannerScrollUp);
plannerDown_btn.addEventListener(MouseEvent.MOUSE_DOWN, plannerScrollDown);
plannerExt_txt.y = -272;
plannerExt_txt.x = -118;
plannerExt_txt.height = 537;
plannerExt_txt.width = 597;
plannerExt_txt.border = false;
plannerExt_txt.wordWrap = true;
addChild(plannerExt_txt);
function plannerExtReady(event:Event):void
{
plannerExt_txt.text = event.target.data;
plannerUp_btn.x = 470;
plannerUp_btn.y = -305;
addChild(plannerUp_btn);
plannerDown_btn.x = 470;
plannerDown_btn.y = 250;
addChild(plannerDown_btn);
}
function plannerScrollUp(event:MouseEvent):void
{
plannerExt_txt.scrollV --;
}
function plannerScrollDown(event:MouseEvent):void
{
plannerExt_txt.scrollV ++;
}
View Replies !
View Related
ActionScript Auto Formatting
Is there a way in Flash 8 to change how the auto formatting on your code works. So that I can change where to place code blocks and parenthesis, or how far to tab and leave spaces, for example, when I use the function.
View Replies !
View Related
Actionscript Formatting Problem.
Last edited by Codemonkey : 2006-09-20 at 00:06.
I'm trying to code a multiple choice game that pulls the questions and answers randomly from set text files. I have everything working in Flash 5, but I need to integrate this 'question generator' into a Flash 8 mainframe I've built to graphically display everything.
The problem occurs when I try and implement the 'question generator' code in the Flash 8 movie. I need to update the code to work with Flash 8.
Can anyone convert this code to work in Flash 8:
ActionScript Code:
if (Number(q) == Number(used1) or Number(q) == Number(used2) or Number(q) == Number(used3) or Number(q) == Number(used)) {
gotoAndPlay(1);
} else {
set ("used" loop, q);
}
if (Number(loop) == 5) {
gotoAndPlay("end");
}
This is the error I get:
Code:
**Error** Scene=Scene 1, layer=actions, frame=2:Line 4: ')' or ',' expected
set ("used" loop, q);
**Error** Scene=Scene 1, layer=actions, frame=2:Line 5: Unexpected '}' encountered
}
**Error** Scene=Scene 1, layer=actions, frame=3:Line 1: ')' or ',' expected
loadVariables("question" add q add ".txt", "_level0");
Total ActionScript Errors: 3 Reported Errors: 3
I don't know Actionscript well enough to figure out the formatting. Any help is appreciated!
- Chris
View Replies !
View Related
Formatting External Txt
hi there,
i load vars from a txt file into a loadVars object in order to display them in a dynamic textfield. furthermore the txt file is HTML-formatted. everything works out fine as long as i dont use tables.
is there a way to format the text with tables?
as usual every help appreciated
View Replies !
View Related
Using External Text To Control Actionscript
Hi Guys
I've got some external text files that I'm loading into my flash movie. Part of this text needs to act as links to areas within this movie.
I know HTML can be used to link to other web pages but is it possible to include actionscript in the external text file?
Cheers
Phil
View Replies !
View Related
Loading External Text That Contains ** ACTIONSCRIPT **
Hi there!!!
Well...I already know how to load an external text into a dynamic text field, but what I´m trying to do now is to load an external file that contains some actions (actionscript) in it.
Those actions are commanded by a button (calculate) and this way I´d need to load those actions into the button properties...or even to a dynamic text field and than find a way to move them to the button properties.
I already have all the .txt files that I need to be loaded.
Did you understand what I need??
IS THAT POSSIBLE? ***PLEASE HELP, IT´S URGENT***
View Replies !
View Related
External XML Into ActionScript 3.0 Text Field
I've been trying to implement simple lines of XML into my flash file created with ActionScript 3.0, but things seem not to be working.
All I want to do is to load an external XML file (data.xml), and output the content which are inside the <project text="content to show"></project> tags into a scripted text field.
Here are what I've been doing so far:
Code:
var txtFldPassage:TextField = new TextField();
txtFldPassage.multiline = txtFldPassage.wordWrap = true;
txtFldPassage.type = TextFieldType.INPUT;
txtFldPassage.border = txtFldPassage.background = true;
var slideNum:Number = 0;
var navData:XML;
var newnavData:XMLList;
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onComplete, false, 0, true);
loader.addEventListener(IOErrorEvent.IO_ERROR, onIOError, false, 0,
true);
loader.load(new URLRequest("data.xml"));
function onComplete(evt:Event):void {
try {
navData = new XML(evt.target.data);
newnavData = navData.children();
trace(newnavData);
txtFldPassage.text = newnavData[slideNum].name().toString();
loader.removeEventListener(Event.COMPLETE, onComplete);
loader.removeEventListener(IOErrorEvent.IO_ERROR,
onIOError);
} catch (err:Error) {
trace("Could not parse loaded content as XML:
" + err.
message);
}
}
function onIOError(evt:IOErrorEvent):void {
trace("An error occurred when attempting to load the XML.
" +
evt.text);
}
addChild(txtFldPassage);
and here's the XML file, data.xml
Code:
<?xml version='1.0' encoding='UTF-8'?>
<data>
<list1>
<project text="When the Tail is Gone" mp3="a1.mp3"/>
<project text="What is a /1baby frog called? Where does it /2come from? How does a baby /3frog grow into an adult frog? This is the story of the life cycle of the frog."/>
<project text="When it is still winter, frogs lay their eggs. They do not have a /3nest; instead they lay them at the edge of a pond. And they do not lay just one egg; they lay /1hundreds. They look like /2little round balls of /2jelly, each with a black dot in the center. Sometimes, if the pond is small, it can be completely full of jelly. The eggs have to be just under the water surface but not too deep. /2Otherwise, the tiny frogs will die."/>
<project text="The /1frog is an amphibian, that is, an /1animal that lives partly in water and partly on land. Unlike frogs, toads live more on land. As an adult, a frog lives on land but it lays its eggs in water. These /3eggs are called frogspawn, and they are the first stage in the amazing metamorphosis, or change, into adult frogs."/>
<project text="A few weeks later things have begun to /1develop. Some of the eggs have little tails, and are /3beginning to swim. When they look like this, they are called /4tadpoles. They have little openings on the side of their /4head called gills. They /3breathe underwater through their gills like fish."/>
<project text="Next, they grow legs, and use them to help them swim. Just like /4humans, frogs know that kicking with your legs, and using your arms helps you swim."/>
</list1>
<list2></list2>
<list2>
<project text="human being newly born" ID="B01_01"/>
<project text="the action of reaching a place" ID="U01_01"/>
<project text="an animal that can live on land and in water" ID="I01_01"/>
</list2>
</data>
As soon as I run the script, it will only show a text field showing "list1"
Thanks in advance.
View Replies !
View Related
External XML Into ActionScript 3.0 Text Field
I've been trying to implement simple lines of XML into my flash file created with ActionScript 3.0, but things seem not to be working.
All I want to do is to load an external XML file (data.xml), and output the content which are inside the <project text="content to show"></project> tags into a scripted text field.
Here are what I've been doing so far:
ActionScript Code:
var txtFldPassage:TextField = new TextField();
txtFldPassage.multiline = txtFldPassage.wordWrap = true;
txtFldPassage.type = TextFieldType.INPUT;
txtFldPassage.border = txtFldPassage.background = true;
var slideNum:Number = 0;
var navData:XML;
var newnavData:XMLList;
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onComplete, false, 0, true);
loader.addEventListener(IOErrorEvent.IO_ERROR, onIOError, false, 0,
true);
loader.load(new URLRequest("data.xml"));
function onComplete(evt:Event):void {
try {
navData = new XML(evt.target.data);
newnavData = navData.children();
trace(newnavData);
txtFldPassage.text = newnavData[slideNum].name().toString();
loader.removeEventListener(Event.COMPLETE, onComplete);
loader.removeEventListener(IOErrorEvent.IO_ERROR,
onIOError);
} catch (err:Error) {
trace("Could not parse loaded content as XML:
" + err.
message);
}
}
function onIOError(evt:IOErrorEvent):void {
trace("An error occurred when attempting to load the XML.
" +
evt.text);
}
addChild(txtFldPassage);
and here's the XML file, data.xml
Code:
<?xml version='1.0' encoding='UTF-8'?>
<data>
<list1>
<project text="When the Tail is Gone" mp3="a1.mp3"/>
<project text="What is a /1baby frog called? Where does it /2come from? How does a baby /3frog grow into an adult frog? This is the story of the life cycle of the frog."/>
<project text="When it is still winter, frogs lay their eggs. They do not have a /3nest; instead they lay them at the edge of a pond. And they do not lay just one egg; they lay /1hundreds. They look like /2little round balls of /2jelly, each with a black dot in the center. Sometimes, if the pond is small, it can be completely full of jelly. The eggs have to be just under the water surface but not too deep. /2Otherwise, the tiny frogs will die."/>
<project text="The /1frog is an amphibian, that is, an /1animal that lives partly in water and partly on land. Unlike frogs, toads live more on land. As an adult, a frog lives on land but it lays its eggs in water. These /3eggs are called frogspawn, and they are the first stage in the amazing metamorphosis, or change, into adult frogs."/>
<project text="A few weeks later things have begun to /1develop. Some of the eggs have little tails, and are /3beginning to swim. When they look like this, they are called /4tadpoles. They have little openings on the side of their /4head called gills. They /3breathe underwater through their gills like fish."/>
<project text="Next, they grow legs, and use them to help them swim. Just like /4humans, frogs know that kicking with your legs, and using your arms helps you swim."/>
</list1>
<list2></list2>
<list2>
<project text="human being newly born" ID="B01_01"/>
<project text="the action of reaching a place" ID="U01_01"/>
<project text="an animal that can live on land and in water" ID="I01_01"/>
</list2>
</data>
As soon as I run the script, it will only show a text field showing "list1"
Thanks in advance.
View Replies !
View Related
Loading External Text INTO Actionscript Itself
Is this possible, because what i have is a simple 1 user admin login system, but i want the user to beable to change the password as simple as changing a text file and uploading it which the actionscript will dynamicly load the TEXT into! the Actionscript itself?? if you know what i mean....
on (release) {
if (username_ti.text == "username") {
error_ti.text = "";
} else {
error_ti.text = "Username is Incorrect";
}
if (password_ti.text == "020688") {
passwordError_ti.text = "";
} else {
passwordError_ti.text = "Password is Incorrect";
}
if (username_ti.text == "admin" && password_ti.text == "password") {
loginSuccess_ti.text = "Login Successful";
gotoAndPlay("loadingText");
}
}
Code:
on (release) {
if (username_ti.text == "like load the textfiles text into here") {
error_ti.text = "";
} else {
error_ti.text = "Username is Incorrect";
}
View Replies !
View Related
External XML Into ActionScript 3.0 Text Field
I've been trying to implement simple lines of XML into my flash file created with ActionScript 3.0, but things seem not to be working.
All I want to do is to load an external XML file (data.xml), and output the content which are inside the <project text="content to show"></project> tags into a scripted text field.
Here are what I've been doing so far:
Code:
var txtFldPassage:TextField = new TextField();
txtFldPassage.multiline = txtFldPassage.wordWrap = true;
txtFldPassage.type = TextFieldType.INPUT;
txtFldPassage.border = txtFldPassage.background = true;
var slideNum:Number = 0;
var navData:XML;
var newnavData:XMLList;
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onComplete, false, 0, true);
loader.addEventListener(IOErrorEvent.IO_ERROR, onIOError, false, 0,
true);
loader.load(new URLRequest("data.xml"));
function onComplete(evt:Event):void {
try {
navData = new XML(evt.target.data);
newnavData = navData.children();
trace(newnavData);
txtFldPassage.text = newnavData[slideNum].name().toString();
loader.removeEventListener(Event.COMPLETE, onComplete);
loader.removeEventListener(IOErrorEvent.IO_ERROR,
onIOError);
} catch (err:Error) {
trace("Could not parse loaded content as XML:
" + err.
message);
}
}
function onIOError(evt:IOErrorEvent):void {
trace("An error occurred when attempting to load the XML.
" +
evt.text);
}
addChild(txtFldPassage);
and here's the XML file, data.xml
Code:
<?xml version='1.0' encoding='UTF-8'?>
<data>
<list1>
<project text="When the Tail is Gone" mp3="a1.mp3"/>
<project text="What is a /1baby frog called? Where does it /2come from? How does a baby /3frog grow into an adult frog? This is the story of the life cycle of the frog."/>
<project text="When it is still winter, frogs lay their eggs. They do not have a /3nest; instead they lay them at the edge of a pond. And they do not lay just one egg; they lay /1hundreds. They look like /2little round balls of /2jelly, each with a black dot in the center. Sometimes, if the pond is small, it can be completely full of jelly. The eggs have to be just under the water surface but not too deep. /2Otherwise, the tiny frogs will die."/>
<project text="The /1frog is an amphibian, that is, an /1animal that lives partly in water and partly on land. Unlike frogs, toads live more on land. As an adult, a frog lives on land but it lays its eggs in water. These /3eggs are called frogspawn, and they are the first stage in the amazing metamorphosis, or change, into adult frogs."/>
<project text="A few weeks later things have begun to /1develop. Some of the eggs have little tails, and are /3beginning to swim. When they look like this, they are called /4tadpoles. They have little openings on the side of their /4head called gills. They /3breathe underwater through their gills like fish."/>
<project text="Next, they grow legs, and use them to help them swim. Just like /4humans, frogs know that kicking with your legs, and using your arms helps you swim."/>
</list1>
<list2></list2>
<list2>
<project text="human being newly born" ID="B01_01"/>
<project text="the action of reaching a place" ID="U01_01"/>
<project text="an animal that can live on land and in water" ID="I01_01"/>
</list2>
</data>
As soon as I run the script, it will only show a text field showing "list1"
Thanks in advance.
View Replies !
View Related
External XML Into ActionScript 3.0 Text Field
I've been trying to implement simple lines of XML into my flash file created with ActionScript 3.0, but things seem not to be working.
All I want to do is to load an external XML file (data.xml), and output the content which are inside the <project text="content to show"></project> tags into a scripted text field.
Here are what I've been doing so far:
Code:
var txtFldPassage:TextField = new TextField();
txtFldPassage.multiline = txtFldPassage.wordWrap = true;
txtFldPassage.type = TextFieldType.INPUT;
txtFldPassage.border = txtFldPassage.background = true;
var slideNum:Number = 0;
var navData:XML;
var newnavData:XMLList;
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onComplete, false, 0, true);
loader.addEventListener(IOErrorEvent.IO_ERROR, onIOError, false, 0,
true);
loader.load(new URLRequest("data.xml"));
function onComplete(evt:Event):void {
try {
navData = new XML(evt.target.data);
newnavData = navData.children();
trace(newnavData);
txtFldPassage.text = newnavData[slideNum].name().toString();
loader.removeEventListener(Event.COMPLETE, onComplete);
loader.removeEventListener(IOErrorEvent.IO_ERROR,
onIOError);
} catch (err:Error) {
trace("Could not parse loaded content as XML:
" + err.
message);
}
}
function onIOError(evt:IOErrorEvent):void {
trace("An error occurred when attempting to load the XML.
" +
evt.text);
}
addChild(txtFldPassage);
and here's the XML file, data.xml
Code:
<?xml version='1.0' encoding='UTF-8'?>
<data>
<list1>
<project text="When the Tail is Gone" mp3="a1.mp3"/>
<project text="What is a /1baby frog called? Where does it /2come from? How does a baby /3frog grow into an adult frog? This is the story of the life cycle of the frog."/>
<project text="When it is still winter, frogs lay their eggs. They do not have a /3nest; instead they lay them at the edge of a pond. And they do not lay just one egg; they lay /1hundreds. They look like /2little round balls of /2jelly, each with a black dot in the center. Sometimes, if the pond is small, it can be completely full of jelly. The eggs have to be just under the water surface but not too deep. /2Otherwise, the tiny frogs will die."/>
<project text="The /1frog is an amphibian, that is, an /1animal that lives partly in water and partly on land. Unlike frogs, toads live more on land. As an adult, a frog lives on land but it lays its eggs in water. These /3eggs are called frogspawn, and they are the first stage in the amazing metamorphosis, or change, into adult frogs."/>
<project text="A few weeks later things have begun to /1develop. Some of the eggs have little tails, and are /3beginning to swim. When they look like this, they are called /4tadpoles. They have little openings on the side of their /4head called gills. They /3breathe underwater through their gills like fish."/>
<project text="Next, they grow legs, and use them to help them swim. Just like /4humans, frogs know that kicking with your legs, and using your arms helps you swim."/>
</list1>
<list2></list2>
<list2>
<project text="human being newly born" ID="B01_01"/>
<project text="the action of reaching a place" ID="U01_01"/>
<project text="an animal that can live on land and in water" ID="I01_01"/>
</list2>
</data>
As soon as I run the script, it will only show a text field showing "list1"
Thanks in advance.
View Replies !
View Related
Actionscript IN External Text File?
Hey all - after using external text files a lot in my sites, as they make updates more manageable for me, I am wondering if anyone knows if it is possible to use as in an external text file. For instance, when I load an external text file in to a dynamic text field, can I perform a "loadMovie" from within that text file, as opposed to simply <a href=""> and creating a hyperlink? The goal is to be able to load external swf and jpg files in to other empty movie clips while never refreshing the browser or opening a new window. Any help would be greatly appreciated! Thanks!
View Replies !
View Related
Formatting External Font
Hi im exporting text from an external text file, i saw an example where included in the text file were html tags such as font color, and html links, i put similar tags in my text file, but instead of formatting the text using the tags, it has included the tags asif they were part of the text.
Ive pressed the lil button in flash to render text as html, but it just doesnt work, heres my text file:
&text000=<font color="#006699">Vid Rig
&text001=<font color="#990033">Glasses
&text002=<font color="#993333">3D Input Device
&text003=<font color="#FFCC66">Bum Coder
&text004=<font color="#CC99CC">Toon Man
&text005=<font color="#0033CC">Desert Car
&text006=<font color="#FFFFFF">Mustang
&text007=<font color="#993300">Eagle
&text008=<font color="#006633">Mum n Baby
&text009=<font color="#009999">Pooh Bear
&text010=<font color="#FF0000">Depth Scree
What am i doing wrong?
Lee
View Replies !
View Related
External News Formatting
Is it possible to have a news portion of a page be externally linked to a text file that has formatting?
This is to say that the date appears properly formatted, the text is properly indented, and the name of the author is properly placed.
Also, is it possible to have this sort of dynamic text field with a customized shape and scrollbar? I have seen on some sites that the scrollbar wasn't simply a vertical bar. I'm looking for something slightly more rounded.
Here is the site in question: SITE
Thanks,
DaVuLf
View Replies !
View Related
External File Formatting
Well I've flash file working 100% however it uses an external file to load a bunch of variables. I did it this way so that anyone could update the variables with newer data. However flash won't read it if I put enters (or newlines) after each variable...it only reads one line.
so instead of looking like this:
AreaName=Downtown&
AreaPop=1,919&
AllNum=39.25&
the file looks like this:
AreaName=Downtown&AreaPop=1,919&AllNum=39.25&
The first being a lot more user friendly (which is what I need). Am i doing something wrong, or is this how it always is?
View Replies !
View Related
Parsing And Formatting External Txt
What I'm not sure how to do:
1. Take external text strings from PHP
2. format them to have links styles, classes (currently used in my HTML ver)from my external CSS
I just dont know how to convert an entry like below into a flash textfield. I am currently using PHP to build an HTML document with my CSS tags. Whats the best means of doing this?
I cant figure out the hover state equiv. in a textfield either.
I have only brought text that wasnt dynamically created and I don't want to mess this up for the future.
Here one section of whats to be many successive 'section's. Having control over the background, font and color of each section would be ideal.
HTML Code:
<div class="linkSection">
<div class="linkHeader">Glossaries of Graphic Design, Printing, Typograpy, Cutting, Numbering, Binding, Embellishing...</div>
<div class="linkSectionDesc">
<p>Terms, standards, diagrams and goodies crucial to our fields explained in great detail.</p>
</div>
<div class="linkDesc">
<p><a class="linkName" href="http://home.vicnet.net.au/~typo/glossary/theme-m.htm" target="_blank">Melbourne Museum of Printing</a> - Printing and Typography Glossary that includes many finishing terms.</p>
<p><a class="linkName" href="http://glossary.ippaper.com/default.asp?req=knowledge/article/216&catitemid=32" target="_blank">International Paper</a> - This glossary for printing includes great colored diagrams of much of the printing and finishing process.</p>
<p><a class="linkName" href="http://www.printindustry.com/glossary.htm" target="_blank">Print Industry</a> - Glossary of Printing & Graphic Terms - Important terms of the industry alphabetized.</p>
<p><a class="linkName" href="http://www.expertsinfinishing.com/folding.html" target="_blank">Finishing Experts Group</a> - Check out the great overview of folding basics.</p>
</div>
</div>
View Replies !
View Related
Formatting External Data
Is there a way to format external data in the text file. IE putting in links to e-mails? The only way that I have found to put links in is through a tutorial on this site, but you have to do it in the flash authoring environment
help on this would be much appreciated.
I also have MX 2004, but would rather use MX because that is what I am currently exporting as, and the Flash 7 plugin isn't widespread enough yet.
thanks
View Replies !
View Related
Formatting External Textfiles?
When working with the loadVars object and an external textfile, is it possible to format the text in the textfile somewhat? It only seems to work when you write every var after the other separated by &, without any car. returns.
I'd love to be able to use a file that looks like this:
&name1=blabla
&address1=adress here
&hobby1=this is ones hobby
&name2=balbalba
&address2=numero two lives here
&hobby2=this is mr.two's hobby
&name3 etc...
Now all my txtfiles look like
&name1=blabla &address1=adress here &hobby1=this is ones hobby &name2=balbalba &address2=numero two lives here &hobby2=this is mr.two's hobby &name3 etc...
cheers !
S.
View Replies !
View Related
|