FlashVars won't work in VB

  • Thread starter Thread starter Anil Gupte/iCinema.com
  • Start date Start date
A

Anil Gupte/iCinema.com

I am trying to create a simple FlashPlayer in VB. I used the following:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim axShockwaveFlash As New AxShockwaveFlash

axShockwaveFlash.Location = New System.Drawing.Point(10, 10)

Me.Controls.Add(axShockwaveFlash)

axShockwaveFlash.Movie = "D:\Projects\Flash\Learning\Learning-2.swf"



axShockwaveFlash.Size = New System.Drawing.Size(400, 400)

Dim flvFileName As String = "D:\Video\Clips\PoliceBikeChase.flv"

Try

axShockwaveFlash.FlashVars = "flvurl=" & flvFileName

'axShockwaveFlash.CallFunction("<invoke name=""loadFLV""
returntype=""xml""><arguments><string>" + flvFileName +
"</string></arguments></invoke>")

' The above generates an error

Catch ex As Exception

End Try

axShockwaveFlash.Play()



End Sub

When I inspect FlashVars, it shows as blank, both before and after the
statement inside Try above. Also the commented out statement immediately
below that generates and error:

{"Error HRESULT E_FAIL has been returned from a call to a COM component."}
System.Exception

How do I get it to work?

Thanx in advance,
 
Try dropping the control on a form, from the toolbox, instead of creating it
in the form load event.

Dick
--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.
 
I am trying to create a simple FlashPlayer in VB. I used the following:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim axShockwaveFlash As New AxShockwaveFlash

axShockwaveFlash.Location = New System.Drawing.Point(10, 10)

Me.Controls.Add(axShockwaveFlash)

axShockwaveFlash.Movie = "D:\Projects\Flash\Learning\Learning-2.swf"

axShockwaveFlash.Size = New System.Drawing.Size(400, 400)

Dim flvFileName As String = "D:\Video\Clips\PoliceBikeChase.flv"

Try

axShockwaveFlash.FlashVars = "flvurl=" & flvFileName

'axShockwaveFlash.CallFunction("<invoke name=""loadFLV""
returntype=""xml""><arguments><string>" + flvFileName +
"</string></arguments></invoke>")

' The above generates an error

Catch ex As Exception

End Try

axShockwaveFlash.Play()

End Sub

When I inspect FlashVars, it shows as blank, both before and after the
statement inside Try above. Also the commented out statement immediately
below that generates and error:

{"Error HRESULT E_FAIL has been returned from a call to a COM component."}
System.Exception

How do I get it to work?

Thanx in advance,

Note that after adding Shockwave Flash Object control to your toolbox,
it has a bug with VS when you try to place it fails, and you need to
also reference OLE Automation in COM tab to solve error.

Formerly, i remember the problem was being solved by rebuilding
project more than one time, having flash9f, i couldn't confirm
rebuilding is a solution, but OLE Automation still works to make
Shockwave Flash Object work.

Hope this helps,

Onur Güzel
 
Yes, that is why I did not insert the control from the Toolbox (as Dick
suggested in the previous message) - it gives all kinds of errors. What
exactly do you mean by "reference OLE Automation in COM tab to solve
error."?

Thanx,
--
Anil Gupte
www.keeninc.net
www.icinema.com
www.wizo.tv
I am trying to create a simple FlashPlayer in VB. I used the following:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim axShockwaveFlash As New AxShockwaveFlash

axShockwaveFlash.Location = New System.Drawing.Point(10, 10)

Me.Controls.Add(axShockwaveFlash)

axShockwaveFlash.Movie = "D:\Projects\Flash\Learning\Learning-2.swf"

axShockwaveFlash.Size = New System.Drawing.Size(400, 400)

Dim flvFileName As String = "D:\Video\Clips\PoliceBikeChase.flv"

Try

axShockwaveFlash.FlashVars = "flvurl=" & flvFileName

'axShockwaveFlash.CallFunction("<invoke name=""loadFLV""
returntype=""xml""><arguments><string>" + flvFileName +
"</string></arguments></invoke>")

' The above generates an error

Catch ex As Exception

End Try

axShockwaveFlash.Play()

End Sub

When I inspect FlashVars, it shows as blank, both before and after the
statement inside Try above. Also the commented out statement immediately
below that generates and error:

{"Error HRESULT E_FAIL has been returned from a call to a COM component."}
System.Exception

How do I get it to work?

Thanx in advance,

Note that after adding Shockwave Flash Object control to your toolbox,
it has a bug with VS when you try to place it fails, and you need to
also reference OLE Automation in COM tab to solve error.

Formerly, i remember the problem was being solved by rebuilding
project more than one time, having flash9f, i couldn't confirm
rebuilding is a solution, but OLE Automation still works to make
Shockwave Flash Object work.

Hope this helps,

Onur Güzel
 
Yes, that is why I did not insert the control from the Toolbox (as Dick
suggested in the previous message) - it gives all kinds of errors. What
exactly do you mean by "reference OLE Automation in COM tab to solve
error."?

