|
|
||||||
|
||||||
| Index Link To US Private Messages Archive FAQ RSS | ||||||
| Flash Discussion Forum Flash design presents a limitless number of possibilities for your sites and designs. Discuss your Flash ideas, questions and issues here. |
Share Thread: & Tags
|
||||
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
||||
|
Hi All,
Just a quick question. I have been trying to create a simple auto scrolling text box with flash that uses an external CSS and XML file for data and styles. I want to be able to update the XML file as needed and have the changes reflected in the movie. I have tried several tuts but I end up viewing all of the XML tags, not just the data. I have tried some tools and some free action scripts but to no avail. If you can suggest a tut, or a .mxp or other tool to help me do this I would appreciate it very much. I did a seach in the flash fourm but did not find an answer to this, perhaps I overlooked as I am sure I can't be the only person to want this. I'm am still new to flash, though I have been using Swish for some time (FYI Swish = Flash for dummies). Thanx all Here is the Action script for importing the XML and calling the CSS: //init TextArea component myText.html = true; myText.wordWrap = true; myText.multiline = true; myText.label.condenseWhite=true; //load css kungFuStyle = new TextField.StyleSheet(); kungFuStyle.load("kungfu.css"); myText.styleSheet = kungFuStyle; //load in XML kungFuContent = new XML(); kungFuContent.ignoreWhite = true; kungFuContent.load("kungfu.xml"); kungFuContent.onLoad = function(success) { if(success) { myText.text = kungFuContent; } } And here is the XML data from the tut: <?xml version="1.0" encoding="iso-8859-1"?> <kungfu> <drunken>This is some drunken text</drunken></p> <monkey>This is some monkey text</monkey> <snake>This is some snake text</snake> <dragon>This is some dragon text</dragon> </kungfu> <kungfu> <drunken>This is some drunken text</drunken> <monkey>This is some monkey text</monkey> <snake>This is some snake text</snake> <dragon>This is some dragon text</dragon> </kungfu>
__________________
Every journey begins with the fisrt step. We're not just building websites… We're building relationships! Visit us www.dcvistudios.com |
|
|||
|
Hi,
You need to look up the xml object. It doesn't work like a string containing html tags. It goes a little something like this: Code:
kungFuContent.onLoad = function(success){
if(success){
trace("xml ok so far");
moveThroughXML();
}else{
trace("something went wrong with the xml");
}
function moveThroughXML(){
for(var i=0; i<kungFuContent.childNodes.length; i++){
if(kungFuContent.childNodes[i]!="kungfu"){
for(var j=0; j<kungFuContent.childNodes[i].childNodes.length; j++){
trace(kungFuContent.childNodes[i].childNodes[j] != "" ? kungFuContent.childNodes[i].childNodes[j].nodeName : "white space");
}
}
}
}
|
|
|||
|
Hi,
You need to look up the xml object. It doesn't work like a string containing html tags. It goes a little something like this: Code:
kungFuContent.onLoad = function(success){
if(success){
trace("xml ok so far");
moveThroughXML();
}else{
trace("something went wrong with the xml");
}
function moveThroughXML(){
for(var i=0; i<kungFuContent.childNodes.length; i++){
if(kungFuContent.childNodes[i]!="kungfu"){
for(var j=0; j<kungFuContent.childNodes[i].childNodes.length; j++){
trace(kungFuContent.childNodes[i].childNodes[j] != "" ? kungFuContent.childNodes[i].childNodes[j].nodeName : "white space");
}
}
}
}
|
|
||||
|
Hi Poab,
Thanx, I will give this a try later today and I'll let you know how it goes. Again thank you very much for taking the time to help.
__________________
Every journey begins with the fisrt step. We're not just building websites… We're building relationships! Visit us www.dcvistudios.com |
|
||||
|
Hi,
Ok, I have tried it and I still can't get it to work right. Here is what I have: Code:
//init TextArea component
myText.html = true;
myText.wordWrap = true;
myText.multiline = true;
myText.label.condenseWhite=true;
//load css
kungFuStyle = new TextField.StyleSheet();
kungFuStyle.load("kungfu.css");
myText.styleSheet = kungFuStyle;
//load in xml
kungFuContent.onLoad = function(success){
if(success){
trace("xml ok so far");
moveThroughXML();
}else{
trace("something went wrong with the xml");
}
function moveThroughXML(){
for(var i=0; i<kungFuContent.childNodes.length; i++){
if(kungFuContent.childNodes[i]!="kungfu"){
for(var j=0; j<kungFuContent.childNodes[i].childNodes.length; j++){
trace(kungFuContent.childNodes[i].childNodes[j] != "" ? kungFuContent.childNodes[i].childNodes[j].nodeName : "white space");
}
}
}
}
}
I have to tell you. From what I read I thought learning this would be a piece of cake, but it is turning out to be tougher that I thought. I know it can be done, I just don't know enough to know where I am going wrong. Thanx again, I look forward to your reply.
__________________
Every journey begins with the fisrt step. We're not just building websites… We're building relationships! Visit us www.dcvistudios.com |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
WebProWorld |
Advertise |
Contact Us |
About |
Forum Rules |
MVP's |
Archive |
Newsletter Archive |
Top |
WebProNews
WebProWorld is an iEntry, Inc. ® site - © 2009 All Rights Reserved Privacy Policy and Legal iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509 |