主题:  11组上半部,上次发的有问题。

worthy

职务:普通成员
等级:1
金币:0.0
发贴:98
#12001/2/14 12:06:41
以下翻译可能有些问题,水平有限请原谅。

on mouseEnter

语法 on mouseEnter
         语句
       end

描述    系统信息和事件程序;包含在鼠标第一次接触某个精灵的活动区域时运行的语句。 鼠标按钮不被压下。

如果那个精灵是一个应用了matte ink效果的位图演员,它的活动区域是那个图像所被显示的那一部分;否则,它的活动区域是那个精灵的矩形范围。

如果被用在一个行为上,这个事件是被传递到精灵脚本或者帧脚本涉及me。

实例    这段程序是一个简单的按钮行为,功能是在鼠标滑入和滑出这个按钮时转换按钮的位图:

property spriteNum
on mouseEnter me
    -- Determine current cast member and switch to next in cast
    currentMember = sprite(spritenum).member.number
    sprite(spritenum).member = currentMember + 1
end
on mouseLeave me
    -- Determine current cast member and switch to previous in cast
    currentMember = sprite(spritenum).member.number
    sprite(spritenum).member = currentMember - 1

end

参见    on mouseLeave, on mouseWithin
___________________________________________
mouseH

语法    the mouseH

    mouseH()

描述    系统属性和函数;显示鼠标指针的水平位置。mouseH的数值是指针位置从舞台的左边缘开始的像素数。

mouseH函数是用在移动精灵到鼠标指针的水平位置和检查指针是否在舞台区域之内。一起使用mouseH和mouseV函数,你能测定指针的准确位置。

当Lingo是在一个循环中时Java的Director播放器更新不了mouseH函数。

这个函数能被测试,但不能设置。

实例    这段程序是在使用者点击鼠标按钮时,移动第10通道上的精灵到鼠标指针位置并更新舞台:

on mouseDown
    sprite(10).locH = the mouseH
    sprite(10).locV = the mouseV
    updateStage

end

实例    这段程序测试指针是否在开始点的右边或左边10个像素之外,并且如果是的,则设置变量draggedEnough为TRUE:

if abs(mouseH() - startH) > 10 then

draggedEnough = TRUE

参见    locH, locV, mouseV, mouseLoc
_____________________________________________
mouseItem

语法    the mouseItem

描述    系统属性;包含在函数被调用并且指针是在一个域精灵之上时,指针所指的条款号。
(一个条款是特性边界的顺序由当前的边界来设置并通过itemDelimiter属性。)在域的开始计算出发点。如果鼠标不在一个域上,值为-1。

the mouseItem属性值能在一个程序或者循环中改变。
在程序或者循环开始时,如果一个程序或者循环需要mouseItem的大写值,调用属性赋值给一个局部变量。

实例    这段程序测定指针是否在一个域精灵上,
并且在这段程序为非时改变域演员“Instructions”内容为“Please point to an item.”:

  if the mouseItem = -1 then
    member("Instructions") = "Please point to an item."
  end if

实例    这段程序把指针指定的条款中的指定内容赋值给变量currentItem:

  currentItem = member(mouseMember).item(mouseItem)

实例    这段程序在鼠标按钮被按下时突出指针下的条款:

  on mouseDown
    thisField = sprite(the clickOn).member
    if the mouseItem < 1 then exit
    lastItem = 0
    repeat while the stillDown
        MI = the mouseItem
        if MI < 1 then next repeat
        if MI <> lastItem then
            thisField.item[MI].hilite()
            lastItem = MI
        end if
    end repeat
  end

参见    item...of, mouseChar, mouseLine, mouseWord, number (items), itemDelimiter
_____________________________________________
on mouseLeave

语法    on mouseLeave
     语句
    end

描述    系统信息和事件程序;包含在鼠标离开某个精灵的活动区域时运行的语句。 鼠标按钮不被压下。

