-
1. Re: attachMovie & depths
kglad Jul 5, 2013 12:13 PM (in response to Ron Colmen)i don't see where you're removing anything. but you should use different names and depths:
btnsRceLoad.onData = function(src) {
_root.uusersNow.text = "Total Pages: " + src;
for(var i:Number=0; i<src; i++){
var mc:MovieClip=_root.dNumHolder_mc.attachMovie("btnNum","numberBtn"+_root.dNumHolder_mc.getNextHighestDepth(),_roo t.dNumHolder_mc.getNextHighestDepth());
mc._x = xNumPosition; // assuming this is initialized
mc._y = yNumPosition; // " "
var mc1:MovieClip=_root.dNumHolder_mc.attachMovie("txtNum","textBtn"+_root.dNumHolder_mc.getNextHighestDepth(),_root. dNumHolder_mc.getNextHighestDepth());
mc1._x = xNumPosition;
mc1._y = yNumPosition;
mc1.theNum.text = BtnNumz; // assuming this is initialized
xNumPosition = xNumPosition + 24.1;
BtnNumz = (BtnNumz + 1);
}
-
2. Re: attachMovie & depths
Ron Colmen Jul 5, 2013 12:33 PM (in response to kglad)Thanks Kglad.
I tried your code and it does the same.
Does var mc:MovieClip need to be a new name eachtime btnsRceLoad is called? But how?
-
3. Re: attachMovie & depths
kglad Jul 5, 2013 12:52 PM (in response to Ron Colmen)yes.
what do you see that makes you think the code is not working?
-
4. Re: attachMovie & depths
Ron Colmen Jul 5, 2013 3:29 PM (in response to kglad)I did the below. But no luck.
var sparkle:Array = [];
var n:Number = 16;
for (var j:Number = 0; j < n; j++) {
var mc:MovieClip = MovieClip(getChildByName("s"+j) );
sparkle[j] = mc;
}
btnsRceLoad.onData = function(src) {
_root.uusersNow.text = "Total PagesS: " + src;
for(var i:Number=0; i<src; i++){
sparkle[j]=_root.dNumHolder_mc.attachMovie("btnNum","numberBtn"+_root.dNumHolder_mc.getNe xtHighestDepth(),_root.dNumHolder_mc.getNextHighestDepth());
sparkle[j]._x = xNumPosition;
sparkle[j]._y = yNumPosition;
sparkle[j]=_root.dNumHolder_mc.attachMovie("txtNum","textBtn"+_root.dNumHolder_mc.getNext HighestDepth(),_root.dNumHolder_mc.getNextHighestDepth());
sparkle[j]._x = xNumPosition;
sparkle[j]._y = yNumPosition;
sparkle[j].theNum.text = BtnNumz;
xNumPosition = xNumPosition + 24.1;
BtnNumz = (BtnNumz + 1);
-
5. Re: attachMovie & depths
kglad Jul 5, 2013 3:46 PM (in response to Ron Colmen)that code makes no sense. it looks like some as2 and some as3 and none of the as3 would do anything useful.
copy and paste the trace output from the following:
for(var src:Number=5;src<11;src+=5){
testF(src)
}
function testF(src) {
_root.uusersNow.text = "Total Pages: " + src;
for(var i:Number=0; i<src; i++){
var mc:MovieClip=_root.dNumHolder_mc.attachMovie("btnNum","numberBtn"+_root.dNumHolder_mc.getNextHighestDepth(),_roo t.dNumHolder_mc.getNextHighestDepth());
mc._x = xNumPosition; // assuming this is initialized
mc._y = yNumPosition; // " "
trace(src+": "+mc+"_x: "+mc._x+" depth: "+mc.getDepth());
var mc1:MovieClip=_root.dNumHolder_mc.attachMovie("txtNum","textBtn"+_root.dNumHolder_mc.getNextHighestDepth(),_root. dNumHolder_mc.getNextHighestDepth());
mc1._x = xNumPosition;
mc1._y = yNumPosition;
mc1.theNum.text = BtnNumz; // assuming this is initialized
xNumPosition = xNumPosition + 24.1;
BtnNumz = (BtnNumz + 1);
}
-
6. Re: attachMovie & depths
Ron Colmen Jul 5, 2013 3:56 PM (in response to kglad)trace:
10: _level0.dNumHolder_mc.numberBtn28_x: 337.4 depth: 28
-
7. Re: attachMovie & depths
kglad Jul 5, 2013 8:08 PM (in response to Ron Colmen)you fail to see 15 lines of trace output???
-
8. Re: attachMovie & depths
Ron Colmen Jul 7, 2013 7:05 PM (in response to kglad)Sorry about that Kglad.
5: _level0.dNumHolder_mc.numberBtn0_x: 0 depth: 0
5: _level0.dNumHolder_mc.numberBtn2_x: 24.1 depth: 2
5: _level0.dNumHolder_mc.numberBtn4_x: 48.2 depth: 4
5: _level0.dNumHolder_mc.numberBtn6_x: 72.3 depth: 6
5: _level0.dNumHolder_mc.numberBtn8_x: 96.4 depth: 8
10: _level0.dNumHolder_mc.numberBtn10_x: 120.5 depth: 10
10: _level0.dNumHolder_mc.numberBtn12_x: 144.6 depth: 12
10: _level0.dNumHolder_mc.numberBtn14_x: 168.7 depth: 14
10: _level0.dNumHolder_mc.numberBtn16_x: 192.75 depth: 16
10: _level0.dNumHolder_mc.numberBtn18_x: 216.9 depth: 18
10: _level0.dNumHolder_mc.numberBtn20_x: 240.95 depth: 20
10: _level0.dNumHolder_mc.numberBtn22_x: 265.05 depth: 22
10: _level0.dNumHolder_mc.numberBtn24_x: 289.2 depth: 24
10: _level0.dNumHolder_mc.numberBtn26_x: 313.3 depth: 26
10: _level0.dNumHolder_mc.numberBtn28_x: 337.4 depth: 28
-
9. Re: attachMovie & depths
kglad Jul 7, 2013 8:44 PM (in response to Ron Colmen)and do you see 15 movieclips attached to _level0.dNumHolder_mc?
-
-
11. Re: attachMovie & depths
Ron Colmen Jul 8, 2013 12:55 AM (in response to Ron Colmen)Oops!! I know what's wrong...
I've forgotten to reset x,y to zero!!!!!
Anyway Thanks Kglad!
-



