Hi all,

 

I've spent most of the day trying to track down a nasty bug with Flex
(or Flash) in ASP.NET. I've not yet tried in Firefox, but it's present
in IE6 and IE7.

 

ASP.NET wraps pretty much the entire page in <form></form> tags.
Unfortunately, either Flex or the Flashplayer includes javascript that
relies on the movie not being inside forms, when you use
ExternalInterface.

 

Eg.

 

Create a new flex project like this:

 

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute" creationComplete="initApp();">

 

<mx:Script>

                <![CDATA[

                                public function initApp():void

                                {

                                                // Add interface so
Javascript can call our setData method

                ExternalInterface.addCallback("setData", setData);

                                }

                                

                                public function
setData(sXml:String):void

                                {

                                                // Do nothing

                                }

                ]]>

</mx:Script>

                

</mx:Application>

 

It simply registers a method than be called in javascript. If you run
this, you'll just get a blank flex app. Now open the index.template.html
file, and add form tags immediately inside the body tag:

 

<body>

<form>

 

// rest of page //

 

</form>

</body>

 

Now try running it again. You'll get a javascript error to the effect of
"'FormTestProject' is undefined". It comes from this code (I don't know
if this comes form Flex or the FP) which gets loaded into the document:

 

function __flash_unloadHandler() {

  FormTestProject.style.display = 'none';

  // Snip

}

 

Note that FormTestProject is not wrapped in document.getElementById().
This seems to work by fluke when the object is in the main page, but
when inside a form, it doesn't.

 

I can't find anyone else having this issue on flexcoders (though
searching for "form" returns anything containing formatting, etc.
etc.!), which kinda surprises me, given it's a big show stopper for
anyone using asp.net and ExternalInterface.

 

Anyone else hit this problem? Any workarounds?

 

Thanks,

 

Danny
--------------------------------------------------------
The information contained in this e-mail and/or any attachments is confidential 
and intended only for the individual(s) to which it is addressed. If you are 
not named as an addressee you must not disclose, copy or take any action in 
reliance of this transmission. This e-mail and its attachments have been 
scanned for viruses by MessageLabs Ltd.

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

Reply via email to