9/7/2010 7:22:04 AM
Title:
Questions in Flex 4
Hi all..
I have 2 queries to ask for. (i work in flash builder 4)
1)I have a link button. On mouse over, i open a Menu using Menu.createMenu and i give data provider for it. The user might choose an option by clicking on the menuitem. i want to close the menu on mouseout of link button
The mouseout of linkbutton will also b fired if i mouseOver on the menuitem. so the menu gets closed. All i want is how to close the menu when the user mouse overs on anything other than menuitems..
reference: i want to do something like in this webpage. http://in.yahoo.com where the left side navigators open menuitem on mouse over of link
2)I have a list of thumbnails of images with pagination(supported by server). when i click on "nextpage" i get the data from server. How should i apply a simultaneous transition effect of the first page image moving out of the list and second page data comes into the list.
Thanks
Venkatesan M
9/7/2010 9:03:27 AM
regarding you first question , on mouse out listener of link button you can check the event.target.name. First trace the name of menu bu moving the mouse from button to menu. Now use that button in the check
if(event.target.name == "menu123"){
//nothing
}else
{
//hide menu
}
9/7/2010 11:30:05 PM
Hi bob.. i tried the way u said. but it doesn't seem to work.
here is the code
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.controls.Menu;
private var arr:ArrayCollection= new ArrayCollection(new Array('link1','link2','link3','link4'));
var menu:Menu;
protected function link_mouseOverHandler(event:MouseEvent):void
{
if(menu)
menu.hide();
menu=Menu.createMenu(this,arr,false);
menu.name='menu';
menu.id='menu';
menu.x=event.stageX;
menu.y=event.stageY;
menu.show();
}//
protected function link_mouseOutHandler(event:MouseEvent):void
{
if(event.currentTarget.id!='menu')
menu.hide();
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<mx:LinkButton x="103" y="83" label="Mouse over" id="link" mouseOver="link_mouseOverHandler(event)" mouseOut="link_mouseOutHandler(event)"/>
</s:Application>
am i missing something?? if so plz provide the solution