Update Image class – added contextMenu (3)

, under actionscript, Other.

I’ve updated my Image class. It is irritating flashsites break the right-click contextmenu. Well, I can’t fix that and Adobe should look at that, but I think it would nice to add some of the browser – features to my image class.

Currently I have these options added to the Image class:

View image
Views image in new window/tab. I used NavigateToURL to make this happen.

Save Image as..
Saves image on your computer. I used my ImageClass.saveLocal() to make this happen. This is only available within FP10, but I think this is no problem anymore because < a href = "http://www.adobe.com/products/player_census/flashplayer/version_penetration.html" > 93 % (September 2009) has FlashPlayer 10, so most people have it, and I don’t support outdated software 😉

Copy Image location
Copies the url to the clipboard, using System.setClipboard(url). It’s a pity I can’t create a ‘Copy Image’ function, because pushing bitmapdata into the clipboard is only supported in AIR.

Send Image
Sends the url to the mail-client, using “mailto:&body=” + src. Also a pity; I can’t add the image directly into the mail.

How to enable the contextmenu:
[as]
import nl.stroep.utils.Image;

var myImage:Image = new Image(“myImage.jpg”);
myImage.enableContextMenu = true; // enable it!
this.addChild(myImage);
[/as] I still love this class, I use it a lot. I want to encourage you to please add these kind of usability things to your apps / websites. And share them! Yes, it takes some extra time to create/add it, because this IS the finishing touch, but a lot of people will like this kind of features.

Download
Check out the Image class atgooglecode

3 responses to “Update Image class – added contextMenu”

  1. Ronny says:

    I love it, Mark. I thought about this a couple of times, I just never actually created it.
    Very nicely done!
    Definitely one of the classes I’m going to use 🙂

  2. Hi Mark,

    The idea is really nice, but I don’t really think it will do any good. As long as Adobe doesn’t implement this itself in the Flash Player, users won’t know about this functionality and I’m guessing no-one is going to use it.

    When I enter a Flash site I may right-click the website once to see about the creators or maybe some other info, but I’m not going to click every element and see if it has some custom context menu.

    Don’t get me wrong, every element in a flash website SHOULD have a custom context menu, but there’s a long way to go. And maybe, by creating this class, you’re getting us one step closer :).

    I’m not trying to ‘bash’ you, I just think it’s a good subject for some discussion :-).

    Keep it up 😉

  3. Mark says:

    @Ronny; Thanks!

    @Jeroen Beckers; I totally agree! It’s getting us (only for those who uses my class 🙂 ) one step closer, but you are right saying this should be added into the FlashPlayer. I would love to see a enableBrowserContextmenu or something from Adobe. If we could add functionality to the browser contextmenu, we have better experience/usability and this kind of functionality would matter.

Say something interesting

Please link to code from an external resource, like gist.github.com.