Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > Simple Stuff (Newbies)

Reply
 
Thread Tools Rate Thread Display Modes
Old 01-26-2009, 11:45 PM   #1
GooMoo
Registered User
 
Join Date: Nov 2003
Location: Seattle
Posts: 18
Send a message via AIM to GooMoo
Red face removeMovieClip not working (including swapdepths!)

Forgive me I'm tired and embaressed that I can't figure this out...

So the first time this code is executed (ie the Next button is pressed), it works just fine. The second time this function is executed though, the question_mc does not get removed.

Code:
function nextQuestion(){
	delete visQuestion;
	_level0.question_mc.swapDepths(999);
	_level0.question_mc.removeMovieClip();
	if(_level0.question_mc){
		trace('still here');
		for(a in _level0.question_mc){
			trace("question number:"+currentQuestion+" value:"+_level0.question_mc[a]+" type of:"+typeof _level0.question_mc[a]+" with name:"+_level0.question_mc[a]._name);
		}
		trace('end objects');
	} else {
		trace('removed');
	}...
visQuestion is the object created by a class that creates the question_mc on the stage. So the first time around the trace is just "removed". The second time around the trace returns:

Quote:
still here
question number:1 value:8429 type of:number with name:undefined
question number:1 value:_level0.question_mc.next_mc type of:movieclip with name:next_mc
question number:1 value:_level0.question_mc.option_mc0 type of:movieclip with nameption_mc0
question number:1 value:_level0.question_mc.option_mc1 type of:movieclip with nameption_mc1
question number:1 value:_level0.question_mc.option_mc2 type of:movieclip with nameption_mc2
question number:1 value:_level0.question_mc.option_mc3 type of:movieclip with nameption_mc3
end objects
The option_mc# clips are from the previous question_mc that should have been removed. The number returned, without a name, I have no idea where it's coming from. The question_mc is being created on the stage by a class, like this:

Code:
class QuestionLayout{

public function QuestionLayout(myQuestion,currentQuestion){
	var question_mc:MovieClip = _level0.createEmptyMovieClip("question_mc", _level0.getNextHighestDepth());
I'm hoping maybe someone has an idea what might typically cause something like this to happen? I'd give you the whole code, but I wouldn't expect anyone to surf through 600 lines.

Last edited by GooMoo; 01-27-2009 at 01:57 AM.
GooMoo is offline   Reply With Quote
Old 01-27-2009, 03:18 AM   #2
GooMoo
Registered User
 
Join Date: Nov 2003
Location: Seattle
Posts: 18
Send a message via AIM to GooMoo
Default

Perhaps this doesn't belong in the newbie section after all. I've altered my class and next button function so that the name of the question_mc is dynamically generated.

Code:
function nextQuestion(){
	delete visQuestion;
	oldQuestion = eval('question_mc'+currentQuestion);
	oldQuestion.swapDepths(999);
	oldQuestion.removeMovieClip();
	trace(oldQuestion);
	if(oldQuestion){
		trace('still here');
		for(a in oldQuestion){
			trace("question number:"+currentQuestion+" value:"+oldQuestion[a]+" type of:"+typeof oldQuestion[a]+" with name:"+oldQuestion[a]._name);
		}
		trace('end objects');
	} else {
		trace('removed');
	}...
I understand that "oldQuestion" is a variable and will still exist even though the MC it represents is gone. Tracing oldQuestion the first time shows nothing, but the second time shows "_level0.question_mc1", the name of the clip that should have been removed.

At least now I am able to go onto the third question in the series, but the 4th question (which is the same type as the second) also stays behind even though the MC should have been removed. Both of these question MC's contain ComboBox ui components, is it possible that these components are stopping the containing MC from being removed?
GooMoo is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Working locally - Not working online Scenery_J Other Flash General Questions 7 04-17-2008 08:52 AM
removeMovieClip doesnt working! animx ActionScript 2.0 7 11-23-2007 12:56 PM
removeMovieClip not working tom_S ActionScript 2.0 8 11-01-2007 04:49 PM
removeMovieClip not working EtherealChaos ActionScript 2.0 3 12-09-2004 06:18 PM
removeMovieClip not working DeadCell Simple Stuff (Newbies) 2 05-24-2002 11:22 AM


All times are GMT. The time now is 06:46 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.