Adding SHIFT / CTRL Click support to links in Flash
One of the requests that I got for the Google search application that Josh Dura and I have been working on, is to give the user the option to open links in a new window. This makes sense, since if you leave the page, the Flash application looses its state. Well, I added an option in the settings panel to always open links in a new window, but I decided to also add support for SHIFT or CTRL clicking a link to open it in a new window (since a lot of people do this out of habit now.)
It was actually pretty simple. First of all, all of the links to outside URLs go end up going through one function. That function takes a URL, and then does a getURL action to open the link. Adding support for SHIFT and CTRL clicking only requires that you check to see if those keys are being pressed when you do the getURL action:
onURLClick = function(url)
{
var target = "_self";
if(Key.isDown(Key.CONTROL) || Key.isDown(Key.SHIFT))
{
target = "_blank";
}
getURL(url, target);
}
To call this from a textfield link, use asfunction:
<a href="asfunction:onURLClick, http://www.macromedia.com/go/blog_mchambers">Click Me!</a>
Pretty simple stuff really. You should be able to do some much more advanced stuff by calling javascript functions via getURL, but that would require that you know which browser you are running within.






very nice Mike!
Bob Clagett
5 May 03 at 5:02 pm
A while back I posted about how thrilled I was that Ultrashock started using shift-enabled linking on their homepage: http://www.hollowcube.com/talk/archives/000306.php
I really would like to see something similar integrated into the Macromedia Exchange interface… and yes, I have submitted a feedback form :-)
michael e. gunn
5 May 03 at 6:52 pm
Yeah well I’ve been adding to the ideas list for a couple of releases that the RIGHT click menu should have the option to open EXTERNAL links in a new window (by external I mean getURL that start with http://www.someotherdomain)
Pnut
5 May 03 at 11:48 pm
Graet job Mike!! The application performs near perfect now, just the tabbing still has some issues. Again, when can we have a look at the source files, really awating that !!
Abhishek
6 May 03 at 1:58 am
When I search for something, I can only view 10 links at the most, whyz that?? Isin’t there a way I can go to next page as in Google?? Also, It doesn’t show how many pages of similar links it found !!
Abhishek
6 May 03 at 2:10 am
Great improvements!
One suggestion:
On the search (editable) comboBox remove the functionality that HOME and END keys choose another item from the comboBox instead of move the cursor. I use these keys a lot when typing.
Thank you!
Matan
6 May 03 at 10:27 am
Wow, that really sucks! On my machine, descenders are all cut off, so for example “y” looks just like “v”… the font used in the results is horribly difficult to read, much too small, with poor letterspacing and crappy antialiasing… the Page Up and Page Down keys do not work correctly… When mousing over the tabs, the cursor stays as the I-beam… no way to open links in a new tab… etc. etc. Why would anyone use this??
mab
6 May 03 at 1:20 pm
That’s so funny… I never knew you could shift-click on a link! I’ve always just used right-click. Now, when you add that, make sure you post it too!
Thanks,
Phillip
Phillip Kerman
6 May 03 at 7:15 pm
Yeah, that google thing is sweet. I can’t figure how to trigger it from my google-toolbar though.
Phillip
Phillip Kerman
9 May 03 at 1:22 am
how to track a string as a command such as
doThis(“trace(‘test’)”);
???
tommy
5 Nov 03 at 9:18 pm
Why Buy2D?
–Make what you can NOT afford now be available to you!
–Instant Software Delivery System;
–100% Full Retail CD version;
–100% Full Working.
Get what you are looking for now!Here you’ll find great Business&Finance,CAD,CAM,CAE,PLM solution software,Mutimedia application,web development software,enterprise solution and more from many of the world’s top software publishers. Our regular prices are guaranteed to be the lowest on the planet!
No more waiting! Buy any CD, and gain immediate access to the contents online.Download CD images whenever you need them.Save on desk space and shipping charges!
www.Buy2d.com
1 Sep 04 at 7:05 am
Hello !!! Great Site !!!
My new Site
30 Dec 04 at 10:05 pm
Your site it`s very good! Welcome to my site.
limousine
6 Jan 05 at 3:23 pm
Great site :)
Makesolutions
12 Jan 05 at 4:10 pm
I just read this quote today and I think it’s awesome:
It is by universal misunderstanding that all agree. For if, by ill luck, people understood each other, they would never agree.
Charles Baudelaire
Just thought I’d share.
Mike
Online Degree
23 Jan 05 at 6:31 pm
Hello! Great site! I should start my own blog.
Kind regards,
Peter Venero
http://www.creatiqmedia.com
Peter Venero
21 Jul 05 at 6:22 pm