PDA

View Full Version : ScrollPane weirdness


euclidian
05-16-2005, 03:21 PM
Hi,
After much painful messing around I've managed to get a scroll pane working with 11 dynamically attached MovieClips. The problem is that only the first and the last movieclips attached are showing. my code is as follows


this.attachMovie("ScrollPane", "cellInfo_sp", getNextHighestDepth(), {_x:20, _y:215});
this.cellInfo_sp.setSize(240, 145);
this.cellInfo_sp.contentPath = "cellCanvas";

myCanvas = this.cellInfo_sp.content;
myCanvas.attachMovie("cellInfoHeader", "cellHeader", this.cellInfo_sp.content.getNextHighestDepth()); //, {_x:20, _y:215});
//this.cellInfo_sp.setStyle("borderStyle", "none");
//myCanvas["cellHeader"]._visible = false;
for (var i=0; i<10; i++) {
myCanvas.attachMovie("cellInfoRow", "cellRow"+i, getNextHighestDepth()); //, {_y:(i*20)+20});
myCanvas["cellRow"+i]._x = 1;
myCanvas["cellRow"+i]._y = (i*20)+20;
//this.cellInfo_sp["cellRow"+i]._visible = false;
trace(myCanvas["cellRow"+i]);
}
trace(" ");
for (var i=0; i<10; i++) {
trace(myCanvas["cellRow"+i]);
}


the traces from this then appears as follows


_level0.myInfo.cellInfo_sp.spContentHolder.cellRow 0
_level0.myInfo.cellInfo_sp.spContentHolder.cellRow 1
_level0.myInfo.cellInfo_sp.spContentHolder.cellRow 2
_level0.myInfo.cellInfo_sp.spContentHolder.cellRow 3
_level0.myInfo.cellInfo_sp.spContentHolder.cellRow 4
_level0.myInfo.cellInfo_sp.spContentHolder.cellRow 5
_level0.myInfo.cellInfo_sp.spContentHolder.cellRow 6
_level0.myInfo.cellInfo_sp.spContentHolder.cellRow 7
_level0.myInfo.cellInfo_sp.spContentHolder.cellRow 8
_level0.myInfo.cellInfo_sp.spContentHolder.cellRow 9

undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
_level0.myInfo.cellInfo_sp.spContentHolder.cellRow 9


So its as if each cellRow that I add drops out of scope as soon as the next loop iteration is started?!?! is it not possible to attach more than one instance of the same movieclip to a scrollpane's content or something??
Dont really want to have to do 10 seperate versions of the same movieclip in the library, as what I'm doing needs to stay as small as possible.
Thanks for any enlightenment any of ya can provide :s
Dave

sleekdigital
05-16-2005, 03:47 PM
My first thought would be your getnexthighest depth call in...

myCanvas.attachMovie("cellInfoRow", "cellRow"+i, getNextHighestDepth());

I believe you need to say ...

myCanvas.getNextHighestDepth()

euclidian
05-16-2005, 03:50 PM
hehe thank you, I'd come to the same conclusion just this second (was looking forward to showing off that I'd solved my own problem too ;( )
Thanks a lot for taking the time though :)