Archive for August, 2007

My Online Store is Live

Thursday, August 30th, 2007

Today I have uploaded my first AS3 file to FlashDen.

What is FlashDen? FlashDen.net is a site where you can buy and sell items to use in your creative projects. There are four types of items available on the site: Adobe Flash files, Audio loops and effects, Video loops and Pixel fonts. Want more? Head directly to forums and simply request the file you need, helpful developers and staff members will guide you to the right direction or even craft a custom file for you.

Check out my portfolio from time to time as I will upload some advanced AS3 code that you will be able to buy for a relatively small price. You can reach it by clicking the “Shop @ FlashDen” link above or the banner on the right. I personally think FlashDen is a cool place to learn Flash or improve your skills.

And I will also continue to contribute FREE code and applications that you will be able to download from this site.

See you soon!

Flickr Opens Crossdomain.xml

Wednesday, August 29th, 2007

Flickr has decided to fix the issue of accessing their images from Flash Player. They have a new crossdomain policy file (located at http://static.flickr.com/crossdomain.xml) that allows full access to Flickr images.

This means that you are now able to access and modify BitmapData from the loaded images in any way you like.

More information at Yahoo! Flash(R) Blog

Results: Right Click

Monday, August 27th, 2007

Hey everyone,

First of all I would like to thank everyone for their great feedback regarding the Right-Click project. I have received thousands (!!!) of feedback emails with your browser data which helped me to better understand the different browser compatibility issues.

The mostly incompatible platforms for now are:

  • Opera (all OS)
  • Firefox 2 (Linux)
  • Firefox 2 Russian
  • Safari 2 (OS X)

There are also incompatibilities with almost all mouse-gesture browser plugins and specific mouse software running outside browser. These plugins capture mouse events using the browser’s JS engine and often fail to pass them on to HTML correctly.

I would also like to note that first click inside Flash Player does not generate the event. This is not a bug! it is required for IE browser to start capturing mouse events correctly. Without this safeguard the mouse event would fire at last known mouse position inside Flash Player, which is in most cases somewhere near the Flash/HTML border and it can produce unwanted results.

Script’s success rate is 86%. I think this is pretty good for a very basic Javacript hack, but yet far from perfect.

Once again I want to clarify that by contributing my time to this project I did not meant to “customize the Flash menu” or “sabotage the Flash Player” but instead I wanted to be able to use the right-click event in Actionscript 3 natively for creative purposes (for ex. RTS games where left-click selects units and right-click dispatches orders). In the world of multitouch interfaces we are still tied to a single click in Flash Player and I would like to be able to change that. However, I want to turn this project a in a little bit different direction and kindly ask you to contribute to the discussion in the comments.

What do you think?:

  • Can you think of a cool scenario (website, application or game) that uses right-click events in Flash?
  • Do you as a developer need right-click events in Flash Player and how would you use it?
  • Do you think this technology will be abused? How and why?
  • What do Adobe’s minds think about this?

Thank you.

$.console – Flash Debugging Console

Saturday, August 25th, 2007

The last couple of days have been pretty busy for me trying to make some progress with the Right-Click functionality in Flash 9, it is coming together pretty good and I hope to have a working Linux version very soon.

Besides that, I’m involved in some very cool Flash and AIR projects and I wanted to share some code with you that helps me in development on a daily basis.

$.console

So the concept behind the $.console is simple: make Actionscript 3 debugging easier and more portable. With that in mind I have developed a simple solution that can do the following:

  • you can see  trace() statements without external debugger right inside your application.
  • you can control the application at will (launch functions and set and remove variables).
  • you can hide it when you don’t need it (` key).
  • it’s lightweight (sample application is only 8Kb)
  • it uses AS3 Global Object

Sounds good? Let’s see some code!

Example Application:

Shows the maximum effort required to use $.console

Actionscript:
  1. package {
  2.    
  3.     import flash.display.*;
  4.     import lt.uza.utils.*;
  5.  
  6.     public class ConsoleTest extends Sprite
  7.     {
  8.        
  9.         private var $:Global = Global.init();
  10.        
  11.         public function ConsoleTest()
  12.         {
  13.            
  14.             // Initialize the Console.
  15.             $.console = new Console();
  16.  
  17.             // Show something.
  18.             $.trace("Hello World");
  19.             for (var i:int = 0; i<5; i++) {
  20.                   $.trace("n"+i);
  21.             }
  22.         }
  23.     }
  24. }


Screenshot:

Shows the console in action.

console in action

I hope you like it and find it useful as much as I do.

Download Source (v1.1) AS3 Console (1712)

Happy coding!

Right Click – Testers Wanted!

Monday, August 20th, 2007

Dear Flash enthusiasts,

RightClick project is looking for your help diagnosing the few remaining browser incompatibility issues. I have created a script that should help you with the debugging process by gathering all the data we need to nail the remaining bugs.

DEMO / DEBUG

If the script works on your platform as described, choose “YES” otherwise choose “NO”.

Your help is greatly appreciated!

SOLVED: Right Click in AS3

Sunday, August 19th, 2007

Eureka,

A day or two ago polyGeek has revived an old and challenging idea that one could make use of custom right-click functionality in Flash (AS3 + Javascript).

Why would anyone want to do this? Well, there are several very important reasons:

1) Games – the power of AS3 has brought Flash to the world of digital entertainment. At last it is possible to focus on the idea of your game rather than on how to improve the laggy experience. One thing that is still missing – right click functionality. We had this forever in desktop games, now it is time to let your casual RTS, RPG and FPS creations conquer the web.

2) User Experience – 2 buttons are better than 1. Every experimentalist's dream is to be able to have more input options, not just one button. I can bet someone would soon create a stunning interface using this new functionality and we would see that on no less than FWA.

3) RIA – Rich Internet Applications. My clients are often asking if it is possible to remove embeded Flash Player menus from their applications and replace them with their company’s branding stuff.

***

AND THE ANSWER IS – YES! It is now possible to use custom right-click functionality in Flash and even Flex.

After long hours of searching through Microsoft’s documentation I came up with a universal solution that works nicely at least on 3 major browsers – Firefox 2, IE 7 and Safari. (IE6 has not been tested but I can bet it works OK).

***

Here you can see the * DEMO of right click * functionality (click the grey area to draw transparent dots)

Javascript source code looks like this:

JAVASCRIPT:
  1. /**
  2. *
  3. * Copyright 2007
  4. *
  5. * Paulius Uza
  6. * http://www.uza.lt
  7. *
  8. * Dan Florio
  9. * http://www.polygeek.com
  10. *
  11. * Project website:
  12. * http://code.google.com/p/custom-context-menu/
  13. *
  14. * --
  15. * RightClick for Flash Player.
  16. * Version 0.6.2
  17. *
  18. */
  19.  
  20. var RightClick = {
  21.     /**
  22.      *  Constructor
  23.      */
  24.     init: function () {
  25.         this.FlashObjectID = "customRightClick";
  26.         this.FlashContainerID = "flashcontent";
  27.         this.Cache = this.FlashObjectID;
  28.         if(window.addEventListener){
  29.              window.addEventListener("mousedown", this.onGeckoMouse(), true);
  30.         } else {
  31.             document.getElementById(this.FlashContainerID).onmouseup = function() { document.getElementById(RightClick.FlashContainerID).releaseCapture(); }
  32.             document.oncontextmenu = function(){ if(window.event.srcElement.id == RightClick.FlashObjectID) { return false; } else { RightClick.Cache = "nan"; }}
  33.             document.getElementById(this.FlashContainerID).onmousedown = RightClick.onIEMouse;
  34.         }
  35.     },
  36.     /**
  37.      * GECKO / WEBKIT event overkill
  38.      * @param {Object} eventObject
  39.      */
  40.     killEvents: function(eventObject) {
  41.         if(eventObject) {
  42.             if (eventObject.stopPropagation) eventObject.stopPropagation();
  43.             if (eventObject.preventDefault) eventObject.preventDefault();
  44.             if (eventObject.preventCapture) eventObject.preventCapture();
  45.          if (eventObject.preventBubble) eventObject.preventBubble();
  46.         }
  47.     },
  48.     /**
  49.      * GECKO / WEBKIT call right click
  50.      * @param {Object} ev
  51.      */
  52.     onGeckoMouse: function(ev) {
  53.         return function(ev) {
  54.         if (ev.button != 0) {
  55.             RightClick.killEvents(ev);
  56.             if(ev.target.id == RightClick.FlashObjectID && RightClick.Cache == RightClick.FlashObjectID) {
  57.                 RightClick.call();
  58.             }
  59.             RightClick.Cache = ev.target.id;
  60.         }
  61.       }
  62.     },
  63.     /**
  64.      * IE call right click
  65.      * @param {Object} ev
  66.      */
  67.     onIEMouse: function() {
  68.         if (event.button> 1) {
  69.             if(window.event.srcElement.id == RightClick.FlashObjectID && RightClick.Cache == RightClick.FlashObjectID) {
  70.                 RightClick.call();
  71.             }
  72.             document.getElementById(RightClick.FlashContainerID).setCapture();
  73.             if(window.event.srcElement.id)
  74.             RightClick.Cache = window.event.srcElement.id;
  75.         }
  76.     },
  77.     /**
  78.      * Main call to Flash External Interface
  79.      */
  80.     call: function() {
  81.         document.getElementById(this.FlashObjectID).rightClick();
  82.     }
  83. }

On the Flash side is as simple as this code (AS3):

Actionscript:
  1. package {
  2.    
  3.     import flash.display.*;
  4.     import flash.external.ExternalInterface;
  5.  
  6.     public class RightClick extends Sprite
  7.     {
  8.        
  9.         public function RightClick()
  10.         {
  11.             stage.scaleMode = StageScaleMode.NO_SCALE;
  12.             stage.align = StageAlign.TOP_LEFT;
  13.            
  14.             var methodName:String = "rightClick";
  15.             var method:Function = onRightClick;
  16.             ExternalInterface.addCallback(methodName, method);
  17.         }
  18.        
  19.         private function onRightClick():void {
  20.  
  21.             var mx:int = stage.mouseX;
  22.             var my:int = stage.mouseY;
  23.  
  24.             if(my> 0 && my <stage.stageHeight && mx> 0 && mx <stage.stageWidth) {
  25.                 // YOUR CODE HERE
  26.             }
  27.         }
  28.     }
  29. }

This demo has been tested and confirmed working on:

WINDOWS VISTA

  • Internet Explorer 7.0.6001 (16549)
  • Firefox 2.0.0.6 (with mouse gestures disabled)
  • Maxthon 2 (with mouse gestures disabled)
  • Safari 3.0.3 (522.15.5)

Windows XP SP2

  • Internet Explorer 6
  • Internet Explorer 7
  • Maxthon 2 (with mouse gestures disabled)
  • FireFox 2 (with mouse gestures disabled)
  • Safari 3
  • Netscape 8

Mac OSX 10.4.10 (Intel)

  • Firefox 2
  • Safari 3.0.3

Thank you all for testing!

Opera will not work, the browser forces the context menu to appear and blocks mouse events by default.

If you manage to get the demo working, please post the OS and Browser build number in the comments. Please also leave a comment if you experience any problems with the demo.

Google Code Project

DEMO

DIGG THIS

.

Unofficial Gigabyte 8800Gts BIOS update F3

Friday, August 10th, 2007

For several months I have been playing around with my new setup - nVidia 8800Gts and an Apple Cinema Display 23''. Both image quality and performance were superb.

However I had some problems. Screen was always blank during startup (BIOS and POST) times, so I had to use another LCD to see diagnostic screens or to adjust BIOS settings.

The bug was identified and solved by nVidia's developers, and patches by video card manufacturers were about to follow in a form of F3 update for series 8800. However only EVGA (AFAIK) has updated it's BIOS.

Today I decided to risk my 500$ card and to try modding the EVGA BIOS - I had success! So with great pleasure I present you:

Apple Cinema Display fix for Gigabyte 8800GTS
========================================
Works on:

Gigabyte GeForce 8800 GTS
GV-NX88S640H-RH
VRAM: 640MB

NEW BIOS Version 60.80.13.00.01
========================================

I have NOT tested this on 320 Mb version, so I cannot guarantee that it works. This patch is ONLY for GTS. GTX and OC editions are incompatible. I take no responsibility if you damage your video card, please use at your own risk.

DOWNLOAD NOW!
DIGG IT