tags:

views:

278

answers:

2

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.

A: 

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 ;-)

A: 

Is there also a way to add a context menu item to "Open Link in New Tab"?

sleep --benjamin