Skip to main content
Inspiring
January 6, 2008
Answered

contains() error

  • January 6, 2008
  • 5 replies
  • 459 views
well, I'm putting this code, but show this error: stage.addEventListener(MouseEvent.MOUSE_UP, clickStage); how can I solve? is it possible?
This topic has been closed for replies.
Correct answer kglad
cast your stage (event.target) as a DisplayObject().

5 replies

kglad
Community Expert
Community Expert
January 6, 2008
you're welcome.
Inspiring
January 6, 2008
guy thanks a lot!!!

I solved the problem....
see:

stage.addEventListener(MouseEvent.MOUSE_UP, clickStage);
function clickStage(event:MouseEvent):void
{
var mc:MovieClip = mc_menu;
if(mc.contains(event.target as DisplayObject))
{
trace("in");
}
else
{
trace("out");
}
}

(Y) obrigado (thanks in Portuguese)
Inspiring
January 6, 2008
sorry ;x
I'm from Brazil...

has a way to solve?
because, i didn't understand very well your answer, sorry again.
kglad
Community Expert
Community Expert
January 6, 2008
i don't understand your last message.
kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
January 6, 2008
cast your stage (event.target) as a DisplayObject().
Inspiring
January 6, 2008
is it possible to make a "if" to see? how?