如果那个精灵是一个应用了matte ink效果的位图演员,它的活动区域是那个图像所被显示的那一部分;否则,它的活动区域是那个精灵的矩形范围。

如果被用在一个行为上,这个事件是被传递到精灵脚本或者帧脚本涉及me。

实例    这段程序是一个简单的按钮行为,功能是在鼠标滑入和滑出这个按钮时转换按钮的位图:

property spriteNum
on mouseEnter me
    -- Determine current cast member and switch to next in cast
    currentMember = sprite(spritenum).member.number
    sprite(spritenum).member = currentMember + 1
end
on mouseLeave me
    -- Determine current cast member and switch to previous in cast
    currentMember = sprite(spritenum).member.number
    sprite(spritenum).member = currentMember - 1
end

参见    on mouseEnter, on mouseWithin
_____________________________________________
mouseLevel

语法    sprite(whichQuickTimeSprite).mouseLevel

    the mouseLevel of sprite whichQuickTimeSprite

描述    QuickTime精灵属性;控制传递在Director中在一个QuickTime精灵内鼠标点击的消息给QuickTime。这种能力是传递鼠标点击在精灵矩形范围内,能用于像QuickTime VR用于交互式的媒体。mouseLevel精灵属性能以下数值:

● #controller--传递点击只在QuickTime电影控制上。Director响应只给鼠标点击,发生在外界控制。这是QuickTime精灵不同于QuickTime VR的标准的行为。
● #all--传递所有在精灵矩形范围内鼠标点击的消息给QuickTime。不点击传递给其它Lingo程序。
● #none--
不传递任何鼠标点击消息给QuickTime。Director响应所有的鼠标点击消息。
● #shared--
传递所有在QuickTime VR精灵矩形范围内鼠标点击消息给QuickTime并且传递这些事件给Lingo程序。这是QuickTime VR的缺省值。

这个属性能被测试和设置。

实例    这个帧脚本检测
如果在通道5上的QuickTime精灵名字包括字符串“QTVR”。如果是,这个脚本设置mouseLevel为#all;否则,设置mouseLevel为#none。

  on prepareFrame
    if sprite(5).member.name contains "QTVR" then
        sprite(5).mouseLevel = #all
    else
        sprite(5).mouseLevel = #none
    end if
  end
____________________________________________
mouseLine

语法    the mouseLine
语法    系统属性;包含在函数被调用并且指针是在一个域精灵之上时,指针所指的行号。
在域的开始计算出发点;一个行是被定义在返回分隔符,不在域的边缘处。在鼠标不在一个域精灵上时,值为-1。

the mouseLine属性的值能在一个程序或者循环中改变。如果一个程序或者循环使用这个属性多次,把值赋给一个局部变量通常是一个好办法。

实例    这段程序确定指针是否在一个域精灵上,并在这段程序为非时改变域演员“Instructions”的内容为“Please point to a line.”:

  if the mouseLine = -1 then
   member("Instructions").text = "Please point to a line."

实例    这段程序把指针指定的域中的行内容赋值给变量currentLine:

  currentLine = member(the mouseMember).line[the mouseLine]

实例    这段程序在鼠标按钮被按下时突出指针下的行:

  on mouseDown
    thisField = sprite(the clickOn).member
    if the mouseLine < 1 then exit
    lastLine = 0
    repeat while the stillDown
        ML = the mouseLine
        if ML < 1 then next repeat
        if ML <> lastLine then
            thisField.line[ML].hilite()
            lastLine = ML
        end if
    end repeat
  end

参见    mouseChar, mouseItem, mouseWord, line...of, number (lines)
_______________________________________
mouseLoc

语法    the mouseLoc
描述    函数;
返回当然鼠标位置,是一个point()。

点位置是特定的两个坐标,先是水平位置,然后是垂直位置。

参见    mouseH, mouseV
_____________________________
mouseMember

语法    the mouseMember
描述    系统属性;当这个属性被调用时,返回分配在指针下的精灵的演员。当指针不在一个精灵上时,它返回结果是VOID。

