|
From: Opera Rat on 17 Aug 2006 04:51 I've used Gary Rosenzweig's script from "Using Director MX" for a drop down menu. He uses the property pPressed to test if the mouse button is held down in order to open and select menu items. So it's a drag-and-let-go menu. I would like it to function like the Dropdown list behavior in the library. Only I want to use sprites and not a field. That behavior closes the pop-up window if you click on the stage outside of the pop-up. It opens the pop-up with a click and allows the user to make a choice with a click. If anyone is familiar with Gary's script how would I modify it to do these events with a mouse click instead of by the state of the mouse button (down or up)? There must be a way to determine if the mouse was clicked outside the dropdown and then close it.
From: Rob Dillon - Adobe Community Expert on 17 Aug 2006 09:05 mouseUpOutside is the function to detect a mouse release outside a sprite when the mouseDown event happened over the same sprite. It is most commonly used to return a sprite's member change back to the default member if a user drags off and releases the mouse after clicking on a sprite. -- Rob _______ Rob Dillon Adobe Community Expert http://www.ddg-designs.com 412-243-9119 http://www.macromedia.com/software/trial/
From: Opera Rat on 17 Aug 2006 16:07 Hmmm. I'm doing something wrong and I know what it is, I just don't know how to fix it. I set the pClicked state to true when the user clicks on the menu header, but if you click on a choice the pClicked is still true but I don't want it to be. I need a one click on and another click off. Or a click on this and off. Please have a look at my botch job script. Thanks --In the cast there should be a member for each menu "header" and 2 members for each --dropdown member (the member in a normal state and one in a highlighted state that --appends the name hilite it. --This script SHOULD open the menu when you click on the menu header then --allow the user to make a choice from the dropdown menu by clicking on the desired --item. The menu should disappear when the mouse leaves the dropdown menu. --Attach this behavior to the menu header --get dropdown sprites for the header property pSpriteList, pMemberList, pClicked on getPropertyDescriptionList me list = [:] addProp list, #pSpriteList, [#comment: "Sprite List",\ #format: #list, #default: []] return list end on beginSprite me pMemberList = [:] repeat with i in pSpriteList addProp pMemberList, i, sprite(i).member.name end repeat hidePopup(me) end on mouseUp me showPopup(me) end --on mouseLeave me -- hidePopup(me) --end on mouseUpOutSide me pClicked = FALSE hidePopup(me) end on showPopup me pClicked = TRUE repeat with i in pSpriteList sprite(i).member = member pMemberList.getProp(i) end repeat end on hidePopup me pClicked = FALSE repeat with i = 1 to pSpriteList.count sprite(pSpriteList[i]).memberNum = 0 end repeat end on exitFrame me if pClicked then showPopup(me) s = the rollover if (pSpriteList.getOne(s)) then sprite(s).member = member (pMemberList.getProp(s)&&"hilite") end if end if end on select me s = the rollover if (pSpriteList.getOne(s)) then alert pMemberList.getProp(s) end if end
|
Pages: 1 Prev: Simple openFile script Next: Open MIAW and hide main projector |