Results 1 to 6 of 6

Thread: reload shockwave component?

  1. #1

    Thread Starter
    Fanatic Member Navarone's Avatar
    Join Date
    Jun 2003
    Location
    Akron, Ohio USA
    Posts
    740

    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:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.  
    3.         Dim sReplaceChar As String
    4.         sReplaceChar = ""
    5.  
    6.         ' Displays an OpenFileDialog so the user can select a Cursor.
    7.         Dim openFileDialog1 As New OpenFileDialog
    8.         openFileDialog1.Filter = "Flash Video Files|*.flv"
    9.         openFileDialog1.Title = "Select a FLV File"
    10.  
    11.         If openFileDialog1.ShowDialog() = DialogResult.OK Then
    12.             Dim sr As New System.IO.StreamReader(openFileDialog1.FileName)
    13.             'MessageBox.Show(sr.ReadToEnd)
    14.             sr.Close()
    15.         End If
    16.  
    17.  
    18.         ' Create a new file in C:\\ dir
    19.         Dim textWriter As XmlTextWriter = New XmlTextWriter(Application.StartupPath & "\flv.xml", Nothing)
    20.  
    21.         ' Opens the document
    22.         textWriter.WriteStartDocument()
    23.  
    24.         ' Write comments
    25.         'textWriter.WriteComment("First Comment XmlTextWriter SampleExample(")
    26.         'textWriter.WriteComment("myXmlFile.xml in root dir")
    27.  
    28.  
    29.         ' Write first element
    30.         textWriter.WriteStartElement("Videos")
    31.  
    32.         ' Write next element
    33.         textWriter.WriteStartElement("video", "")
    34.         'textWriter.WriteString("Student")
    35.  
    36.         'find and replace \ with / for flash
    37.         sReplaceChar = (openFileDialog1.FileName)
    38.         sReplaceChar = Replace(sReplaceChar, "\", "/")
    39.  
    40.         textWriter.WriteString(sReplaceChar)
    41.         textWriter.WriteEndElement()
    42.  
    43.  
    44.         ' Ends the document.
    45.         textWriter.WriteEndDocument()
    46.         ' close writer
    47.         textWriter.Close()
    48.  
    49.         'showckwave movie
    50.         'AxShockwaveFlash1.Movie(App.Path & "\XML_FLV_player.swf")
    51.  
    52.         AxShockwaveFlash1.Movie = Application.StartupPath & "\XML_FLV_player.swf"
    53.  
    54.     End Sub
    He who never made a mistake never made a discovery?

  2. #2

    Thread Starter
    Fanatic Member Navarone's Avatar
    Join Date
    Jun 2003
    Location
    Akron, Ohio USA
    Posts
    740

    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:
    1. 'showckwave(movie)
    2.         AxShockwaveFlash1.LoadMovie(1, Application.StartupPath & "\XML_FLV_player.swf")
    3.         AxShockwaveFlash1.Movie = Application.StartupPath & "\XML_FLV_player.swf"
    He who never made a mistake never made a discovery?

  3. #3
    Addicted Member
    Join Date
    Aug 2002
    Posts
    224

    Re: reload shockwave component?

    Hi,

    VB Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.         AxShockwaveFlash1.Show()
    3.         AxShockwaveFlash1.Movie = Application.StartupPath & "\MyFile.swf"
    4.         AxShockwaveFlash1.Play()
    5.     End Sub
    6.     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    7.         AxShockwaveFlash1.Hide()
    8.         AxShockwaveFlash1.Rewind()
    9.         AxShockwaveFlash1.Stop()
    10.     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.

  4. #4

    Thread Starter
    Fanatic Member Navarone's Avatar
    Join Date
    Jun 2003
    Location
    Akron, Ohio USA
    Posts
    740

    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?

  5. #5
    Addicted Member
    Join Date
    Aug 2002
    Posts
    224

    Re: reload shockwave component?

    Hi,

    It's working in my computer OK !!!

    VB Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.         AxShockwaveFlash1.Show()
    3.         AxShockwaveFlash1.Movie = Application.StartupPath & "\MyFile.swf"
    4.         AxShockwaveFlash1.Play()
    5.     End Sub
    6.     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    7.         AxShockwaveFlash1.Hide()
    8.         AxShockwaveFlash1.Rewind()
    9.         AxShockwaveFlash1.Stop()
    10.     End Sub

  6. #6

    Thread Starter
    Fanatic Member Navarone's Avatar
    Join Date
    Jun 2003
    Location
    Akron, Ohio USA
    Posts
    740

    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
  •  



Click Here to Expand Forum to Full Width