var testLayer = cc
.Layer.extend({
ctor : function(){
this._super()
this
.init()
return true
},
init : function(){
var csv = new cc
.ScrollView()
csv
.setDirection(cc
.SCROLLVIEW_DIRECTION_HORIZONTAL)
csv
.setTouchEnabled(true)
csv
.setBounceable(true)
csv
.setViewSize(cc
.size(
500,
400))
csv
.setAnchorPoint(cc
.p(
0,
0))
csv
.x =
0
csv
.y =
0
this
.addChild(csv)
csv
.setContentSize(cc
.size(
500,
400))
var layer = new cc
.LayerColor()
layer
.setColor(cc
.color(
0,
255,
255))
csv
.setContainer(layer)
for(var i =
0
var widthList = new cc
.LayerColor()
widthList
.attr({
x : i *
100 + (i +
1) *
20,
y :
0,
width :
100,
height :
500,
color : colorList[i]
})
csv
.addChild(widthList)
}
var childWidth =
0
for(var i =
0
childWidth += csv
.getContainer()
.children[i]
.width +
20
}
cc
.log(
"【打印】childWidth:",childWidth,csv
.children.length)
csv
.setContentSize(cc
.size(childWidth,
400))
cc
.log(
"【scrollView】打印:", csv
.getContentSize()
.width, csv
.getContentSize()
.height)
}
})