Rows, Colums, and Depth

  • multi-task
  • Born
  • Born
  • multi-task
  • Posts: 2

Post 3+ Months Ago

I am generating some dynamic logos from an xml and have a question as to why when i load with the number 3 it will load 3 colum 2 rows. However it wont show all items from XML. Here is how I am trying to go about it.
Code: [ Select ]
var numOfItems:Number;
var games:MovieClip = this;
var hspace = 10;
// ten pix space on the sides
var vspace = 10;
// ten pix space on the bottom
startCount = 1;
//counter to keep track of what step we're on
xStart = 384;
// where to start on the x axis
yStart = 300;
// where to start on the y axis
////GetEm
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = function() {
    var nodes = this.firstChild.childNodes;
    numOfItems = nodes.length;
    for (var i = 0; i<numOfItems; i++) {
        var t = games.attachMovie("iconMC", "iconMC"+i, i+1);
        t._x = xStart;
        t._y = yStart;
        t.swapDepths(0);
        // set x and y for this clip
        if (startCount != 3) {
            // find out how many we have in a row
            var xStart = Math.round(t._x+t._width+hspace);
            // only change horizontal
            startCount++;
            // add one to the count
        } else {
            // if we're on number 4 reset everything
            var xStart = 384;
            var yStart = Math.round(t._y+t._height+vspace);
            var startCount = 1;
            ////
            t.logo.logoContainer.loadMovie(nodes[i].attributes.logo);
            t.t1.tText.text = nodes[i].attributes.title;
            t.t2.cText.text = nodes[i].attributes.category;
            t.link = nodes[i].attributes.link;
            t.onRollOver = over;
            t.onRollOut = out;
            t.onRelease = released;
        }
    }
};
xml.load("icons.xml");
  1. var numOfItems:Number;
  2. var games:MovieClip = this;
  3. var hspace = 10;
  4. // ten pix space on the sides
  5. var vspace = 10;
  6. // ten pix space on the bottom
  7. startCount = 1;
  8. //counter to keep track of what step we're on
  9. xStart = 384;
  10. // where to start on the x axis
  11. yStart = 300;
  12. // where to start on the y axis
  13. ////GetEm
  14. var xml:XML = new XML();
  15. xml.ignoreWhite = true;
  16. xml.onLoad = function() {
  17.     var nodes = this.firstChild.childNodes;
  18.     numOfItems = nodes.length;
  19.     for (var i = 0; i<numOfItems; i++) {
  20.         var t = games.attachMovie("iconMC", "iconMC"+i, i+1);
  21.         t._x = xStart;
  22.         t._y = yStart;
  23.         t.swapDepths(0);
  24.         // set x and y for this clip
  25.         if (startCount != 3) {
  26.             // find out how many we have in a row
  27.             var xStart = Math.round(t._x+t._width+hspace);
  28.             // only change horizontal
  29.             startCount++;
  30.             // add one to the count
  31.         } else {
  32.             // if we're on number 4 reset everything
  33.             var xStart = 384;
  34.             var yStart = Math.round(t._y+t._height+vspace);
  35.             var startCount = 1;
  36.             ////
  37.             t.logo.logoContainer.loadMovie(nodes[i].attributes.logo);
  38.             t.t1.tText.text = nodes[i].attributes.title;
  39.             t.t2.cText.text = nodes[i].attributes.category;
  40.             t.link = nodes[i].attributes.link;
  41.             t.onRollOver = over;
  42.             t.onRollOut = out;
  43.             t.onRelease = released;
  44.         }
  45.     }
  46. };
  47. xml.load("icons.xml");


I am trying to get 6 items showing from XML with a button that would grab next set. Which I havent written out yet. Right now I am stuck with just getting 6 to show properly. Any ideas are much appreciated. Thanks in advance
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • multi-task
  • Born
  • Born
  • multi-task
  • Posts: 2

Post 3+ Months Ago

With reference to t.swapDepths(0);

I am trying to manipulate this so that it is behind everything else on stage. However it is setting above all.

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 13 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.