Note that there are some explanatory texts on larger screens.

plurals
  1. POFlex: Dynamically drawn group, with mouse events
    primarykey
    data
    text
    <p>I have a Group on my View and i'm trying to fill it with some collor and add a mouse event, all dynamicaly. the problem is, when i add the mouse event, the group simply turns invisible again. It still exists on the view and responds normally to mouse events, but i can't see it</p> <p>here's a code example:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;s:View xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" title="HomeView" creationComplete="onCreationComplete()" &gt; &lt;fx:Declarations&gt; &lt;!-- Place non-visual elements (e.g., services, value objects) here --&gt; &lt;/fx:Declarations&gt; &lt;fx:Script&gt; &lt;![CDATA[ public function onCreationComplete():void { testeGroup.graphics.beginFill(0xff0000); testeGroup.graphics.drawRect(0, 0, testeGroup.width, testeGroup.height); testeGroup.graphics.endFill(); testeGroup.addEventListener(MouseEvent.CLICK, function ():void{ trace("test"); }); } ]]&gt; &lt;/fx:Script&gt; &lt;s:Group id="testeGroup" verticalCenter="0" horizontalCenter="0" width="100" height="100" &gt; &lt;/s:Group&gt; &lt;/s:View&gt; </code></pre> <p>without the mouse event the group is visible, but it vanishes when i try to add it. i've tried with other events, like the ENTER_FRAME Event and it works normaly, but all the mouse events that i tried turn the Group invisible.</p> <p>i've actually solved my problem using the opaqueBackground property, the Group don't vanish when i add the event this whay. But now i'm curious about the reason of this behavior.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload