6 Replies Latest reply on Apr 13, 2011 10:50 PM by aligned2009

    Mouse Over not consistent with MXMLG object

    aligned2009 Level 1

      I'm sometimes seeing an inconsistency with drawings and mouse over events - here's a basic example.

       

      Here I have an example I drew in Illustrator - four boxes, north, south, east and west. I've added mouseOver, mouseClick to each Group object for each box. Two of them work, two of them do not. I can't figure out why the two work, and the two others don't. Also, when I click on West, East fires off, so it leads me to believe there is a race condition. Am I not interpreting mouse events on Groups correctly?

       

      <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"

      xmlns:s="library://ns.adobe.com/flex/spark"

      xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300">

         <fx:Script>

         <![CDATA[

       

         private var over:uint=uint("0x000000")

         private var notset:uint=uint("0xf66fff")

         private var set:uint=uint("0x66CCCC")

       

         private function init():void{

        

         }

       

         public function mouseOverColor(o:Object):void{

         if (o.color != set)

         o.color=over;

         }

         public function mouseOutColor(o:Object):void{

         if (o.color != set)

         o.color=notset;

         }

         public function mouseDownColor(o:Object):void{

         if (o.color != set)

         o.color=set

         else

         o.color=notset

         }

         ]]>

         </fx:Script>

      <s:Graphic version="2.0" viewHeight="792" viewWidth="612" ai:appVersion="15.0.0.399" ATE:version="1.0.0" flm:version="1.0.0" d:id="1" d:using="" xmlns="library://ns.adobe.com/flex/spark" xmlns:ATE="http://ns.adobe.com/ate/2009" xmlns:ai="http://ns.adobe.com/ai/2009" xmlns:d="library://ns.adobe.com/flex/spark/dt" xmlns:flm="http://ns.adobe.com/flame/2008">

       

        <s:Group ai:artboardActive="1" ai:artboardIndex="0" ai:seqID="1" d:layerType="page" d:pageHeight="792" d:pageWidth="612" d:type="layer" d:userLabel="Artboard 1">

          <s:Group ai:objID="2a8cf7e0" ai:seqID="2" d:id="2" d:type="layer" d:userLabel="WEST"

      mouseOver="{ mouseOverColor(WEST) }"

      mouseOut= "{ mouseOutColor(WEST) }"

      mouseDown= "{ mouseDownColor(WEST) }"

      >

            <s:Rect x="72" y="153" width="72" height="270" ai:objID="2fe4eed0" ai:seqID="3">

              <fill>

                <SolidColor id="WEST" color="#FFFFFF"/>

              </fill>

              <stroke>

                <SolidColorStroke weight="1" caps="none" joints="miter" miterLimit="10"/>

              </stroke>

            </s:Rect>

            <s:RichText x="90" y="279" columnCount="1" tabStops="S36" fontFamily="Myriad Pro" kerning="on" whiteSpaceCollapse="preserve" ai:aa="2" ai:objID="2fe18480" ai:seqID="4" flm:variant="1" d:id="3" d:userLabel="WESTText">

              <content><p fontFamily="Myriad Pro"><span fontFamily="Myriad Pro">WEST</span></p></content>

            </s:RichText>

          </s:Group>

          <s:Group ai:objID="2b3f8f90" ai:seqID="5" d:id="4" d:type="layer" d:userLabel="NORTH"

      mouseOver="{ mouseOverColor(NORTH) }"

      mouseOut= "{ mouseOutColor(NORTH) }"

      mouseDown= "{ mouseDownColor(NORTH) }"

      >

            <s:Rect x="153" y="72" width="342" height="72" ai:objID="2f7e6760" ai:seqID="6">

              <fill>

                <SolidColor id="NORTH" color="#FFFFFF"/>

              </fill>

              <stroke>

                <SolidColorStroke weight="1" caps="none" joints="miter" miterLimit="10"/>

              </stroke>

            </s:Rect>

            <s:RichText x="297" y="99" columnCount="1" tabStops="S36" fontFamily="Myriad Pro" kerning="on" whiteSpaceCollapse="preserve" ai:aa="2" ai:objID="2a25ac50" ai:seqID="7" flm:variant="2" d:id="5" d:userLabel="NORTHText">

              <content><p fontFamily="Myriad Pro"><span fontFamily="Myriad Pro">NORTH</span></p></content>

            </s:RichText>

          </s:Group>

          <s:Group ai:objID="2b3d5340" ai:seqID="8" d:id="6" d:type="layer" d:userLabel="SOUTH"

      mouseOver="{ mouseOverColor(SOUTH) }"

      mouseOut= "{ mouseOutColor(SOUTH) }"

      mouseDown= "{ mouseDownColor(SOUTH) }"

      >

            <s:Rect x="153" y="432" width="342" height="72" ai:objID="2f945fb0" ai:seqID="9">

              <fill>

                <SolidColor id="SOUTH" color="#FFFFFF"/>

              </fill>

              <stroke>

                <SolidColorStroke weight="1" caps="none" joints="miter" miterLimit="10"/>

              </stroke>

            </s:Rect>

            <s:RichText x="297" y="459" columnCount="1" tabStops="S36" fontFamily="Myriad Pro" kerning="on" whiteSpaceCollapse="preserve" ai:aa="2" ai:objID="2ef629e0" ai:seqID="10" flm:variant="3" d:id="7" d:userLabel="SOUTHText">

              <content><p fontFamily="Myriad Pro"><span fontFamily="Myriad Pro">SOUTH</span></p></content>

            </s:RichText>

          </s:Group>

          <s:Group ai:objID="2c5a2a70" ai:seqID="11" d:id="8" d:type="layer" d:userLabel="EAST"

      mouseOver="{ mouseOverColor(EAST) }"

      mouseOut= "{ mouseOutColor(EAST) }"

      mouseDown= "{ mouseDownColor(EAST) }"

      >

            <s:Rect x="504" y="153" width="72" height="270" ai:objID="2c54dad0" ai:seqID="12">

              <fill>

                <SolidColor id="EAST" color="#FFFFFF"/>

              </fill>

              <stroke>

                <SolidColorStroke weight="1" caps="none" joints="miter" miterLimit="10"/>

              </stroke>

            </s:Rect>

            <s:RichText x="522" y="279" columnCount="1" tabStops="S36" fontFamily="Myriad Pro" kerning="on" whiteSpaceCollapse="preserve" ai:aa="2" ai:objID="2fe1d850" ai:seqID="13" flm:variant="4" d:id="9" d:userLabel="EASTText">

              <content><p fontFamily="Myriad Pro"><span fontFamily="Myriad Pro">EAST</span></p></content>

            </s:RichText>

          </s:Group>

        </s:Group>

        </s:Graphic>   

        </s:Group>