Friday, February 24, 2006

mouseWheel has issues when used with wMode=transparent

I've been facing a lot of issues with wmode='transparent'. (We needed it to be transparent because we had to show a java applet showing a 3D interactivity above the SWF in our app).

I have come across a few blog posts about the transparent setting for wmode making the input text fields appear without a I-beam mouse pointer in FF.

The recent one that I see is that when wmode = transparent, the scrollTarget being sent as the second parameter to the onMouseWheel event handler function is the path to a movieclip tats a few (about 50- 60 , i guess) pixels above / below the actual movieclip that the mouse is currently on. I tried turning off wmode and it works as expected.

I put together a test file to test this (I tested it out on both Flash 8 and MTASC) , and I see the same problem there.
Here is the test Class:

class App {
function App(ref) {
drawMe(ref);
var o:Object = new Object();
o.onMouseWheel = function(n:Number, s:String) {
ref.log.text += s+"\n";
}
Mouse.addListener(o);
}
static function main(ref) {
var o:App = new App(ref);
}
function drawMe(timelineRef) {
var w:Number = Stage.width;
var h:Number = Stage.height;
var bg_mc:MovieClip = timelineRef.createEmptyMovieClip("bg_mc", timelineRef.getNextHighestDepth());
var box_mc:MovieClip = timelineRef.createEmptyMovieClip("box_mc", timelineRef.getNextHighestDepth());
bg_mc.lineStyle(1, 0xFF0000, 100);
bg_mc.beginFill(0xFF0000, 100);
bg_mc.moveTo(0, 0);
bg_mc.lineTo(w, 0);
bg_mc.lineTo(w, h);
bg_mc.lineTo(0, h);
bg_mc.lineTo(0, 0);
box_mc._x = box_mc._y=100;
box_mc.lineStyle(1, 0x00FF00, 100);
box_mc.beginFill(0x00FF00, 100);
box_mc.moveTo(0, 0);
box_mc.lineTo(w/4, 0);
box_mc.lineTo(w/4, h/4);
box_mc.lineTo(0, h/4);
box_mc.lineTo(0, 0);
timelineRef.createTextField("log", timelineRef.getNextHighestDepth(), 0, 0, 200, 0);
timelineRef.log.autoSize = true;
}
}

And in my FLA, I have the following code:

App.main(this);

Does anybody else see this? is this a known issue? If it is,dDo we have a technote about all these known issues with wmode?

Workaround:

We developed (actually a collegue of mine wrote it all) a work around. As you might guess, we resorted back to hitTest. We have a onMouseWheel listener and when it triggers, we dont use the target that Flash player returns itself. Instead we do a hitTest with _xmouse and _ymouse and figure out the bounds. Though not a great solution, it solves the purpose. Am planning to think about doing something generic enough for this. Let me think!

Wednesday, February 15, 2006

Points to remember when using SSL + IE + Flash

(I got no time to write it in detail. Bear with me, please ;-))

Flash UI (built using AMES), Java for backend code (on Websphere app server), OpenAMF to communicate between Flash and Java. Thats the basic tech stack of the application that I am current working on.

We use SSL to send / receive sensitive information to / from the server. The development machines use Tomcat server instead of websphere. Things were fine until we tested the app with HTTPS on Websphere. Only on IE, the netConnection call returned with a "Call failed" error. Logs showed that the Java code was receiving calls and was returning the data, But the connection kept failing.everytime a HTTPS connection was made.

Thanks to Abdul Qabiz, who was quick to point me into sniffing the HTTPS headers being received. This tip off helped us narrow down our 'googling' and we figured out that there was an issue with IE and SSL that was causing this issue.

The following pages came to be of great help:
macromedia Technote
Microsoft Knowledge base:
http://support.microsoft.com/kb/323308/
http://support.microsoft.com/kb/815313/

and of course this post from Gary Matthew Rogers.

And the solution, we added the following line of code in Java before sending the response back to Flash:

HttpServeletResponseObj.setHeader("Cache-Control", "no-store");

That solved the problem!

Wednesday, February 01, 2006

Flex 2.0 Beta available at macromedia Labs!

Flex 2.0 beta is available to the public, at Macromedia(Adobe) labs. Click here to download the flex SDK,Flex Charting Components 2, Flex Enterprise Services 2, and Flash Player 8.5 (Alpha 3).

With this beta, You don't have to download the entire flex installers to install Flash Player 8.5. Installers (& uninstallers) for Flash player 8.5 (Win and Mac) are available as separate downloads!!

There are some really exciting offerings today from Adobe. As the press release goes "The Flex Framework will be made available free of charge through the Flex Software Development Kit, which will include the command line compiler and documentation required to develop, compile, and deploy Flex applications that connect to XML and SOAP web services with no additional charges or server licensing required. ...Flex Builder 2.0 will be sold for less than $1,000 ... Flex Enterprise Services 2.0 will be free of charge for use by a limited number of concurrent users on a single, non-clustered server. "

There has been a lot of talks in the open source community about what would happen post AS3.0 release, since the next revision of the currently available open source AS compiler MTASC isn't going to support AS3.0.With Flex 2.0's release, Developers will get a standalone AS3.0 compiler, straight from the source, for free!

Can't wait to get my download done ;-)