Specifying relative path to shockwave flash object

352 Views Asked by At

While playing the .SWF file in windows forms as below, I noticed that it doesn't takes any relative paths.

What is done below is that each time the PlayVideo Form Dialog opens it loads a new video which I was tracking using a global variable: GlobalVariablesTracking.videoTrack and incremented it after successfully loading a video.

private void PlayVideo_Load(object sender, EventArgs e)
 {
   CurrentVideoKey = GlobalVariablesTracking.videoTrack;
   currentVideoName = ConfigurationManager.AppSettings[CurrentVideoKey.ToString()];

 if (!String.IsNullOrEmpty(currentVideoName))
   {
     GlobalVariablesTracking.videoTrack = GlobalVariablesTracking.videoTrack + 1;
    axShockwaveFlash1.Movie = "\\Videos\\" + currentVideoName;
    axShockwaveFlash1.Play();                
   }
 }

Below are the Keys I read from App.Config

<add key="1" value="a.swf"/>
<add key="2" value="b.swf"/>
.....

The issue I encountered in the line:

axShockwaveFlash1.Movie = "\\Videos\\" + currentVideoName;

It doesn't takes relative path. If a complete absolute path is specified as below, it works perfectly.

axShockwaveFlash1.Movie = "C:\\Videos\\" + currentVideoName;

How to get this ShockWave flash object to work with a Relative URL ?

1

There are 1 best solutions below

0
On

Finally got this working.

The solution was to use Application.StartupPath and append to it the rest of your relative path.

axShockwaveFlash1.Movie = Application.StartupPath +"\\Videos\\"+ currentVideoPath;

This MSDN article was really helpful.