Make sure your closing your dynamic var.

removeMovieClip(_root[thisColumn_txt); should be
removeMovieClip(_root[thisColumn_txt]);


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Allandt
Bik-Elliott (Receptacle)
Sent: Thursday, May 24, 2007 11:22 AM
To: flashcoders
Subject: [Flashcoders] removeMovieClip scoped incorrectly?

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
_______________________________________________
Flashcoders@chattyfig.figleaf.com
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



- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
This email is intended only for the person or entity to which it is addressed
and may contain information that is privileged, confidential or otherwise
protected from disclosure. Dissemination, distribution or copying of this
email or the information herein by anyone other than the intended recipient,
or an employee or agent responsible for delivering the message to the intended
recipient, is prohibited. If you have received this email in error, please
immediately notify us by calling our Help Desk at (415) 581-5552 or
by e-mailing us at [EMAIL PROTECTED]

_______________________________________________
Flashcoders@chattyfig.figleaf.com
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

Reply via email to