|
-
Jun 1st, 2006, 03:34 PM
#1
Thread Starter
Fanatic Member
reload shockwave component?
Is there a way to reload the shockwave component?
I have a shockwave component on my form and a button. When I click the button it opens a filedialog which lets me find the flv file to play. In the same click action I write an xml file with the flv name and the shockwave plays the movie.
If I click on the button again while the movie is playing and select another flv, the xml file is updated but the shockwave component won't play the new selection. I have to close the application and restart inorder for the application to play the new selection.
how can I correct this?
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sReplaceChar As String
sReplaceChar = ""
' Displays an OpenFileDialog so the user can select a Cursor.
Dim openFileDialog1 As New OpenFileDialog
openFileDialog1.Filter = "Flash Video Files|*.flv"
openFileDialog1.Title = "Select a FLV File"
If openFileDialog1.ShowDialog() = DialogResult.OK Then
Dim sr As New System.IO.StreamReader(openFileDialog1.FileName)
'MessageBox.Show(sr.ReadToEnd)
sr.Close()
End If
' Create a new file in C:\\ dir
Dim textWriter As XmlTextWriter = New XmlTextWriter(Application.StartupPath & "\flv.xml", Nothing)
' Opens the document
textWriter.WriteStartDocument()
' Write comments
'textWriter.WriteComment("First Comment XmlTextWriter SampleExample(")
'textWriter.WriteComment("myXmlFile.xml in root dir")
' Write first element
textWriter.WriteStartElement("Videos")
' Write next element
textWriter.WriteStartElement("video", "")
'textWriter.WriteString("Student")
'find and replace \ with / for flash
sReplaceChar = (openFileDialog1.FileName)
sReplaceChar = Replace(sReplaceChar, "\", "/")
textWriter.WriteString(sReplaceChar)
textWriter.WriteEndElement()
' Ends the document.
textWriter.WriteEndDocument()
' close writer
textWriter.Close()
'showckwave movie
'AxShockwaveFlash1.Movie(App.Path & "\XML_FLV_player.swf")
AxShockwaveFlash1.Movie = Application.StartupPath & "\XML_FLV_player.swf"
End Sub
He who never made a mistake never made a discovery?
-
Jun 2nd, 2006, 09:09 AM
#2
Thread Starter
Fanatic Member
Re: reload shockwave component?
I made some progress but not 100% effective. I added the following line of code which effectively loads a new movie but doesn't remove the current movie thats playing.
I tried AxShockwaveFlash1.stop, refresh, stopPlay, I have set the layer to 0 and they do not have any effect.
Any ideas?
VB Code:
'showckwave(movie)
AxShockwaveFlash1.LoadMovie(1, Application.StartupPath & "\XML_FLV_player.swf")
AxShockwaveFlash1.Movie = Application.StartupPath & "\XML_FLV_player.swf"
He who never made a mistake never made a discovery?
-
Jun 3rd, 2006, 03:47 AM
#3
Addicted Member
Re: reload shockwave component?
Hi,
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
AxShockwaveFlash1.Show()
AxShockwaveFlash1.Movie = Application.StartupPath & "\MyFile.swf"
AxShockwaveFlash1.Play()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
AxShockwaveFlash1.Hide()
AxShockwaveFlash1.Rewind()
AxShockwaveFlash1.Stop()
End Sub
I have a question:
Why I can't make a add references to:
"AxShockwaveFlash" in Microsoft Visual Basic 2005 Express Edition
I found the answer at the next link:
http://blogs.vbcity.com/drydo/archiv...2/07/5731.aspx
Last edited by yulyos; Jun 3rd, 2006 at 07:51 AM.
-
Jun 5th, 2006, 09:00 AM
#4
Thread Starter
Fanatic Member
Re: reload shockwave component?
The code you posted does not work. I have ttried several times but with no luck.
He who never made a mistake never made a discovery?
-
Jun 5th, 2006, 11:36 AM
#5
Addicted Member
Re: reload shockwave component?
Hi,
It's working in my computer OK !!!
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
AxShockwaveFlash1.Show()
AxShockwaveFlash1.Movie = Application.StartupPath & "\MyFile.swf"
AxShockwaveFlash1.Play()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
AxShockwaveFlash1.Hide()
AxShockwaveFlash1.Rewind()
AxShockwaveFlash1.Stop()
End Sub
-
Jun 5th, 2006, 12:39 PM
#6
Thread Starter
Fanatic Member
Re: reload shockwave component?
Ah... well remember I am loading in a XML file that contains a different FLV, or flash video file that my XML_FLV_player.swf plays. For some reason the shockwave component or the actual swf is not reaccquiring the XML after it has changed.
I was thinking though that I might need two seperate shockwave components on my form, when I make a new selection that new selection would play in the second shockwave, if I make another selection that selection would play in the first shockwave component, thus alternating back and forth.
I dont know how to code that myself.
Last edited by Navarone; Jun 5th, 2006 at 12:46 PM.
He who never made a mistake never made a discovery?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|