本文共 3005 字,大约阅读时间需要 10 分钟。
function hyperlink_MouseLeftButtonDown(sender, args) { window.location = "about-frames.html"; } function hyperlink_MouseEnter(sender,args) { sender.findName("hyperlink_line").opacity = 1; } function hyperlink_MouseLeave(sender,args) { sender.findName("hyperlink_line").opacity = 0; }
var mouseOver = false; var pressed = false; function button_MouseLeftButtonDown(sender,args) { sender.captureMouse(); mouseOver = true; pressed = true; updateVisuals(sender); } function button_MouseLeftButtonUp(sender,args) { sender.releaseMouseCapture(); pressed = false; updateVisuals(sender); if (mouseOver) { alert("you pressed the button!"); } } function button_MouseEnter(sender,args) { mouseOver = true; updateVisuals(sender); } function button_MouseLeave(sender,args) { mouseOver = false; updateVisuals(sender); } function updateVisuals(sender) { //background if (pressed && mouseOver) { sender.findName("button_rectangle").fill = "sc#1, 0.548430264, 0.5354195, 0.5354195"; var transform = sender.findName("button_transform"); transform.x = 2; transform.y = 2; } else { sender.findName("button_rectangle").fill = "sc#1, 0.8123474, 0.8123474, 0.8123474"; var transform = sender.findName("button_transform"); transform.x = 0; transform.y = 0; } // highlight if (mouseOver || pressed) { sender.findName("button_highlight").opacity = 1; } else { sender.findName("button_highlight").opacity = 0; } }
var mouseDownPosition = 0; var mouseDownValue = -1; function slider_Loaded(sender, args) { slider_SetValue(slider, 0); } function slider_MouseLeftButtonDown(sender, args) { var coordinate = args.x; coordinate -= sender["Canvas.Left"]; slider_SetValue(sender, coordinate); } function slider_thumb_MouseLeftButtonDown(sender, args) { var slider = sender.findName("slider"); sender.captureMouse(); mouseDownValue = slider_GetValue(slider); mouseDownPosition = args.x; } function slider_thumb_MouseLeftButtonUp(sender, args) { var slider = sender.findName("slider"); sender.releaseMouseCapture(); mouseDownValue = -1; } function slider_thumb_MouseMove(sender, args) { var slider = sender.findName("slider"); if (mouseDownValue != -1) { var newValue = mouseDownValue + (args.x - mouseDownPosition); slider_SetValue(slider, newValue); } } function slider_GetValue(sender) { var thumb = sender.findName("slider_thumb"); return thumb["Canvas.Left"] + .5 * thumb.width; } function slider_SetValue(sender, newValue) { if (newValue > sender.width) { newValue = sender.width; } if (newValue < 0) { newValue = 0; } var thumb = sender.findName("slider_thumb"); thumb["Canvas.Left"] = newValue - .5 * thumb.width; }