To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here


A Flash Developer Resource Site

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Reply
 
Thread Tools Search this Thread Display Modes
Old 12-22-2006, 07:52 AM   #1
Nosta|gia
Member
 
Join Date: Dec 2006
Posts: 45
[F8] removeMovieClip() in this script isn't working

I have absolutely no idea why the following code isn't working. I've checked the documentation for removeMovieClip at least a dozen times. The only thing I've noticed is the following:

Quote:
Method; removes a movie clip instance created with duplicateMovieClip(), MovieClip.duplicateMovieClip(), or MovieClip.attachMovie().
As you will notice, I'm using createEmptyMovieClip() - not one of the methods mentioned - but I swear I've used removeMovieClip to delete movieclips created this way before and it's worked fine. I can't find an alternative command, either.

Here is my code. When I trace white in the onRollOut function, it returns the correct path, so it's not a targetting issue. I've also tried adjusting one of the movieclip white's properties (alpha) and it's worked fine.

Code:
planet.onRollOver = function(){
	var over:MovieClip = createEmptyMovieClip("white",this.getDepth()-1);
        //other events
}

planet.onRollOut = function(){
        white.removeMovieClip(); //trace here returns proper path
}
Any ideas as to why this command isn't working would be great.
__________________
Using: Flash Professional 8 | Flash Player 8/9 | Actionscript 2 | PHP 5.1.6 | MySQL 5.0 |


Latest Helpful Links: XML Dropdown Menu - How To Use Fusekit
Nosta|gia is offline   Reply With Quote
Old 12-22-2006, 09:37 AM   #2
silentweed
Flashmatics
 
silentweed's Avatar
 
Join Date: Mar 2005
Location: London, UK
Posts: 4,813
removeMovieClip() can remove ANY movie clip as long as the depth of the movie clip is POSITIVE AND LESS THAN 1,048,575

Movieclips that are made during author time can hence be removed by first making them positive and then using the removeClipMethod()

Hence ANY movieclip mcHolder (dynamic or authortime) can be removed

mcHolder.swapDepths(_root.getNextHighestDepth()):
mcHolder.removeMovieClip();


However if you use components sometimes elements are placed at a depth greater than 1,048,575, hence it cant be removed unless you lower the depth.

So check the depth of the movieclip and if its higher than 1,048,575 first lower it to a lower depth and then try rmeoving it. so basically u can use something like:

Code:
if(mcHolder.getDepth() >= 1048575 || mcHolder.getDepth() <= 0 ){
    mcHolder.swapDepths(2000);
}
mcHolder.removeMovieClip();
__________________
Flashmatics | Flashmatics Library (free downloads)
-----------------------------------------------------
Latest Projects:
The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

-----------------------------------------------------
Flash Certified Developer
silentweed is offline   Reply With Quote
Old 12-22-2006, 09:47 AM   #3
Nosta|gia
Member
 
Join Date: Dec 2006
Posts: 45
Hey, silentweed.

Thanks for that information. May I ask where you found it? It wasn't in any of documentation I read.
__________________
Using: Flash Professional 8 | Flash Player 8/9 | Actionscript 2 | PHP 5.1.6 | MySQL 5.0 |


Latest Helpful Links: XML Dropdown Menu - How To Use Fusekit
Nosta|gia is offline   Reply With Quote
Old 11-07-2009, 12:10 PM   #4
northby9
Junior Member
 
Join Date: Nov 2001
Posts: 6
Silentweed, I know this is a couple of years after the fact - just wanted to say thanks for posting that solution; it worked like a charm and saved me a lot of grief. Thanks again!
northby9 is offline   Reply With Quote
Reply

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:04 PM.


internet.commerce
Be a Commerce Partner
 »  »  »  »  »  »  »
 »  »  »  »  »  »
 

    

Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.