i have a flash document that we use on a website that has accepts variables past to it using setvariable in javascript.
What i want to be able to do is to be able to programatically pass variables to the doc then save it, then do the same for a batch.
I know that the .swf also accepts variables passed in the querystring so i thought i would just be able to hit the document directly with the variables in the querystring then save the doc to disk.
the code below tries to do this, but the document i end up with at the end is just the blank document as if no variables have been passed. does anyone know of a better way to programmatically pass in varioables ot a .swf so that the file can be saved?
Code:Imports System.Net Imports System.Text Namespace NetFileStream Public Class FileToDownload Dim strURLToDownload As String Const PREFIX = "http://" Public Sub New(ByVal sURL As String) Me.strURLToDownload = sURL End Sub Public Function BeginDownload() As MemoryStream Dim msFile As MemoryStream Dim wcClient As WebClient = New WebClient If Not strURLToDownload.ToLower().StartsWith("http://") Then strURLToDownload = PREFIX + strURLToDownload End If msFile = New MemoryStream(wcClient.DownloadData(strURLToDownload)) Return msFile End Function End Class End Namespace Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim strFileToDownloadPath As String strFileToDownloadPath = "http://thingy/statement.swf?name=mr andrew cotton" Dim fileStream As NetFileStream.FileToDownload = New NetFileStream.FileToDownload(strFileToDownloadPath) Dim msStream As MemoryStream = fileStream.BeginDownload() 'now need to save file from memory stream Dim fs As FileStream = New FileStream("c:\statement.swf", FileMode.Create, FileAccess.Write) 'msStream.Write() msStream.WriteTo(fs) msStream.Close() fs.Flush() fs.Close() MessageBox.Show("done") End Sub


Reply With Quote