Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > Extensions and Plugins > Components

Reply
 
Thread Tools Rating: Thread Rating: 5 votes, 5.00 average. Display Modes
Old 08-03-2004, 04:00 PM   #1
djandrew
Registered User
 
Join Date: Jul 2004
Posts: 4
Angry 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)
djandrew is offline   Reply With Quote
Old 08-03-2004, 05:22 PM   #2
annexion
I make out with chicks
 
Join Date: Oct 2002
Location: NYC
Posts: 1,586
Default

Consider using:

componentInstance.createClassObject(className, instanceName, depth, initObject)

and:

componentInstance.destroyObject(instanceName)
__________________
www.perpetuated.com
annexion is offline   Reply With Quote
Old 08-03-2004, 09:55 PM   #3
djandrew
Registered User
 
Join Date: Jul 2004
Posts: 4
Default

Yup that worked, thanks a ton...
djandrew is offline   Reply With Quote
Old 05-30-2006, 06:46 PM   #4
Krassimiro
Registered User
 
Join Date: Oct 2005
Posts: 42
Default

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?
Krassimiro is offline   Reply With Quote
Old 05-30-2006, 07:08 PM   #5
senocular
six eyes
 
senocular's Avatar
 
Join Date: Jan 2003
Location: San Francisco, CA (USA)
Posts: 7,875
Send a message via ICQ to senocular Send a message via AIM to senocular Send a message via MSN to senocular Send a message via Yahoo to senocular
Default

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");
__________________
(6)
senocular is offline   Reply With Quote
Old 05-30-2006, 07:37 PM   #6
Krassimiro
Registered User
 
Join Date: Oct 2005
Posts: 42
Default

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.
Krassimiro is offline   Reply With Quote
Old 05-30-2006, 08:11 PM   #7
Krassimiro
Registered User
 
Join Date: Oct 2005
Posts: 42
Default

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
Krassimiro is offline   Reply With Quote
Old 05-30-2006, 09:48 PM   #8
senocular
six eyes
 
senocular's Avatar
 
Join Date: Jan 2003
Location: San Francisco, CA (USA)
Posts: 7,875
Send a message via ICQ to senocular Send a message via AIM to senocular Send a message via MSN to senocular Send a message via Yahoo to senocular
Default

the trace only reflects the object in memory. Look at the screen. Your radio button is not present
__________________
(6)
senocular is offline   Reply With Quote
Old 05-30-2006, 10:09 PM   #9
Xeef
Off-Line
 
Xeef's Avatar
 
Join Date: Aug 2004
Location: Ibiza/Spain language :Hungarian/German/ abit English
Posts: 6,539
Default

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)
__________________

test your self -->http://www.actionscript.org/forums/s...86&postcount=8
Xeef is offline   Reply With Quote
Old 05-30-2006, 10:11 PM   #10
senocular
six eyes
 
senocular's Avatar
 
Join Date: Jan 2003
Location: San Francisco, CA (USA)
Posts: 7,875
Send a message via ICQ to senocular Send a message via AIM to senocular Send a message via MSN to senocular Send a message via Yahoo to senocular
Default

I know why; I'll take some time to explain it - just gimme a few minutes...
__________________
(6)
senocular 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


All times are GMT. The time now is 07:06 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.