A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: [RESOLVED] XML dynamic text

  1. #1
    Member
    Join Date
    Sep 2008
    Posts
    39

    resolved [RESOLVED] XML dynamic text

    Hi,
    I need help.
    I am making a video player, and I don't ussually use XML but I wanted it to be a little easier to edit than pervious ones i've made.
    I've been using the book "Flash Video for Professionals" by Lisa Larson and Renee Costantini. instead of spending more time on this I thought I'd post it and hope for the best!

    Everything was perfect, but now my boss wants me to add this drawer that comes out with a text description about each video title.

    basically, since i'm already done, I just want to add in an element to my XML and not have to do it a different way.

    THE PROBLEM
    The way I have my as and xml set up, it loads the data for "longdesc" just not in conjunction with the "desc" like I want it too.




    Here is some of my code, the part that loads the xml

    var xmlLoader:URLLoader = new URLLoader();
    xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
    xmlLoader.load(new URLRequest("playlistXML.xml"));


    function xmlLoaded(event:Event):void {
    var playlistXML:XML = new XML(event.target.data);
    var item:XML;
    for each (item in playlistXML.videoname) {
    trace("item: "+item.attribute("flvurl").toXMLString());
    trace("item:"+item.attribute("longdesc").toXMLStri ng());
    this.selections.selection_desc.text = (item.attribute("longdesc").toXMLString());

    myList.addItem({label:item.attribute("desc").toXML String(),


    data:item.attribute("flvurl").toXMLString()});



    }




    //select the first video
    myList.selectedIndex = 0;
    //And automatically play it
    myFLVPlybk.play(myList.selectedItem.data);
    }


    function listListener(event:Event) {
    myFLVPlybk.play(event.target.selectedItem.data);

    }
    myList.addEventListener(Event.CHANGE, listListener);

    MY XML FILE:

    <?xml version="1.0" encoding="iso-8859-1"?>
    <playlist>


    <videoname
    flvurl="videos/one.flv"
    desc="Popeye for President President "
    longdesc="111Sed ut perspiciatis unde omnis iste natus error sit "/>


    <videoname
    flvurl="videos/two.flv"
    desc="Vote for Popeye"
    longdesc="222Sed ut perspiciatis unde omnis iste natus error sit " />

    <videoname
    flvurl="videos/three.flv"
    desc="video test in list "
    longdesc="333 ut perspiciatis unde omnis iste natus error sit " />

    <videoname
    flvurl="videos/four.flv"
    desc="Vote for Popeye video four"
    longdesc="444 ut perspiciatis unde omnis iste natus error sit "/>



    </playlist>
    Thank you in advance!!!
    Last edited by laurabeth; 05-20-2009 at 04:44 PM. Reason: needed to add a question into the title

  2. #2
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    You can add another item to the array:

    myList.addItem ({label:item.attribute("desc").toXMLString(),data: item.attribute("flvurl").toXMLString(),text:item.a ttribute("longdesc").toXMLString()});

    and get it by this way:


    function listListener (event:Event)
    {
    //myFLVPlybk.play (event.target.selectedItem.data);
    trace(event.target.selectedItem.label);
    trace(event.target.selectedItem.data);
    trace(event.target.selectedItem.text);
    }
    myList.addEventListener (Event.CHANGE, listListener);
    - The right of the People to create Flash movies shall not be infringed. -
    | www.Flashscript.biz | Flashscript Biz Classes/Components |

  3. #3
    Member
    Join Date
    Sep 2008
    Posts
    39
    Thank you thank you thank you. I'm going to try it out right now. Thanks so much

  4. #4
    Member
    Join Date
    Sep 2008
    Posts
    39

    on rollover instead of select?

    It worked ! thanks so much!!! I understand what I was doing wrong now.

    BUT
    instead of "SelectedItem" is there a term that would make this text show up when I rolled over the item in the listbox?

    Thanks again!

  5. #5
    Member
    Join Date
    Sep 2008
    Posts
    39

    rollover effect for each item in a list?

    Is it possible to have a rollover effect for each item in a list?
    The long description just shows up on rollover not select?

    I want the text ("longdesc") to show up on a list item rollover not on selectedItem.

    I've tried everything...

  6. #6
    Member
    Join Date
    Sep 2008
    Posts
    39
    Incase anyone else ever needs to know how to have something show up on rollover like a preview. import fl.events.ListEvent;

    myList.addEventListener(ListEvent.ITEM_ROLL_OVER,t est);

    function test (e:ListEvent)
    {
    trace (e);
    trace (e.item.text);
    selection_desc.text = (e.item.text);

    }

  7. #7
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    Thanks for sharing . I somehow did not keep track of the post any more.
    - The right of the People to create Flash movies shall not be infringed. -
    | www.Flashscript.biz | Flashscript Biz Classes/Components |

  8. #8
    Member
    Join Date
    Sep 2008
    Posts
    39
    Quote Originally Posted by cancerinform View Post
    Thanks for sharing . I somehow did not keep track of the post any more.

    I had to share it took me forever to figure out
    hopefully someone someday will be looking for it
    Thanks for your help!

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