08-03-2004, 04:00 PM
|
#1
|
|
Registered User
Join Date: Jul 2004
Posts: 4
|
removeMovieClip() not work for components?
I'm building a quiz template for a client that users xml to load in quiz data and build a quiz type based off of the xml data. I have several different quiz types, multiple choice (radiobutton component), check all that apply (checkbox component), dropdown matching (combobox component), and many more types...
The problem that I'm having is....
I'm attaching the components by using attachMovie(), then after the users finishes that quiz, they hit the next button to load in the next quiz type. So then it uses removeMovieClip() to remove all the quiz items, then loads in the next quiz using attachMovie(). When I do this, the components start to not working right. The only thing I can think of why its not working, could be because removeMovieClip does not work on components correctly. So when I load in a different component in the same spot and instance name as a the components that were in the previous quiz type, it stops working correctly...
Any ideas on if there is a different way to handle attaching and removing components like this?
(I'd attach code, but its 700 lines long for all the different quiz types that I'm handling)
|
|
|
08-03-2004, 05:22 PM
|
#2
|
|
I make out with chicks
Join Date: Oct 2002
Location: NYC
Posts: 1,586
|
Consider using:
componentInstance.createClassObject(className, instanceName, depth, initObject)
and:
componentInstance.destroyObject(instanceName)
|
|
|
08-03-2004, 09:55 PM
|
#3
|
|
Registered User
Join Date: Jul 2004
Posts: 4
|
Yup that worked, thanks a ton...
|
|
|
05-30-2006, 06:46 PM
|
#4
|
|
Registered User
Join Date: Oct 2005
Posts: 42
|
Quote:
|
Originally Posted by annexion
Consider using:
componentInstance.createClassObject(className, instanceName, depth, initObject)
and:
componentInstance.destroyObject(instanceName)
|
I have the same problem here..
Can you explain to me what is that componentInstance?
|
|
|
05-30-2006, 07:08 PM
|
#5
|
|
six eyes
Join Date: Jan 2003
Location: San Francisco, CA (USA)
Posts: 7,875
|
componentInstance would actually be the parent timeline that contains the component being destroyed. So, if you created a button component named "my_button" in a movie clip called "myInterface_mc", the command would be
ActionScript Code:
myInterface_mc.destroyObject("my_button");
|
|
|
05-30-2006, 07:37 PM
|
#6
|
|
Registered User
Join Date: Oct 2005
Posts: 42
|
Quote:
|
Originally Posted by senocular
componentInstance would actually be the parent timeline that contains the component being destroyed. So, if you created a button component named "my_button" in a movie clip called "myInterface_mc", the command would be
ActionScript Code:
myInterface_mc.destroyObject("my_button");
|
Thank you senocular.. but it didn't solve my problem
I want to remove a movieclip that has a radioButton component on it. But when I try it it didn't work (I think that I must destroy the RadioButton first).
But I can't destroy the RB neither using the destroyObject like you've said
Last edited by Krassimiro; 05-30-2006 at 08:01 PM.
|
|
|
05-30-2006, 08:11 PM
|
#7
|
|
Registered User
Join Date: Oct 2005
Posts: 42
|
Here is some code:
ActionScript Code:
_root.createEmptyMovieClip("exp", 10);
_root.exp.createClassObject(mx.controls.RadioButton, "rb1", exp.getNextHighestDepth(), {groupName:"ola", _x:10 , _y:50, label:"weee"});
_root.exp.destroyObject("rb1");
removeMovieClip(_root.exp);
trace(exp.rb1)
Output:
_level0.exp.rb1
|
|
|
05-30-2006, 09:48 PM
|
#8
|
|
six eyes
Join Date: Jan 2003
Location: San Francisco, CA (USA)
Posts: 7,875
|
the trace only reflects the object in memory. Look at the screen. Your radio button is not present
|
|
|
05-30-2006, 10:09 PM
|
#9
|
|
Off-Line
Join Date: Aug 2004
Location: Ibiza/Spain language :Hungarian/German/ abit English
Posts: 6,539
|
some of the components react strange in this maner (not found the time till now to debug to know more)
try :
ActionScript Code:
trace(exp.rb1.getDepth())
you will probably get some strange result 
and the component will by removed at the end of the frame (it will not exist on the next)
|
|
|
05-30-2006, 10:11 PM
|
#10
|
|
six eyes
Join Date: Jan 2003
Location: San Francisco, CA (USA)
Posts: 7,875
|
I know why; I'll take some time to explain it - just gimme a few minutes...
|
|
|
| Thread Tools |
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT. The time now is 05:12 PM.
///
|
|