just corrected a typo in the removeMovieClip statement but the
problem still stands
hi folks
i'm trying to get a function to remove a movieclip (actually a
textArea class object) but i've having a bit of trouble - i think it
may be a scope issue but i can't see why
the function is
function changeLayout(layout:Number, textContent:String,
image:String, textContent2:String):Void {
//don't remove other columns if 3 is passed to layout
if (layout != 3) {
//otherwise get variables
var layout:Number = layout;
var textContent:String = textContent;
var image:String = image;
var textContent2:String = textContent2;
//reset layout
for (var i:Number = 0; i < 3; i++) {
//use i to make column name
var this_i = i+1;
var thisColumn_mc:String = "column"+this_i+"_mc";
var thisColumn_txt:String = "column"+this_i+"_txt";
//these work with no problems
_root[thisColumn_txt]._visible = false;
_root[thisColumn_txt].text = "";
//however this doesn't seem to be working
removeMovieClip(_root[thisColumn_txt]);
//trace reveals that the thisColumn_txt in the loop, once used, does
not disappear after the removeMovieClip --> thisColumn_txt:
[object Object]
trace("thisColumn_txt "+thisColumn_txt+": "+_root
[thisColumn_txt].toString());
//the rest works perfectly
var currentWidth = _root[thisColumn_mc]._width;
var thisTween:Object = new Tween(_root[thisColumn_mc], "_width",
Strong.easeOut, currentWidth, 0, 1, true);
thisTween.onMotionFinished = function() {
if (i == 3) {
if (layout == 1) {
setupColumn(150, 1, 425,
textContent, image);
} else if (layout == 2) {
setupColumn(150, 1, 200,
textContent, image);
setupColumn(350, 2, 225,
textContent2);
}
}
};
}
} else {
setupColumn(575, 3, 180, textContent);
}
}
what's really strange is that other items using the same path to the
textArea, _root[thisColumn_txt], work flawlessly but removeMovieClip
does not.
I've tried removeMovieClip with textArea class objects in a previous
draft with no problems (although it didn't have the dynamically
generated name)
can anyone make sense of this?
thankyou
obie
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com