A Flash Developer Resource Site

Results 1 to 1 of 1

Thread: setMedia problem with variables

  1. #1
    Webmong
    Join Date
    Mar 2004
    Location
    London UK
    Posts
    24

    [F8] setMedia problem with variables

    Hi all

    incase it matters....I'm using flash 8.

    I'm stuck and I can see why....I'm loading my playlist in from an XML file...that all work great, I tested and everything seems fine...the problem is when I try to pass the variables to the flash "setMedia" function...if I just print them they are perfect... please see code below.

    Cheers
    C

    My XML code:
    code:

    playlistContent = new XML();
    playlistContent.ignoreWhite = true;
    playlistContent.load("playlist.xml");
    playlistContent.onLoad = function(success)
    {
    if(success)
    {
    _root.numberOfItems = _root.playlistContent.firstChild.childNodes.length ;
    for (a=0; a<=30; a++) {
    if(a<_root.numberOfItems){
    //_root["soundObject" + a] = new Sound();
    _root["type" + a] = _root.playlistContent.firstChild.childNodes[a].childNodes[0].childNodes;
    _root["title" + a] = _root.playlistContent.firstChild.childNodes[a].childNodes[1].childNodes;
    _root["desc" + a] = _root.playlistContent.firstChild.childNodes[a].childNodes[2].childNodes;
    _root["file" + a] = _root.playlistContent.firstChild.childNodes[a].childNodes[3].childNodes;
    _root["image" + a] = _root.playlistContent.firstChild.childNodes[a].childNodes[4].childNodes;
    _root["but" + a].label = _root["title" + a];
    }else{
    _root["but" + a]._visible = false;
    }
    }
    }
    }


    Example Output:
    _root.file0 = video/Part01.flv
    _root.type0 = FLV


    My Button:
    code:

    on(release){
    this.but = 0;
    //this works if I input the variable manualy:
    //_root.mc_display.the_Video.setMedia("video/Part01.flv", "FLV");
    //the doesn't work passing the variables from the XML
    _root.mc_display.the_Video.setMedia(_root["file" + but], _root["type" + but]);
    }

    Last edited by cybercampbell; 11-22-2006 at 01:50 PM.
    Successful people ask better questions, and as a result, they get better answers - Anthony Robbins

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