A Flash Developer Resource Site

Results 1 to 16 of 16

Thread: XML loaded text

  1. #1
    Senior Member
    Join Date
    Jan 2003
    Posts
    143

    XML loaded text

    Hi!

    Does anybody know whow to scroll XML loaded text?

    I have some text in an XML document that I want to load into a text field which scrolls it automatically.

    I used the Macromedia scroll component, but that doesn't work.

    Any ideas?

    Thanks
    --iMat

  2. #2
    Senior Member Jaffasoft's Avatar
    Join Date
    Apr 2001
    Location
    On Travel
    Posts
    1,588
    I've only ever loaded scrolled external txt file. I too am interested in how to load and scroll an XML text. I don't need to scroll it automatically though.

  3. #3
    Senior Member
    Join Date
    Jan 2003
    Posts
    143
    I didn't mean scroll automatically that way. I just need it to be scrollable if the text extends the length of the text field.
    --iMat

  4. #4
    Senior Member
    Join Date
    Jan 2003
    Posts
    143
    And also, is it possible to create line breaks in XML, and have Flash convert all URLs or bits of text that start with "HTTP://" into a link?

    If so, how?

    Thanks
    --iMat

  5. #5
    Senior Member Jaffasoft's Avatar
    Join Date
    Apr 2001
    Location
    On Travel
    Posts
    1,588
    **** i just wrote a thread and the dam forrum says the files size is to big . Thats no go if ya cant upload a simple fla with only one scroll com in it. Any way i got it all working. based of off this tut. Email if you want my working version of it.

    heybays@yahoo.com

    http://www.tupps.com/flash/
    right menu.

  6. #6
    Senior Member
    Join Date
    Jan 2003
    Posts
    143
    There's nothing that needs to be fancy.

    Any ordinary XML file would do. I just need to know how to scroll XML loaded text and create breaks in XML.

    Also, and lastly, I need a code which searches the paragraph for anything that begins with http:// and converts it to the link so if I made:

    And today, I visited http://www.flashkit.com and really enjoyed the tutorials.

    http://www.flashkit.com would be converted to a link to this website.

    Breaks would simple look like:

    lalala....

    lalala....

    in the text box. I have added ignore whitespace, but I think there is a way to add HTML formatting such as a line break into it, but I'm not sure how.

    Thanks for any help!

    If you could send me a Flash file, or post some script, please help me.

    Thanks
    --iMat

  7. #7
    Senior Member
    Join Date
    Jan 2003
    Posts
    143
    Actually, Jaffasoft, your demos are pretty good, but the problem is, I'm not just loading in an XML file.

    I'm using a component. I have been able to load text into the fields, but not HTML formatted.

    Right now, the code looks like:

    blogMenu.onImage = function(att) {
    title = att.title;
    date = att.date;
    body = att.body;
    img = att.pic;
    //trace (this._parent.display);
    this._parent.title = title;
    this._parent.date = date;
    this._parent.body= body;
    this._parent.placeholder.images.loadMovie(img);
    };
    stop();

    while the XML is:

    <sub callback = "onImage"
    label = "Hi"
    pic="123.jpg"
    title="hi"
    date="May 03 2003"
    body="hello"
    ></sub>

    I know its something very simple, but any help would be appreciated, as I am a newbie to scripting and XML.
    --iMat

  8. #8
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    Some XML text cannot be scrolled using the scrollbar component. May be it can but I don't know. So I am using my own scrollbar. See for example:

    http://can_info_guide.tripod.com/tex...htmlinxml.html

    You can download the file and use the scrollbar. Name scrollbar and textfield and Put this script into the frame where your textfield is located:

    scrollbarName.target = textFieldName;
    - The right of the People to create Flash movies shall not be infringed. -

  9. #9
    Senior Member
    Join Date
    Jan 2003
    Posts
    143
    Still need help with the line breaks and links though.

    I see how you all did it, but I can't think of how to convert my code to work like that.
    --iMat

  10. #10
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    What is your code or your xml? If you look at the file, which I pointed to it is actually easy to insert urls. Flank your textnode with html tag (p) (/p) and then insert urls like (a href="myurl.html") and so on. Just do not call your textnode firstChild.nodeValue just firstChild, then it works. Show us your code. Here is also a tutorial you might want to look at:
    http://can_info_guide.tripod.com/xml.../tutorial.html

    particularly for urls.
    - The right of the People to create Flash movies shall not be infringed. -

  11. #11
    Senior Member
    Join Date
    Jan 2003
    Posts
    143
    You can see my code above in one of my previous posts on this thread.

    Everyting in my XML is structered in on string, which doesn't give me space to add text in between tags, or else they'll form submenus.

    Is there a way to add links and breaks in a:

    body="hello, this is my text which is displayed in a text field"

    ?
    Problem is, when I add tags, it messes up the XML structure, because I'd have a tag within a tag.

    Thanks

    --iMat
    --iMat

  12. #12
    Senior Member Jaffasoft's Avatar
    Join Date
    Apr 2001
    Location
    On Travel
    Posts
    1,588
    It's important to get the right structure. I have only been learning myself ,in fact this is first one i have done. Based on that link above thread and a slight change it is showing links and breaks in the scrollbar component. More reading here about attributes.

    http://www.w3schools.com/xml/xml_attributes.asp

    Example on one of the buttons. text box named scroller (in instance panel) and text box var named xmlIn. And scroller companent named scroller.

    on (press) {
    myXML = new XML();
    myXML.onLoad = DisplayData;
    myXML.load("loadtxtXML.xml");
    function DisplayData(success) {
    if (success) {
    scroller.html = true;
    scroller.htmlText= this.body;
    XMLin = this.body.childNodes[0].nodeValue;
    }
    }
    }

    Some place with some nice tutorials would be handy and explaining a bit more about XML and flash and what you can do with it and but with simple little tuts would be good. Sure thier somewhere just got to find them.

  13. #13
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    I am currently writing a basic xml tutorial how to get to nodes, attributes etc with search engine development as examples. Here are some files I made. You can see how one can integrate html in textnodes including links. I have not yet written explanation for this but you can guess.
    - The right of the People to create Flash movies shall not be infringed. -

  14. #14
    Japanese l337 TRJNET's Avatar
    Join Date
    Mar 2001
    Location
    Toronto, Canada
    Posts
    399
    Nice! Been looking for something like this, that gives examples of xml nodes to m ess around with. Problem is, I thinik i need to get a XML & Flash MX book so i can get more technical with it and fully understand the concepts with nodes.
    consultant / contractor / designer

  15. #15
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    I finished my basic XML tutorial. Go to this thread for a link:
    http://www.flashkit.com/board/showth...hreadid=450700
    - The right of the People to create Flash movies shall not be infringed. -

  16. #16
    Senior Member Jaffasoft's Avatar
    Join Date
    Apr 2001
    Location
    On Travel
    Posts
    1,588
    Jolly good. I'm going to chellenge myself and try to make a family tree , based om what's in your tutorial so that i can see if i understand it corectly.

    Hopefully we can incorporate a add new nodes and write them to the server xml for example a new babe is born. Then to just enter the new information ie name hair colour and date of birth in , input text filed on a web site and press sumbit to write up date the XML file on the server so it store the new information.
    Though this will come later i will try and tackle the first bit which is your tutorial first.

    Thanks for putting it up it looks like nice work and well done.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center