mouseMember属性的替换是mouseCast,在初期的Director版本里的习惯。

在指针滑入一个精灵并且这个精灵使用一个确定的演员时,你能使用这个函数制造一个电影执行特殊的行为。

mouseMember属性的值能频繁地改变。
使用在一段程序这个属性有一个一致的数值,在程序开始和使用这个变量时赋mouseMember值给一个局部变量。

其他演员表和演员表1比较,mouseMember返回一个不区别演员和演员号的值。区别演员和演员号,使用表达式成员(the mouseMember);如果使用者不点击一个精灵,然而,这个表达式产生一个脚本错误。


实例    这段程序检查演员“Off Limits”是否是分配给在鼠标下的精灵的演员并如果它是则显示一个alert。这个实例显示你可以指定一个行为装置在演员分配给精灵上:

  if the mouseMember = member "Off Limits" then alert "Stay away from there!"

实例    这段程序把在鼠标下的精灵的演员赋值给变量lastMember:

lastMember = the mouseMember

参见    member (sprite property), memberNum, clickLoc, mouseChar, mouseItem, mouseLine, mouseWord, rollOver(),number (cast member property)
______________________________________________
mouseOverButton

语法    sprite whichFlashSprite.mouseOverButton

the mouseOverButton of sprite whichFlashSprite

描述    Flash精灵属性;
指明鼠标指针是否是在一个在一个Flash电影精灵上的按钮上指定whichFlashSprite参数(TRUE),
或者鼠标指针是否是在精灵范围之外或鼠标指针是否是在精灵范围之内除了在一个非按钮的目标以外,例如背景(FALSE)。

这个属性能被测试但不被设置。

实例    这个帧脚本检测
如果鼠标指针是在一个在通道的在Flash电影里的导航按钮上。如果鼠标指针是在按钮上,脚本更新一个文本域关于一个适当的消息;否则,脚本清除消息。

  on enterFrame
    case sprite(3).mouseOverButton of
        TRUE:
            member("Message Line").text = "Click here to go to the next page."
        FALSE:
            member("Message Line").text = " "
    end case
    updatestage

  end
______________________________________________
on mouseUp (event handler)

语法    on mouseUp
     语句
end

描述    系统消息和事件程序;包含声明那是在鼠标按钮被释放时激活的。

在鼠标按钮被释放时,Lingo搜索下列位置,按顺序,对于一个mouseUp程序:初级的事件程序,精灵脚本,演员脚本,帧脚本,和电影脚本。在它到达第一个位置有一个on mouseUp程序时Lingo停止搜索,除非程序包括pass命令来明确地传递给下一个位置mouseUp消息。

在使用者释放鼠标按钮时创造同一响应来贯穿整个电影,设置mouseUpScript。

一个on mouseUp事件程序是一个好位置去安置Lingo从changes the appearance--such as buttons--after它们是被点击的。你能在精灵被点击并且鼠标被释放后转换演员赋值给精灵。

在它运行时,你在什么地方放置一个on mouseUp程序能影响,如下:

● 在一个明确的精灵上应用程序,放一个精灵脚本。
● 在一个演员上应用程序一般而言,放一个演员脚本。
● 在一个完整的帧上应用程序,放一个帧脚本。
● 贯穿整个电影的应用程序,放一个电影脚本。

你可以忽略一个on mouseUp处理程序,一个可供选择的方法是通过放一个on mouseUp程序到Lingo检查得到你想忽略的处理程序的位置之前。例如,你可以通过放一个on mouseUp程序到精灵脚本上来忽略演员上的on mouseUp程序。

如果习惯用一个行为,这个事件是被精灵脚本或帧脚本传递,参考me。

实例    这段程序,赋值给精灵10,在使用者释放鼠标按钮时在,点击精灵之后转换演员赋值给精灵10:

  on mouseUp
    sprite(10).member = member "Dimmed"
  end

