Solved

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

Posted on 2008-10-01
9
716 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Several part series to implement Internet Explorer 11 Enterprise Mode
SSL stands for “Secure Sockets Layer” and an SSL certificate is a critical component to keeping your website safe, secured, and compliant. Any ecommerce website must have an SSL certificate to ensure the safe handling of sensitive information like…
This Micro Tutorial will demonstrate how to add subdomains to your content reports. This can be very importing in having a site with multiple subdomains.
How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…

707 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

15 Experts available now in Live!

Get 1:1 Help Now