1 Reply Latest reply on Jun 26, 2009 7:13 AM by kglad

    XML Menu Issue, : in menu item name causes problems


      Hi all,


      I've got an issue with an xml menu.



      On this page: http://www.trailermen.com/showreel.php


      The showreel's menu is XML driven. The menu works fine, however if the buttons text has a ":" in it, it breaks.


      As you can see on that menu, the item "Touch And Go: Would You" has a ":" in it, this causes two problems.


      1. The record label icon doesn't show up

      2. If you hover the mouse over the button, when it goes to the hover state the text turns to "h" the fields default value and the genre disapears.



      Heres how the XML looks:


      <?xml version="1.0" encoding="iso-8859-1"?>
         <menu mType="video" mClient="Channel4" buttonName="Ugly Betty Trailer" genreName="URBAN/TV" trackFLV="Ugly_Betty.flv" trackCredits="Written/Produced (UNIPPM)" trackNotes="2009 Series 3 Promo" trackDisplay="Ugly Betty Trailer" />
         <menu mType="audio" mClient="universal" buttonName="Battleground" genreName="FILM/TRAILER" trackFLV="Battleground.flv" trackCredits="Written, Arranged, Produced" trackNotes="Available for Licensing" trackDisplay="Battleground" />
         <menu mType="audio" mClient="universal" buttonName="Evasion" genreName="FILM/TRAILER" trackFLV="Evasion.flv" trackCredits="Written, Arranged, Produced" trackNotes="Available for licensing" trackDisplay="Evasion" />
         <menu mType="video" mClient="v2" buttonName="Touch And Go: Would You" genreName="LATIN/DANCE/FILM" trackFLV="Would_You.flv" trackCredits="Remix, Additional Arrangement & Production" trackNotes="From the film Forces of Nature" trackDisplay="Would You" />
         <menu mType="audio" mClient="sony" buttonName="Soul Fool" genreName="URBAN/RETRO" trackFLV="Soul_Fool.flv" trackCredits="Written, Arranged, Produced" trackNotes="Available for licensing" trackDisplay="Soul Fool" />
         <menu mType="video" mClient="Ogilvy" buttonName="Hedex Commercial 09" genreName="TV COMMERCIAL" trackFLV="Hedex.flv" trackCredits="Music and Sound Design" trackNotes="For Ogilvy & Mather" trackDisplay="Hedex Commercial 09" />
         <menu mType="audio" mClient="universal" buttonName="Questions" genreName="URBAN/YOUTH" trackFLV="Questions.flv" trackCredits="Written, Arranged, Produced" trackNotes="Available for licensing" trackDisplay="Questions" />


      As a note:

      mType is the track format (audio or video)

      mClient is the client or record label

      buttonName is the track name (as it is to appear on the button itself)

      genreName is the tracks genre

      trackFLV is the flv file to load into the player

      trackCredits are the credits (passed to the player itself)

      trackNotes are the notes on the track (passed to the player itself)

      trackDisplay is the player display title as this can vary slightly from the button name (again passed to the player)




      Heres the AS Code for parsing the XML:

      * For some reason the forum here is adding & nbsp; to the text where I have added spaces. These obviously aren't in the Actionscript code.


      // Check is the paramater "Reel" has been passed to the movie, if so load a custom playlist. Otherwise load the default playlist.
           this.playList = "playlists/" + _root.Reel;
           this.playList = "menu.xml";
      // Set important variables
      ready = false;
      speed = 5;
      xStart = 85;
      yStart = 1;
      bWidth = 496;
      bHeight = 27;
      // Load the menu XML file
      var menuXml = new XML();
      function loadXml(file:String) 
           menuXml.ignoreWhite = true;
           menuXml.onLoad = loadMapData;
           function loadMapData() 
                for (var i = 0; i<this.firstChild.childNodes.length; i++) 
                     var bn = this.firstChild.childNodes[i].attributes.buttonName;
                     var genre = this.firstChild.childNodes[i].attributes.genreName;
                     var mtype = this.firstChild.childNodes[i].attributes.mType;
                     var mclient = this.firstChild.childNodes[i].attributes.mClient;
                     var track_flv = this.firstChild.childNodes[i].attributes.trackFLV;
                     var credits = this.firstChild.childNodes[i].attributes.trackCredits;
                     var notes = this.firstChild.childNodes[i].attributes.trackNotes;
                     var display = this.firstChild.childNodes[i].attributes.trackDisplay;
                     // Attach the button movie clip (placing them one below the other vertically)
                     var b = _root.container.text.attachMovie("button", bn, i);
                     // Set button variables          
                     b._x = xStart;
                     b._y = yStart+(bHeight*i);
                     b.txt = bn;
                     b.bn = bn;
                     b.track_flv = track_flv;               
                     b.genre = genre;
                     b.mtype = mtype;
                     b.mclient = mclient;
                     b.notes = notes;
                     b.credits = credits;
                     b.trackname = display;
      var c = this.attachMovie("current", "current", 100);
      var d = this.attachMovie("draw", "draw", 101);
      d._x = 5;
      d._y = 160;
      c._x = xStart+bWidth;
      c._y = 200;
      target = yStart;
      this.onEnterFrame = function() 
           if (ready) 
                current._y += (target-current._y)/speed;



      The ActionScript on the button movie clip is relatively simple:


      // ActionScript Document
      // Set the icon image to audio or video
      if(mtype == "audio")
      // Set the path for the client icons and set the current icon to mclient
      this.clientpath = "tracks/icons/small/" + mclient + ".png";
      // Load the client icon  into the client movie clip
      loadMovie(this.clientpath, client); 
      // Do button press function (which loads the videoplayer and sets a number of variables used by the player to reflect the requested XML record).
      btn.onPress = function() 
                          _root.thistrack = track_flv;
                          _root.trackname = trackname;
                          _root.trackgenre = genre;
                          _root.trackcredits = credits;
                          _root.tracknotes = notes;
                      _root.trackclient = mclient;
                          _root.tracktype = mtype;
      // Mouse over functions (to highlight button and text)          
      btn.onRollOver = function() 
      btn.onRollOut = function() 



      Does anyone have any idea whats causing this issue?


      Message was edited by: FizixRichard Artifacts in the code pastes