how to update shockwave movie
I am working on a shockwave player in my VB app. It draws its source from an XML file stored locally. I use a directory and file list box to find the flv file that plays in the shockwave movie. I need a way to refresh the shockwave component so when I click on a new flv file that file plays. This is my code sofar.
Is there away to refresh the sockwave?
VB Code:
Option Explicit
'makes it necessary to specify variables
'and makes sure no variable used twice
Private Function CreateDOM()
Dim dom
Set dom = New DOMDocument30
dom.async = False
dom.validateOnParse = False
dom.resolveExternals = False
dom.preserveWhiteSpace = True
Set CreateDOM = dom
End Function
Private Sub File1_Click()
Dim dom, node, frag, cd, attr
On Error GoTo ErrorHandler
Set dom = CreateDOM
' Create a processing instruction targeted for xml.
Set node = dom.createProcessingInstruction("xml", "version='1.0' encoding='UTF-8'")
dom.appendChild node
Set node = Nothing
' Create a comment for the document.
Set node = dom.createComment("sample xml file created using XML DOM object.")
dom.appendChild node
Set node = Nothing
' Create the root element.
Dim root
Set root = dom.createElement("videos")
' Add the root element to the DOM instance.
dom.appendChild root
' Insert a newline + tab.
root.appendChild dom.createTextNode(vbNewLine + vbTab)
' Create and add more nodes to the root element just created.
' Create a text element.
Set node = dom.createElement("video")
'node.Text = "some character data"
node.Text = File1.FileName
' Add text node to the root element.
root.appendChild node
Set node = Nothing
' Add a newline plus tab.
root.appendChild dom.createTextNode(vbNewLine + vbTab)
' Save the XML document to a file.
dom.save App.Path + "\flv.xml"
Set root = Nothing
Set dom = Nothing
Exit Sub
ErrorHandler:
MsgBox Err.Description
End Sub
Private Sub Form_Load()
'play shockwav movie
ShockwaveFlash1.Movie = App.Path & "\XML_FLV_player.swf"
End Sub
'search for flv file
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
File1.Pattern = "*.flv"
End Sub
Re: how to update shockwave movie
Well, I am not having any luck here. I have tried to refresh the form but that didn't work. There must be away to get the shockwave component to play another movie without restarting the application. Any ideas?
Re: how to update shockwave movie
I used shockwave for a splash screen in a program I made. You should be able to load in another movie and play it.
If you have included your shockwave flash component into your toolbox, and added it to your form. The code may look like this.
Form.ShockwaveFlashControlName.LoadMovie 1, FlashLocation (can be path on pc or url)
Form.ShockwaveFlashControlName.Movie = FlashLocation
Form.ShockwaveFlashControlName.GotoFrame 1
Form.ShockwaveFlashControlName.Loop = False (your preference)
Form.ShockwaveFlashControlName.Play
This is the type of code I have used in my application. I am not an expert, but I found this code works for me.
Hope this helps.
Re: how to update shockwave movie
thanks for the tips, here is what I have and it loads the flvs into my swf perfectly.
VB Code:
Call ShockwaveFlash1.LoadMovie(1, App.Path & "\XML_FLV_player.swf")
ShockwaveFlash1.Movie = App.Path & "\XML_FLV_player.swf"
The only thing is, if there is audio or music in the flash movie, when I load a new movie in the sound doesn't stop, it just keeps going. Eventually I end up with mutiple sound tracks overlaying one another.
I have run into that before?