[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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

Posted on 2008-10-01
9
Medium Priority
?
724 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

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
 
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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

#Citrix #Internet Explorer #Enterprise Mode #IE 11 #IE 8
Several part series to implement Internet Explorer 11 Enterprise Mode
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
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.

649 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