View Full Version : Flash/EXternal Source question
Rockonmetal
06-03-2007, 09:16 PM
I only have Flash on trial *27 days*... and i wanna make a flash website... but the content on the News page is gonna be changing...
I wanna know if i can have it so that it reads the external source *xml,txt,html, just not server side script* and then change the font and format to fit into the content box i will make...
Tutorials are helpful *esspecially video ones*...
Thanks to anyone that helps
Rockonmetal
06-03-2007, 09:48 PM
this.createTextField("my_txt", 10, 10, 10, 320, 100);
my_txt.autoSize = "left";
my_txt.border = true;
my_txt.multiline = true;
my_txt.wordWrap = true;
var reviews_xml:XML = new XML();
reviews_xml.ignoreWhite = true;
reviews_xml.onLoad = function (success:Boolean):Void {
if (success) {
var childItems:Array = reviews_xml.firstChild.childNodes;
for (var i:Number = 0; i < childItems.length; i++) {
my_txt.text += childItems[i].firstChild.firstChild.nodeValue + "\n";
}
} else {
my_txt.text = "There is either no content to load, or we are about to load content in...";
}
}
reviews_xml.load("text.xml");
ok this is the actionscript code i have right now in there... but i don't want it to create a text box, i want it to use an assigned textbox called "Content"
Actionscript 2.0 is what i am using...
THANKS!
Rockonmetal
06-05-2007, 08:48 PM
Btw! I still am looking for an answer!!!! Post if your going to help or researching or just trying to remember... something... please, i only have 25 days left of flash
alexjewell
06-05-2007, 11:42 PM
May I ask why you're preferring an assigned text box instead of this script creating a new one?
Medyman
06-07-2007, 07:09 PM
If you already have a text field on the stage which you want to populate with xml data, simply declare the content of that text field to the xml variable reading it.
For example, take a simple flash page, nothing but one text field (sized to your needs, with fonts embedded if needed, color, size chosen etc.., You can do this via AS...and even XML if you really wanted). Text field has instance name of ContentText.
XML:
<xml>
<text>
<content>Content is here</content>
</text>
<xml>
AS 2.0
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = function(success) {
if (success) {
parent = this.firstChild
loadContent
{
else {
trace("error loading xml")
}
xml.load(text.xml)
function loadContent () {
var ContentTxt = parent.childNodes[0].childNodes[0]
ContentText.text = ContentTxt
}
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.