参见    on mouseDown (event handler)
_____________________________________
the mouseUp (system property)

语法    the mouseUp

描述    系统属性;显示鼠标按钮不管被释放(TURE)或者被压下(FALSE)。

在Lingo是在一个循环时,Java的Director播放器不能更新the mouseUp属性。

实例    这段程序
使电影运行在使用者按鼠标按钮时候。
在使用者释放鼠标按钮时重放停止。

  on exitFrame me
    if the mouseUp then
        go the frame
    end if
  end

实例    这段程序通知Lingo在使用者释放鼠标按钮时去退出循环或程序。

  if the mouseUp then exit

参见    the mouseDown (system property), mouseH, mouseV, the mouseUp (system property)
____________________________________________
on mouseUpOutside

语法    on mouseUpOutside me
     语句
end

描述    系统消息和事件程序;在使用者在一个精灵上点击鼠标按钮而是释放它(远离)精灵时发送。

实例    这段程序在使用者在一个精灵上点击鼠标并且释放在精灵矩形范围之外时播放一个声音:

  on mouseUpOutside me
    puppetSound "Professor Long Hair"
  end

参见    on mouseEnter, on mouseLeave, on mouseWithin
____________________________________________
mouseUpScript

语法    the mouseUpScript

描述    系统属性;确定在鼠标按钮被释放时Lingo是可执行的。Lingo被写成一个字符串,被围绕在引号中,并且能是一个简单声明或者一个程序中的调用脚本。

在鼠标按钮被释放并the mouseUpScript属性是被定义的时候,Lingo执行指令首先指定the mouseUpScript属性。除非指令包含pass命令mouseUp消息才能被传递到电影中的其它目标,
没有其它的on mouseUp程序可以被执行。

在你指定the mouseUpScript指令不太适当的时候,用set the mouseUpScript to empty来关闭。

设置the mouseUpScript属性实现相同的事情,像使用在早期的Director版本里mouseUp一样。

这个属性能被测试和设置。缺省值是EMPTY。

实例    在这段程序是有效并且电影是被暂停时,使用者释放鼠标按钮电影继续播放:

  the mouseUpScript = "go to the frame +1"

实例    在使用者释放鼠标按钮后点击舞台上任何地方时,用这段程序使电影发出哔哔声:

  the mouseUpScript = "if the clickOn = 0 then beep"

实例    这段程序设置mouseUpScript为自定义程序myCutstomHandler。一个Lingo自定义程序在使用在the mouseUpScript属性中时必须被加上引号。

  the mouseUpScript = "myCustomHandler"

参见    stopEvent, mouseDownScript, on mouseDown (event handler), on mouseUp (event handler)
____________________________________________
mouseV

语法    the mouseV

mouseV()

描述    系统属性;显示鼠标指针的垂直位置,符合像素,从舞台的上部。
这个数值增加指针向下移动,减少指针向上移动。

mouseV属性是用于移动精灵去鼠标指针的垂直位置并且检查指针是否是在舞台区域内。共同使用mouseH和mouseV属性,你能确定指针的准确位置。

在Lingo在一个循环中时,Java的Director播放器不能更新mouseV属性。

这个属性能被测试但不能设置。

实例    这段程序在使用者点击鼠标按钮时,移动精灵1到鼠标指针位置并更新舞台:

  on mouseDown
    sprite(1).locH = the mouseH
    sprite(1).locV = the mouseV
    updateStage
  end

实例    这段程序检测指针是否在一个起始点的上面或下面10个像素点之外。并且如果是的,则设置变量draggedEnough为TRUE:

  if abs(the mouseV - startV) > 10 then draggedEnough = TRUE

参见    mouseH, locH, locV, mouseLoc
__________________________________________
on mouseWithin

语法    on mouseWithin
     语句
end

描述    系统消息和事件程序;包含声明在鼠标在精灵活动区域之内时运行。鼠标按钮不能是被按下的。

