sIFR 3 rev 436 - 将链接复制到剪贴板
这最初是一个问题,但现在是一个代码增强,因为它是一个非常小的(但有用)更新。
当标题(或其他)文本用作 sIFR 3 的链接时,您现在可以在链接的右键单击 Flash 上下文菜单中获得两个“打开链接/在新窗口中打开链接”选项。
昨天,当我第一次遇到 sIFR 时,我想在一个使用 sIFR 2.x 的网站上将标题 (h2) 链接复制到剪贴板,但很沮丧,因为我做不到。 感谢开源(以及编写良好的代码)的奇迹,我可以建议对 sIFR 3 进行以下增强:
[在文件 flash/sIFR.as 中,找到以注释“// Have to set”开头的部分先上菜单项!” 到“);” 并替换为以下内容,然后将字体信息添加到 .fla 并按照 导出 swf教程:]
// Have to set up the menu items first!
menuItems.push(
new ContextMenuItem("Follow link", function() { getURL(sIFR.instance.primaryLink, sIFR.instance.primaryLinkTarget) }),
new ContextMenuItem("Open link in new window", function() { getURL(sIFR.instance.primaryLink, "_blank") }),
new ContextMenuItem("Copy link to clipboard", function() { System.setClipboard(sIFR.instance.primaryLink) })
);
现在我很高兴...:-)
艾伦。
This was originally a question, but is now a code enhancement, since it's a very minor (but useful) update.
When heading (or other) text is used as a link with sIFR 3, you now get the two 'open link / open link in new window' options in the right-click flash context menu for the link.
When I came across sIFR for the first time yesterday, I was wanting to copy a header (h2) link to the clipboard, on a site that used sIFR 2.x, and was frustrated that I couldn't.
Thanks to the wonders of open source (and well written code), I can suggest the following enhancement to sIFR 3:
[In the file flash/sIFR.as, find the section starting with the comment "// Have to set up menu items first!" through to ");" and replace with the following, then add font information to the .fla and export the swf as per the tutorial:]
// Have to set up the menu items first!
menuItems.push(
new ContextMenuItem("Follow link", function() { getURL(sIFR.instance.primaryLink, sIFR.instance.primaryLinkTarget) }),
new ContextMenuItem("Open link in new window", function() { getURL(sIFR.instance.primaryLink, "_blank") }),
new ContextMenuItem("Copy link to clipboard", function() { System.setClipboard(sIFR.instance.primaryLink) })
);
Now I'm happy... :-)
Alan.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,那么什么时候添加马克? 我下载了最新版本(436),但它不在其中。
这很有趣,我已经在 sIFR.as 文件中自己实现了它,但我逐字编写了完全相同的代码(甚至是菜单文本“将链接复制到剪贴板”),与艾伦在他的示例中所做的一样。
我对结果很满意,并认为我会建议来这里并发布它。
值得庆幸的是,我搜索了一下是否有人已经发布了它,好吧,瞧,它就在这里。
艾伦 - 英雄所见略同(即使不相同)。
Wubben - Stack Overflow 是否必须在其网站上制作一个按钮来帮助您“将代码复制到剪贴板”,以便您可以将其粘贴到下一版本的 sIFR 中?!?!?
只是在这里尖酸刻薄,但希望这是对如此简单而快速的实现的一个很好的提醒;-)
Yeah, so when's that getting added Mark? I downloaded the latest version (436) and it's not in there.
This is funny though, I already implemented it in the sIFR.as file on my own, but I wrote the EXACT same code (even the menu-text "Copy link to clipboard"), word for word, that Alan did in his example.
I was happy with the result and figured I'd suggest it by coming here and posting it.
Thankfully i did a search to see if someone already posted it, and well, voila, here it was.
Alan - Great minds think alike (if not identically).
Wubben - does Stack Overflow have to make a button on their website that will help you "Copy code to clipboard" so you can paste it into the next version of sIFR?!?!?
Just being snarky here, but hopefully it's a good reminder for such a simple and quick implementation ;-)