I found some script on the internet that uses the attachMovie method to create a tiled background effect and I don't understand one of the lines that uses colons. If someone could explain to me what that's all about then I would really appreciate it. Here's the code: numCols = Stage.width/10; numRows = Stage.height/10; cnt = 1; for(var i=0;i<numRows;i++) { for(var j=0;j<numCols;j++) { tmpObj = {_x:startX,_y:startY};//*****THIS IS THE LINE I DON'T UNDERSTAND. For the most part I get what // it's doing but I don't get why it's written that way as I've never seen the use of colons in actionscript before***** thisClip = _root.attachMovie("myClip", "mc"+cnt, cnt, tmpObj); cnt++; startX += thisClip._width*4; trace(startX) } startX = 0; startY += thisClip._height*4; }
the colons are used to set values within an object (also used in arrays). make use of List Variables to see how Flash interprets your code, startX = startY = 50; tmpObj = {_x:startX,_y:startY}; /* _level0.tmpObj = [object #1, class 'Object'] { _y:50, _x:50 } */ aDP = []; aDp[0] = {label:"Zero",data:0} aDp[1] = {label:"One",data:1} /* _level0.aDP = [object #2, class 'Array'] [ 0:[object #3, class 'Object'] { data:0, label:"Zero" }, 1:[object #4, class 'Object'] { data:1, label:"One" } ] */ hth
Thank you... I understand now.
Don't see what you're looking for? Try a search.
|