如果那个精灵是一个应用了matte ink效果的位图演员,它的活动区域是那个图像所被显示的那一部分;否则,它的活动区域是那个精灵的矩形范围。

如果被用在一个行为上,这个事件是被传递到精灵脚本或者帧脚本涉及me。

实例    这段程序当鼠标滑入一个精灵时显示鼠标位置。

  on mouseWithin
    member("Display").text = string(the mouseH)
  end mouseWithin

参见    on mouseEnter, on mouseLeave
___________________________________
mouseWord
语法 the mouseWord

描述 系统属性;当这个属性被调用而且鼠标指针移动到一个 field 精灵上时它包含鼠标指针下的单词的数量。计数从 field 的开始计算。当鼠标指针没有移动到一个 field 上时,它的结果是 -1。
    
        mouseWord 属性的值可以在一个句柄或循环里改变。如果一个句柄或循环多次使用这个属性,调用一个函数并把它的值赋给一个局部变量通常是一个好主意。

实例 这条语句检测鼠标指针是否移动到一个 field 精灵上,如果不是,就改变 field 演员的内容并指示“Please poing to a word.”。
        if the mouseWord = -1 then
     member("Instructions").text = "Please point to a word."
        else
     member("Instructions").text = "Thank you."
        end if

     实例 这条语句把鼠标指针下的指定 field 的单词数量赋给变量 currentWord 。
        currentWord = member(the mouseMember).word[the mouseWord]

     实例    当鼠标左键按下时这条语句使鼠标指针下的单词成高亮状态:
        on mouseDown
          thisField = sprite(the clickOn).member
         if the mouseWord < 1 then exit
         lastWord = 0
         repeat while the stillDown
         MW = the mouseWord
         if MW < 1 then next repeat
         if MW <> lastWord then
         thisField.word[MW].hilite()
         lastWord = MW
         end if
         end repeat
        end

     参见 mouseChar,mouseItem,mouseLine,number(words),word...of
_________________________________________
moveableSprite
语法 sprite(whichSprite).moveableSprite
        the moveableSprite of sprite whichSprite

描述 精灵属性;指出一个精灵是否可以由用户移动(TRUE)或不能(FALSE)。
        你可以通过用 Score 中的 "Moveable" 选项来使一个精灵可被移动。但是,要想控制一个精灵可移动而且要按需要打开或关闭这个条件,就要使用 Lingo 。例如:想让用户拖拽精灵到合适位置后让精灵不可被移动,就要在适当的时机打开或关闭精灵的 moveableSprite 属性。

        注意:至于更多特定的控制,比如在拖拽时突然回到原点,建立一个行为来完成这个额外的功能。

        这个属性可以检测和设置。

实例 这段程序使第5通道上的精灵可被移动:
        on spriteMove
         sprite(5).moveableSprite = TRUE
        end

     实例    这条语句检查一个精灵是否可被移动如果不可被移动,显示一个信息:
        if sprite(13).moveableSprite = FALSE then
        member("Notice").text = "You can't drag this item by using the mouse."

     参见 mouseLoc
_________________________________________
move member

语法 member(whichCastMember).move()
        member(whichCastMember).move(member whichLocation)
        move member whichCastMember {,member whichLocation}

描述 命令;移动由 whichCastMember 指定的演员到演员表窗口中的第一个空位置(如果没有参数设置)或由 whichLocation 指定的位置。
        为了得到最好的结果,在编辑期间使用这条命令,而不是在运行时,因为移动通常被保存和文件一致。演员的实际位置并不影响最终用户的回放效果。要在运行时转换一个精灵的内容或改变精灵的显示,用设置精灵的演员来实现。

实例 这条语句移动演员“Shrine”到演员表窗口中的第一个空位置:
        member("shrine").move()

实例 这条语句移动演员“Shrine”到“Bitmaps”演员表窗口中的第20个位置上:
        member("Shrine").move(20, "Bitmaps")


下半部分由max翻译。