Groups | Blog | Home
all groups > flash actionscript > october 2006 >

flash actionscript : getNextHighestDepth and removeMovieClip problem


Palin Exnihilo
10/12/2006 6:29:09 PM
Seems like getNextHighestDepth() gives to you movieClip an depth that cause
your movieclip being unable to get deleted by Actionscript. You should always
set your movieClip with custom depth before deleting them...

Look for help on removeMovieClip() in the AS docs or on MovieClip's depths

Palin
coldMiner
10/12/2006 6:54:21 PM
try mc.removeMovieClip();

[q][i]Originally posted by: [b][b]Palin Exnihilo[/b][/b][/i]
You should always set your movieClip with custom depth before deleting
them...[/q]
??? What is custom depth
explain this then:

var mc:MovieClip = _root.createEmptyMovieClip
("mc1",_root.getNextHighestDepth() );
mc.beginFill(0x000000,100);
mc.lineTo(100,0);
mc.lineTo(100,100);
mc.lineTo(0,100);
mc.lineTo(0,0);
mc.endFill();
var removeInterval = setInterval(mc, "removeMovieClip",500);
S4Potential
10/12/2006 7:01:42 PM
coldMiner is right, removeMovieClip() doesn't take parameters.

Try with the full path if used within another movieclip:
Burak Delice
10/12/2006 8:08:38 PM
hi,

I have a strange problem :

I attach a Mc from library to Scene like this :

var mc : MovieClip = _root.attachMovie ("mcLinkage",
"mc1",_root.getNextHighestDepth() ,
{
_visible : false
});

and then i try to remove it by

removeMovieClip(_root.mc1);

and, mc is doesnt removed.

but if i give a level number instead of getNextHighestDepth(), mc is able to
removed.

any succestion about this stuation?

regards.
Burak

Burak Delice
10/13/2006 12:00:00 AM
thankyou for reponses,
I had tried to use mc.removeMovieClip(). but this not worked.
strange problem. and yes, if I give a spesific number for depth, removeClip
can remove mc. but, i have to use getNextHighestDepth();

regards
Burak
www.delizade.com

[quoted text, click to view]

Manno Bult
10/13/2006 12:00:00 AM
The function (in contrast to the method) removeMovieClip(target:Object)
still should work (not even deprecated yet :). It's in the Global
Functions section.
However, from the helpfiles removeMovieClip() topic:
-----------------------------------------------------
Note: If you are using version 2 components, do not use this method. If
you place a version 2 component either on the Stage or in the Library,
the getNextHighestDepth() method can sometimes return depth 1048676,
which is outside the valid range. If you are using version 2 components,
you should always use the version 2 components DepthManager class.

Note: If you are using version 2 components, and use
MovieClip.getNextHighestDepth() instead of the version 2 components
DepthManager class to assign depth values, you may find that
removeMovieClip() fails silently. When any version 2 component is used,
the DepthManager class automatically reserves the highest (1048575) and
lowest (-16383) available depths for cursors and tooltips. A subsequent
call to getNextHighestDepth() returns 1048576, which is outside the
valid range. The removeMovieClip() method fails silently if it
encounters a depth value outside the valid range. If you must use
getNextHighestDepth() with version 2 components, you can use
swapDepths() to assign a valid depth value or use
MovieClip.unloadMovie() to remove the contents of the movie clip.
Alternatively, you can use the DepthManager class to assign depth values
within the valid range.
------------------------------------------------------

It made me bang my head against anything hard for a while not too long
ago...

Look for the DepthManager Class in the components dept. of the helpfiles.

Manno

[quoted text, click to view]

--
----------
Manno Bult
Burak Delice
10/16/2006 2:02:15 PM
thankyou very much...

strange stuation. and sometimes I think that Flash takes times from my
lifetime! :)

regards


[quoted text, click to view]

AddThis Social Bookmark Button