Lista desplegable

Holla Bell:
Es mi primera pregunta que realizo.
Necesito hacer en Director 8.5 una lista despleglable en la que cada item dirija a un score determinado dentro de la misma película. Y no tengo ni la más remota idea de como hacerlo. ¿Podrías indicarme como?

1 Respuesta

Respuesta
1
Este es un ejmplo completo para que uses con un campo de texto con el siguiente formato:
Campo
Linea 1
Linea 2
Linea 3
property pMember -- the field used in the popup
property pText -- the complete text of the popup
property pSelection -- the selected text
property pPressed -- whether the user is making a selection
property pLastHilite -- the last line hilited
on beginSprite me
-- get some properties
pMember = sprite(me.spriteNum).member.name
pText = member(pMember).text
pSelected = pText.line[1] -- assume first line is default
pPressed = FALSE
-- set the field to the selected item
member(pMember).text = pSelected
-- set the field rectangle
setMemberRect(me)
-- remove any hilite
hilite member(pMember).char[the maxInteger]
end
on mouseDown me
pPressed = TRUE
openPopup(me)
end
on openPopup me
member(pMember).text = pText
setMemberRect(me)
pLastHilite = 0
end
-- This handler will adjust the field to be the size
-- of the text contained in it
on setMemberRect me
memRect = member(pMember).rect
numLines = member(pMember).text.lines.count
if member(pMember).text.line[numLines] = "" then numLines = numLines - 1
memRect.bottom = memRect.top + (numLines * member(pMember).lineHeight)
member(pMember).rect = memRect
end
on exitFrame me
if pPressed then
-- What line is the cursor over
thisLine = the mouseLine
-- is it over a different line than before?
if (thisLine <> pLastHilite) and (thisLine > 0) then
selectLine(me,thisLine)
pLastHilite = thisLine
pSelection = pText.line[thisline]
end if
end if
end
on mouseUp me
pPressed = FALSE
ClosePopup(me)
MakeSelection(me)
end
On mouseUpOutside me
MouseUp(me)
end
-- Set the popup to the current selection
on closePopup me
member(pMember).text = pSelection
setMemberRect(me)
end
on selectLine me, clickedLine
--figure out the first and last chars for hilite
if clickedLine = 1 then
-- first line, start with char 1
startChar = 1
else
-- not first line, count chars before line
-- and add 2 to go past return to the next line
startChar = (member(pMember).text.line[1..clickedLine-1]).length + 2
end if
-- for last char, count chars including line,
-- and then add 1 for the RETURN character
endChar = (member(pMember).text.line[1..clickedLine]).length + 1
hilite member(pMember).char[startChar..endChar]
end
on makeSelection me
if pLastHilite > 0 then
updateStage -- update stage before alert
alert "You picked number"&&(pLastHilite-1)
end if
end
on endSprite me
-- restore the contents of the field
member(pMember).text = pText
end

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas