2011-10-17 37 views
1

我正在使用Flex 4/fxg創建示例地圖應用程序?現在我已將FXG路徑保存在帶有id的組元素中(我已將路徑的ID分配給相應的組容器)?但是當我點擊地圖中的任何地方時,我沒有在事件處理程序中將點擊的組作爲target/currentTarget。 如何確定哪個元素被點擊?如何確定在FXG文件中點擊了哪個路徑元素

代碼示例:

<Graphic xmlns:fx="http://ns.adobe.com/mxml/2009" 
     xmlns="library://ns.adobe.com/flex/spark" 
     xmlns:mx="library://ns.adobe.com/flex/mx" 
     xmlns:view="view.*" 
     version="2.0" viewWidth="1425" viewHeight="1140"> 
---- 
---- 

      <view:GraphicItem id="CityofLondon"> 
       <Path data="path data" winding="evenOdd"> 
        <fill> 
         <SolidColor color="#FEFEE9" alpha="1"/> 
        </fill> 
        <stroke> 
         <SolidColorStroke color="#646464" alpha="1" weight="2" miterLimit="10" joints="round" caps="round"/> 
        </stroke> 
       </Path> 
      </view:GraphicItem> 
      <view:GraphicItem id="BarkingandDagenham"> 
       <Path data="path data" winding="evenOdd"> 
        <fill> 
         <SolidColor color="#FEFEE9" alpha="1"/> 
        </fill> 
        <stroke> 
         <SolidColorStroke color="#646464" alpha="1" weight="2" miterLimit="10" joints="round" caps="round"/> 
        </stroke> 
       </Path> 
      </view:GraphicItem> 
---- 
------ 
</Graphic> 

GraphicItem是組容器。

任何幫助將不勝感激。謝謝。

+0

還在等待回覆..有人嗎? –

+0

你有沒有得到這個答案? – Ryan

+0

嘿,我自己正在開發一個地圖應用程序,但最終使用了http://www.ammap.com/。你可能會問什麼樣的事情......對這類事情非常感興趣 – Ryan

回答

0

我問過類似的問題,它是在這裏找到答案:

Flex Path - capturing Click event

只好設置mouseEnabledWhereTransparent =「假」爲一組,而FXG路徑添加到該組。

相關問題