removing attachedMovies
- Started
- Last post
- 10 Responses
- qruise
ok in flash i have a movie container on my stage, and in actionscript i use attachMovie to load in a number of things inside it.
but how can i remove them all? is there a way to delete all MC's loaded inside one main MC, as opposed to having to loop through and specifically target every single attached MC by its id?
- PonyBoy0
dynamically create a primary movieClip on the main timeline...
... then dynamically attach all that other stuff inside it...
... when it's time... remove the dynamically created instance from the root timeline...
yes... no?
- lvl_130
couldn't you just delete the entire container mc?
then if you need it again
just create an empty mc?
- lvl_130
yeah what pony said, and i said mere seconds later :)
- qruise0
u mean make my "container" dynamic, and simply delete that each time? i cant really do that because the container has a bunch of other static elements in it..graphics ands hit... cant have it disappearing and reappearing..
- PonyBoy0
that's what I'm sayin' lvl...
... in order to delete an instance for the stage... I'm pretty sure the instance must've been placed on the stage dynamically...
... that's why I say use createEmptyMovieclip... so you can pack whatever you want into it... then... just delete 'it' later.
- lvl_130
can you have your main mc container(with all elements) off stage and simply duplicate that? that way you can always call back your re-duplicate your original.
it makes sense in my head...but that doesn't mean much until it's on screen.
- PonyBoy0
qruise...
... if you have static stuff you don't want to move...
... make two clips... one that holds the static stuff... and one that holds the dynamically attached stuff...
... then delete the latter when necessary - w/out touching the static stuff. Else - yeah... you'll have to remove each clip dynamically (which isn't a big deal unless you're talking... 20 objects or so... then yeah... annoying... but you could pack all of them into a function and just call that function each time you want to kill the dynamic content).
- qruise0
actually i figured out a solution. here's the code if ur interested.
for (var property in theClip) {
if (typeof theClip[property] == "movieclip") {
theClip.removeMovieClip(property...
}
}
- PonyBoy0
can you have your main mc container(with all elements) off stage and simply duplicate that? that way you can always call back your re-duplicate your original.
it makes sense in my head...but that doesn't mean much until it's on screen.
lvl_13
(Mar 7 07, 15:08)
---
surely... depending on how complex the stuff thats in there is... i'm not sure I'd want it's as running if it's not visible (using _visible will kill it's complete 'drawn' presence, but it's .as will still be there and running)...... so... I think in this case you would want to possible link a 'container' movieclip dynamically from your library... and then use 'attachMovie...'...
...that way there's no extra .as in the background that could be possibly using resources...
- PonyBoy0
for (var property in theClip) {
if (typeof theClip[property] == "movieclip") {
theClip.removeMovieC lip(property);
}
}qruise
(Mar 7 07, 15:14)
---
that kills anything thats a Movieclip symbol though... right?