Skip to main content
Inspiring
February 21, 2014
Answered

Cp6 + AS3 swf : "target == stage" not working

  • February 21, 2014
  • 1 reply
  • 549 views

Hello,

I've done a SWF where I want to reset stage when clicking outside objects.

The SWF alone works perfectly but does not inside Captivate.

I did a simplified version :

mc.visible = false;

 

stage.addEventListener(MouseEvent.CLICK, clickOutside, false, 0, true);

 

function clickOutside(e:MouseEvent):void

{

          if (e.target == stage)

          {

                    mc.visible = true;

          }

}

The line :   if (e.target == stage)

does not work anymore.

Does importing SWF in Cp adds another level (stage is Cp scene, the SWF parent) ?

Thanks.

This topic has been closed for replies.
Correct answer TLCMediaDesign

The captivate slide is the object capturing the event. Why don't you use an invisible button or transparent movieclip to capture the event? Then check if e.target.name == instance name.

1 reply

TLCMediaDesign
TLCMediaDesignCorrect answer
Inspiring
February 21, 2014

The captivate slide is the object capturing the event. Why don't you use an invisible button or transparent movieclip to capture the event? Then check if e.target.name == instance name.

pjgfiAuthor
Inspiring
February 24, 2014

Thanks for your tip, it works !

It's weird I read nowhere that Captivate slide became stage when importing...