Solved

Cannot get .wmv files to Download Properly, navigateToURL, download() method

Posted on 2008-10-01
9
717 Views
Last Modified: 2013-12-07
I have wmv files that i need available for download from an swf (both swf and .wmv's will be on a DVD or CD). The wmv files are in a folder named WMV which is at the same level as the swf. I just want the user to be able to click on a button and select "Save As" and download the file. I've been trying to use the download() method but keep getting IO Errors and also tried using navigateToURL but it tries to download it through firefox (no "Save As" option, just tries to open with Windows Media Player) and windows media player says it can't find the file.

I'm sure I'm probably missing something very simple, but I'm new to AS 3, and Any help would be Awesome!
Thanks!!
0
Comment
Question by:somers3135
  • 5
  • 4
9 Comments
 
LVL 37

Expert Comment

by:CyanBlue
ID: 22617504
Create a dummy.zip file in the same directory where you have the WMV file stored...  Replace the file name with the dummy.zip file to see if that works with the download() function...  
If that works, there is a chance where the web server prohibits downloading the WMV file type...
If that does not work, there is problem with either the path of the file or the script itself...

The navigateToURL() function relies on the web browser to initiate the given protocol, so it is natural to open up that file with the application of the associated MIME type...

CyanBlue
0
 

Author Comment

by:somers3135
ID: 22619291
Thanks for the Reply CyanBlue!

'm lookin all over for a solution and it seems like the FileReference.download is the way to go, but even Adobe's Solution is not working.

http://kb.adobe.com/selfservice/viewContent.do?externalId=3637d5c3

If i keep it like they have it, I get errors that it only accepts http or https. Then, if i put in the http://, it shows the download dialog box, but after i click save it either gives me the Unhandled IOErrorEvent message, or it doesn't do anything, just like the link describes. I'm totally lost. Here is the relevant code I'm using.  

var fileReference:FileReference = new FileReference();

function myFunction(event:MouseEvent):void
{
      var urlRequest:URLRequest = new URLRequest("http://dummy.zip");
      fileReference.download(urlRequest);
}
this code currently displays the Unhandled Error Event

I've tried putting the code exactly like it is on the link provided, but same thing.

p.s. - dummy.zip did not work
0
 
LVL 37

Expert Comment

by:CyanBlue
ID: 22620721
Try this and see what happens...  Make sure that you are providing the full URL to the dummy.zip file...

CyanBlue
var fileRef:FileReference = new FileReference();

function downloadFile(e:MouseEvent):void

{

	fileRef.download(new URLRequest("http://www.domain.com/dummy.zip"), "dummy.zip");

}
 

download_btn.addEventListener(MouseEvent.MOUSE_DOWN, downloadFile);

Open in new window

0
 

Author Comment

by:somers3135
ID: 22623762

Almost There!! Where did you get www.domain.com from?? :)    So the dummy.zip works but when I try to use a .wmv, It appears as though it has worked until I try to open it, I get an error from windows media player saying that "The file you are attempting to play has an extension that does not match the file format." The saved file is also only a fraction of the size as the original.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 37

Expert Comment

by:CyanBlue
ID: 22623838
I guess you will have to provide the full URL when using the FileReference...  I've used it like that without doubting it till now...  ;)

I think it has to do with your server setting the MIME type of the WMV file to a streaming media or sort...  That's why it is invoking the Windows Media Player to try to open up the file...  I suggest you either use a server side script to force the file downloading the WMV file or simply ZIP up the file to make it downloadable file...

CyanBlue
0
 

Author Comment

by:somers3135
ID: 22624027
I just tried it again but with an .FLA and the same thing happened, also tried zipping a file, but no luck, is it  just pulling the filename?  Know of any good tutorials or places to learn the server side script to force download? (never worked with that before)
0
 
LVL 37

Accepted Solution

by:
CyanBlue earned 500 total points
ID: 22625134
It's not as easy as pie, but you can try this PHP solution...
     http://www.boutell.com/newfaq/creating/forcedownload.html

CyanBlue
0
 

Author Closing Comment

by:somers3135
ID: 31502459
looks like I'm movin back to AS 2.0 for now, the project leader says that the links need to download the wmv's directly, can't be inside a zip file, although i did get the zips to work with the navigateToURL.  Thanks for all your help Cyan, probly need some help with the server side scripts pretty soon!
0
 
LVL 37

Expert Comment

by:CyanBlue
ID: 22626338
Dang...  That sucks...  :(

CyanBlue
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Citrix and Internet Explorer Problem 3 110
What is Chrome doing in processes that use high CPU but aren't web pages? 14 92
Firebug on Firefox 50 2 71
yahoo Hacks 9 94
Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
Bada platform is becoming more and more famous this days and people talking about same. Some friends included those who have bada OS mobile asked me "what is bada?"and "what its features?". That encouraged me to research and write this article. [st…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now