Skip navigation
Currently Being Moderated

Problem with base parameter in .NET WebBrowser (works in plain Internet Explorer)

Sep 23, 2011 3:33 PM

Tags: #flash #html #swf #ie9 #.net #webbrowser

(Copied here from Flash Player forum per chris.campbell's request)

Bit of a long explanation below, with a hopefully accurate short question summary here:

Can a WinForms program (in C#) that hosts a.NET WebBrowser control (Win7 64-bit, IE9 installed on machine, current Flash 10.3.183.7) load an HTML file that loads a SWF file into an <object> tag, where the SWF file is in a separate folder that also contains an XML data file in such a way as to have the SWF file load and display the XML data? I've tried specifying a base parameter, but the program only works when the XML data file is in the same folder as the HTML file loaded into the browser.

This seems like either a bug in the Flash plug-in, or in the WebBrowser control interaction, or ??? It works OK if I load the file directly into Internet Explorer. I tried the Flash Player 11 beta and got the same result. I've created an x86 and an x64 version of the program, with the same result. And I've played with the FEATURE_BROWSER_EMULATION settings in the registry to force IE9 behaviors on my program. Still doesn't work.

UPDATE: Added some more information below based on some further experimentation...

Gory detail:

This has plagued me for a couple of days. Consider the following:

C:\dev\wb.exe -- program that uses a WebBrowser to show a local SWF file from the disk

c:\data\mySWF.swf -- the SWF file I want to play

c:\data\myData.xml -- the file with data that mySWF.swf is looking for

C:\html\index.html -- HTML file loaded by wb.exe. This file has an <object> tag to set up a Flash ActiveX control playing c:\data\mySWF.swf.

Originally, this started with swfobject.js being used, and when I didn't see the results I was expecting, I kept simplifying until I got to the point where I don't have anything but an HTML file with no additional libraries.

If I load the index.html into IE9, it works. I see the SWF file playing with the data from the XML file loaded.

When I run wb.exe, it loads the C:\html\index.html file, and I see the SWF playing. But the data fields are empty. If I copy the index.html to C:\data\index.html and load it into wb.exe, THEN I see my data.

My index.html file:

<!DOCTYPE html>
<html>
   
<head>
       
<title></title>
       
<style type="text/css">
* {
  
width: 100%;
  
height: 100%;
  
margin: 0;
  
padding: 0;
  
overflow: hidden;
}
     
</style>
</head>
   
<body MARGINWIDTH="0" MARGINHEIGHT="0" LEFTMARGIN="0" RIGHTMARGIN="0" TOPMARGIN="0" BOTTOMMARGIN="0">
       
<object  type="application/x-shockwave-flash" width=100%" height="100%" id='player1' name='player1'>
           
<param name='movie' value='C:\data\mySWF.swf'>
           
<param name='allowfullscreen' value='true'>
           
<param name='allowscriptaccess' value='always'>
           
<param name='base' value='C:\data\'>
           
<param name='menu' value='false'>
           
<param name='quality' value='best'>
           
<param name='scale' value='exactfit'>
       
</object>
   
</body>
</html>

The base parameter seemed to be part of getting this to work, but I'm stymied as to why (or whether) I can get the Flash ActiveX control to work the way I need it to, without having to load an HTML file from the same folder as the SWF file.

UPDATE: If I put the myData.xml file into the C:\html folder, and I load from C:\html\index.html, I get the data values in the SWF. So it seems that the Flash plug-in is using the path of the index.html file, and NOT the base parameter.

I appreciate your patience if you stuck around this far, and hopefully you might be able to educate me as to my problem.

Thanks.

 

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points