Thanx,
--















Note that after adding Shockwave Flash Object control to your toolbox,
it has a bug with VS when you try to place it fails, and you need to
also reference OLE Automation in COM tab to solve error.

Formerly, i remember the problem was being solved by rebuilding
project more than one time, having flash9f, i couldn't confirm
rebuilding is a solution, but OLE Automation still works to make
Shockwave Flash Object work.

Hope this helps,

Onur Güzel

After you added "Shockwave Flash Object" in your toolbox by right-
clicking -> "Choose Items" in Toolbox, also right-click your project
in Solution Explorer -> "add reference", look at "COM" tab, select
"OLE Automation" to add reference, then re-try placing the flash
control.

I don't know why, after updating flash to Flash9f.ocx, rebuilding does
not work anylonger but it seems OLE Automation does.

Thanks,

Onur Güzel
 
That worked! At least in part. Now the line:
AxShockwaveFlash.CallFunction("<invoke name=""loadFLV""
returntype=""xml""><arguments><string>" & flvFileName &
"</string></arguments></invoke>"

does not give an error message, Now I have to figure out how to write a
function in Flash (don't know much about Flash). But the FlashVars still
remain blank. Strange...

--
Anil Gupte
www.keeninc.net
www.icinema.com
www.wizo.tv
Yes, that is why I did not insert the control from the Toolbox (as Dick
suggested in the previous message) - it gives all kinds of errors. What
exactly do you mean by "reference OLE Automation in COM tab to solve
error."?

Thanx,
--
Anil Guptewww.keeninc.netwww.icinema.comwww.wizo.tv"kimiraikkonen"















Note that after adding Shockwave Flash Object control to your toolbox,
it has a bug with VS when you try to place it fails, and you need to
also reference OLE Automation in COM tab to solve error.

Formerly, i remember the problem was being solved by rebuilding
project more than one time, having flash9f, i couldn't confirm
rebuilding is a solution, but OLE Automation still works to make
Shockwave Flash Object work.

Hope this helps,

Onur Güzel

After you added "Shockwave Flash Object" in your toolbox by right-
clicking -> "Choose Items" in Toolbox, also right-click your project
in Solution Explorer -> "add reference", look at "COM" tab, select
"OLE Automation" to add reference, then re-try placing the flash
control.

I don't know why, after updating flash to Flash9f.ocx, rebuilding does
not work anylonger but it seems OLE Automation does.

Thanks,

Onur Güzel
 
I was mistaken, it doesn't work! I still get the same error - it just
happened to be in Try Catch without any handler. Also, could you point me
to a resource on how I could write the function LoadFLV in Flash?

Thanx,
--
Anil Gupte
www.keeninc.net
www.icinema.com
www.wizo.tv
Yes, that is why I did not insert the control from the Toolbox (as Dick
suggested in the previous message) - it gives all kinds of errors. What
exactly do you mean by "reference OLE Automation in COM tab to solve
error."?

Thanx,
--
Anil Guptewww.keeninc.netwww.icinema.comwww.wizo.tv"kimiraikkonen"















Note that after adding Shockwave Flash Object control to your toolbox,
it has a bug with VS when you try to place it fails, and you need to
also reference OLE Automation in COM tab to solve error.

Formerly, i remember the problem was being solved by rebuilding
project more than one time, having flash9f, i couldn't confirm
rebuilding is a solution, but OLE Automation still works to make
Shockwave Flash Object work.

Hope this helps,

Onur Güzel

After you added "Shockwave Flash Object" in your toolbox by right-
clicking -> "Choose Items" in Toolbox, also right-click your project
in Solution Explorer -> "add reference", look at "COM" tab, select
"OLE Automation" to add reference, then re-try placing the flash
control.

I don't know why, after updating flash to Flash9f.ocx, rebuilding does
not work anylonger but it seems OLE Automation does.

Thanks,

Onur Güzel
 
I was mistaken, it doesn't work!  I still get the same error - it just
happened to be in Try Catch without any handler.  Also, could you pointme
to a resource on how I could write the function LoadFLV in Flash?

Thanx,
--









After you added "Shockwave Flash Object" in your toolbox by right-
clicking -> "Choose Items" in Toolbox, also right-click your project
in Solution Explorer -> "add reference", look at "COM" tab, select
"OLE Automation" to add reference, then re-try placing the flash
control.

I don't know why, after updating flash to Flash9f.ocx, rebuilding does
not work anylonger but it seems OLE Automation does.

Thanks,

Onur Güzel- Hide quoted text -

- Show quoted text -

Ok, as you added flash control to your form also with referencing OLE
Automation, as far as i know it supports SWF extensions natively and
look at "Movie" at properties window of flash control and enter sth
like: http://www.domain.com/file.swf or a local swf path.

Flash player control may not be able to play FLV files alone as it may
require a FLV player which is needed to be embedded like in popular
video sharing websites.
http://en.wikipedia.org/wiki/Flash_Video#File_formats

Hope this helps,

Onur Güzel
 
Back
Top