.NET and the Shockwave Flash Object COM Component

G

Guest

Hello,

I am trying to reference a Shockwave Flash Object on a vb code behind page
in an ASP.NET project and I receive the following error:

Guid should contain 32 digits with 4 dashes
(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).

On the aspx page I have the object tag as follows:

<object id="FlashObj" name="FlashObj" runat="server"
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="550" height="400" VIEWASTEXT>
<param name="movie" value="formatTest.swf">
<param name="quality" value="high">
<embed src="formatTest.swf" quality="high"
pluginspage="http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash" width="550"
height="400"></embed></object>

On the code behind page I have:

Protected WithEvents FlashObj As ShockwaveFlashObjects.ShockwaveFlashClass

and then try to use the obeject in the following manner (on page load):

FlashObj.SetVariable("_root.testVar", "testvalue")

Any suggestions on what I'm doing wrong, or a better way to 'talk' back and
forth between .NET and Flash?

Thank you very much for your time.

Sincerely,

Keith
 
D

Dave

If you are only attempting to add <param> tags within the object tag, then there is no need to use a Flash object in the code
behind. Just use an HtmlGeneric control and add the <param> tags as sub controls of type LiteralControl.

GL
 
G

Guest

Dave,

Thanks for your reply.

I actually need to access the functions and methods of the ShockWave Object
in the code behind. I, at some point had declared in the code behind the
object as a generic html control, however I could not cast it to the
ShockWaveObj (it was a compile error). Do you have any other suggestions?

Again, thanks for your help.

-Keith
 
D

Dave

declared in the code behind the
object as a generic html control, however I could not cast it to the
ShockWaveObj (it was a compile error).

This is because ShockWaveObj does not derive from HtmlGenericControl. Also, you won't be able to create an instance of Flash on the
server using the <object> tag because it doesn't derive from System.Web.UI.Control.

Are you attempting to interface with the Flash object on the web page?

If you need to invoke methods on the client instance of the Flash object (on the web page), then use scripting.
ActiveX uses <param> tags as a means for setting properties declaratively for runtime on the client without having to use COM.
Scripting will allow you to invoke methods on the Flash COM object after it is loaded into a web page. Just set the ID property of
the object, and use it in scripting as if it is the ShockWaveObj you speak of.

If you invoke methods on the Flash object in server-side code it is going to occur on the server. I just want to make sure that you
understand the difference. I'm not sure that invoking methods on the server would affect the client runtime environment of a Flash
object in the way that you expect it to.


I hope it helps :)
 
G

Guest

Dave,

What I ultimately want to do is set a param value or pass a value into this
shockwave object on page load. The value is dynamic. Do you have
suggestions on an alternate approach?

Thanks for all your help with this.

-Keith

Dave said:
declared in the code behind the
object as a generic html control, however I could not cast it to the
ShockWaveObj (it was a compile error).


This is because ShockWaveObj does not derive from HtmlGenericControl. Also, you won't be able to create an instance of Flash on the
server using the <object> tag because it doesn't derive from System.Web.UI.Control.

Are you attempting to interface with the Flash object on the web page?

If you need to invoke methods on the client instance of the Flash object (on the web page), then use scripting.
ActiveX uses <param> tags as a means for setting properties declaratively for runtime on the client without having to use COM.
Scripting will allow you to invoke methods on the Flash COM object after it is loaded into a web page. Just set the ID property of
the object, and use it in scripting as if it is the ShockWaveObj you speak of.

If you invoke methods on the Flash object in server-side code it is going to occur on the server. I just want to make sure that you
understand the difference. I'm not sure that invoking methods on the server would affect the client runtime environment of a Flash
object in the way that you expect it to.


I hope it helps :)


--
Dave Sexton
[email protected]
-----------------------------------------------------------------------
Keith Rowe said:
Dave,

Thanks for your reply.

I actually need to access the functions and methods of the ShockWave Object
in the code behind. I, at some point had declared in the code behind the
object as a generic html control, however I could not cast it to the
ShockWaveObj (it was a compile error). Do you have any other suggestions?

Again, thanks for your help.

-Keith
 
D

Dave

Review my original post which I believe addresses your need.

I will add to my original post by saying that the value you pass in may be dynamic, since it can be calculated on the server side
and emitted as HTML using the basic control implementation:

Having the following HTML...

<object id="FlashObj" name="FlashObj" runat="server"
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"
width="550" height="400" >
<param name="movie" value="formatTest.swf">
<param name="quality" value="high">
</object>

....switch to Design View and VS.NET will add a property in the code behind for you. It will probably be Typed as
HtmlGenericControl:

private void System.Web.UI.HtmlControls.HtmlGenericControl FlashObj;

Now, you can do the following in the code-behind:

protected virtual void OnLoad(EventArgs e)
{
base.OnLoad(e);

HtmlGenericControl param = new HtmlGenericControl("PARAM");
FlashObj.Controls.Add(param);

param.Attributes["name"] = "dynamic_prop";
param.Attributes["value"] = "the value!";
}


When you compile this code and view it in a browser, if you click "View Source" you should see something close to the following at
the position in the page where you have the object HTML:

<object id="FlashObj" name="FlashObj" runat="server"
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"
width="550" height="400" >
<param name="movie" value="formatTest.swf">
<param name="quality" value="high">
<param name="dynamic_prop" value="the value!"></object>


--
Dave Sexton
[email protected]
-----------------------------------------------------------------------
Keith Rowe said:
Dave,

What I ultimately want to do is set a param value or pass a value into this
shockwave object on page load. The value is dynamic. Do you have
suggestions on an alternate approach?

Thanks for all your help with this.

-Keith

Dave said:
declared in the code behind the
object as a generic html control, however I could not cast it to the
ShockWaveObj (it was a compile error).


This is because ShockWaveObj does not derive from HtmlGenericControl. Also, you won't be able to create an instance of Flash on
the
server using the <object> tag because it doesn't derive from System.Web.UI.Control.

Are you attempting to interface with the Flash object on the web page?

If you need to invoke methods on the client instance of the Flash object (on the web page), then use scripting.
ActiveX uses <param> tags as a means for setting properties declaratively for runtime on the client without having to use COM.
Scripting will allow you to invoke methods on the Flash COM object after it is loaded into a web page. Just set the ID property
of
the object, and use it in scripting as if it is the ShockWaveObj you speak of.

If you invoke methods on the Flash object in server-side code it is going to occur on the server. I just want to make sure that
you
understand the difference. I'm not sure that invoking methods on the server would affect the client runtime environment of a
Flash
object in the way that you expect it to.


I hope it helps :)


--
Dave Sexton
[email protected]
-----------------------------------------------------------------------
Keith Rowe said:
Dave,

Thanks for your reply.

I actually need to access the functions and methods of the ShockWave Object
in the code behind. I, at some point had declared in the code behind the
object as a generic html control, however I could not cast it to the
ShockWaveObj (it was a compile error). Do you have any other suggestions?

Again, thanks for your help.

-Keith


:

If you are only attempting to add <param> tags within the object tag, then there is no need to use a Flash object in the code
behind. Just use an HtmlGeneric control and add the <param> tags as sub controls of type LiteralControl.

GL

--
Dave Sexton
[email protected]
-----------------------------------------------------------------------
Hello,

I am trying to reference a Shockwave Flash Object on a vb code behind page
in an ASP.NET project and I receive the following error:

Guid should contain 32 digits with 4 dashes
(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).

On the aspx page I have the object tag as follows:

<object id="FlashObj" name="FlashObj" runat="server"
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="550" height="400"
VIEWASTEXT>
<param name="movie" value="formatTest.swf">
<param name="quality" value="high">
<embed src="formatTest.swf" quality="high"
pluginspage="http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash" width="550"
height="400"></embed></object>

On the code behind page I have:

Protected WithEvents FlashObj As ShockwaveFlashObjects.ShockwaveFlashClass

and then try to use the obeject in the following manner (on page load):

FlashObj.SetVariable("_root.testVar", "testvalue")

Any suggestions on what I'm doing wrong, or a better way to 'talk' back and
forth between .NET and Flash?

Thank you very much for your time.

Sincerely,

Keith
 
G

Guest

Dave,

That solution makes sense to me, however, I still receive the GUID error
anytime I try to put the runat='server' tag on the object. If I take that
tag off, then I get a object reference not set to an instance of an object
(as one would expect trying to a reference an object on the codebhind that
does not have a runat='server' tag). Do you have any ideas on what causes
the guid error?

-Keith

Dave said:
Review my original post which I believe addresses your need.

I will add to my original post by saying that the value you pass in may be dynamic, since it can be calculated on the server side
and emitted as HTML using the basic control implementation:

Having the following HTML...

<object id="FlashObj" name="FlashObj" runat="server"
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"
width="550" height="400" >
<param name="movie" value="formatTest.swf">
<param name="quality" value="high">
</object>

....switch to Design View and VS.NET will add a property in the code behind for you. It will probably be Typed as
HtmlGenericControl:

private void System.Web.UI.HtmlControls.HtmlGenericControl FlashObj;

Now, you can do the following in the code-behind:

protected virtual void OnLoad(EventArgs e)
{
base.OnLoad(e);

HtmlGenericControl param = new HtmlGenericControl("PARAM");
FlashObj.Controls.Add(param);

param.Attributes["name"] = "dynamic_prop";
param.Attributes["value"] = "the value!";
}


When you compile this code and view it in a browser, if you click "View Source" you should see something close to the following at
the position in the page where you have the object HTML:

<object id="FlashObj" name="FlashObj" runat="server"
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"
width="550" height="400" >
<param name="movie" value="formatTest.swf">
<param name="quality" value="high">
<param name="dynamic_prop" value="the value!"></object>


--
Dave Sexton
[email protected]
-----------------------------------------------------------------------
Keith Rowe said:
Dave,

What I ultimately want to do is set a param value or pass a value into this
shockwave object on page load. The value is dynamic. Do you have
suggestions on an alternate approach?

Thanks for all your help with this.

-Keith

Dave said:
declared in the code behind the
object as a generic html control, however I could not cast it to the
ShockWaveObj (it was a compile error).

This is because ShockWaveObj does not derive from HtmlGenericControl. Also, you won't be able to create an instance of Flash on
the
server using the <object> tag because it doesn't derive from System.Web.UI.Control.

Are you attempting to interface with the Flash object on the web page?

If you need to invoke methods on the client instance of the Flash object (on the web page), then use scripting.
ActiveX uses <param> tags as a means for setting properties declaratively for runtime on the client without having to use COM.
Scripting will allow you to invoke methods on the Flash COM object after it is loaded into a web page. Just set the ID property
of
the object, and use it in scripting as if it is the ShockWaveObj you speak of.

If you invoke methods on the Flash object in server-side code it is going to occur on the server. I just want to make sure that
you
understand the difference. I'm not sure that invoking methods on the server would affect the client runtime environment of a
Flash
object in the way that you expect it to.


I hope it helps :)


--
Dave Sexton
[email protected]
-----------------------------------------------------------------------
Dave,

Thanks for your reply.

I actually need to access the functions and methods of the ShockWave Object
in the code behind. I, at some point had declared in the code behind the
object as a generic html control, however I could not cast it to the
ShockWaveObj (it was a compile error). Do you have any other suggestions?

Again, thanks for your help.

-Keith


:

If you are only attempting to add <param> tags within the object tag, then there is no need to use a Flash object in the code
behind. Just use an HtmlGeneric control and add the <param> tags as sub controls of type LiteralControl.

GL

--
Dave Sexton
[email protected]
-----------------------------------------------------------------------
Hello,

I am trying to reference a Shockwave Flash Object on a vb code behind page
in an ASP.NET project and I receive the following error:

Guid should contain 32 digits with 4 dashes
(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).

On the aspx page I have the object tag as follows:

<object id="FlashObj" name="FlashObj" runat="server"
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="550" height="400"
VIEWASTEXT>
<param name="movie" value="formatTest.swf">
<param name="quality" value="high">
<embed src="formatTest.swf" quality="high"
pluginspage="http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash" width="550"
height="400"></embed></object>

On the code behind page I have:

Protected WithEvents FlashObj As ShockwaveFlashObjects.ShockwaveFlashClass

and then try to use the obeject in the following manner (on page load):

FlashObj.SetVariable("_root.testVar", "testvalue")

Any suggestions on what I'm doing wrong, or a better way to 'talk' back and
forth between .NET and Flash?

Thank you very much for your time.

Sincerely,

Keith

 
D

Dave

I made a test web page to try out my solution and was supprised to find that I had the same error as you. To solve the GUID error,
you'll see the problem in the design view of the page that contains the object tag. Open it in design view, and check out the
properties window for the object itself. Notice the Clsid property in the window appears as:

clsid:clsid:D27CDB6E-AE6D-11cf-96B8-444553540000

This is obviously invalid.

Apparrently since the designer shows objects at design time, the "object" tag is a special tag that is parsed immediately and cannot
be ran on the server as an object. This means you can't use runat="server". Here is a different solution, although sloppy it will
do the trick:

Instead of adding an object tag to the HTML, add the following:

<asp:placeHolder Runat="server" ID="FlashObj" EnableViewState="False"></asp:placeHolder>


Open the form in the designer so that it creates a declaration for the placeholder control in the code-behind, or enter it manually:

protected System.Web.UI.WebControls.PlaceHolder FlashObj;

Add this code into your Page_Load event handler:

HtmlGenericControl flash = new HtmlGenericControl("OBJECT");
flash.Attributes["clsid"] = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
flash.Attributes["codebase"] = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0";
flash.Attributes["width"] = "550";
flash.Attributes["height"] = "400";

HtmlGenericControl param = new HtmlGenericControl("PARAM");
param.Attributes["name"] = "movie";
param.Attributes["value"] = "formatTest.swf";
flash.Controls.Add(param);

param = new HtmlGenericControl("PARAM");
param.Attributes["name"] = "quality";
param.Attributes["value"] = "high";
flash.Controls.Add(param);

LiteralControl embed = new LiteralControl(@"
<embed src=""formatTest.swf"" quality=""high""
pluginspage=""http://www.macromedia.com/go/getflashplayer""
type=""application/x-shockwave-flash"" width=""550""
height=""400""></embed>
");

flash.Controls.Add(embed);

FlashObj.Controls.Add(flash);


As you can see, you may now add as many parameters as you would like to, and the designer will not change the state of your HTML. I
tested this implementation and it worked for me.

--
Dave Sexton
[email protected]
-----------------------------------------------------------------------
Keith Rowe said:
Dave,

That solution makes sense to me, however, I still receive the GUID error
anytime I try to put the runat='server' tag on the object. If I take that
tag off, then I get a object reference not set to an instance of an object
(as one would expect trying to a reference an object on the codebhind that
does not have a runat='server' tag). Do you have any ideas on what causes
the guid error?

-Keith

Dave said:
Review my original post which I believe addresses your need.

I will add to my original post by saying that the value you pass in may be dynamic, since it can be calculated on the server side
and emitted as HTML using the basic control implementation:

Having the following HTML...

<object id="FlashObj" name="FlashObj" runat="server"
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"
width="550" height="400" >
<param name="movie" value="formatTest.swf">
<param name="quality" value="high">
</object>

....switch to Design View and VS.NET will add a property in the code behind for you. It will probably be Typed as
HtmlGenericControl:

private void System.Web.UI.HtmlControls.HtmlGenericControl FlashObj;

Now, you can do the following in the code-behind:

protected virtual void OnLoad(EventArgs e)
{
base.OnLoad(e);

HtmlGenericControl param = new HtmlGenericControl("PARAM");
FlashObj.Controls.Add(param);

param.Attributes["name"] = "dynamic_prop";
param.Attributes["value"] = "the value!";
}


When you compile this code and view it in a browser, if you click "View Source" you should see something close to the following
at
the position in the page where you have the object HTML:

<object id="FlashObj" name="FlashObj" runat="server"
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"
width="550" height="400" >
<param name="movie" value="formatTest.swf">
<param name="quality" value="high">
<param name="dynamic_prop" value="the value!"></object>


--
Dave Sexton
[email protected]
-----------------------------------------------------------------------
Keith Rowe said:
Dave,

What I ultimately want to do is set a param value or pass a value into this
shockwave object on page load. The value is dynamic. Do you have
suggestions on an alternate approach?

Thanks for all your help with this.

-Keith

:

declared in the code behind the
object as a generic html control, however I could not cast it to the
ShockWaveObj (it was a compile error).

This is because ShockWaveObj does not derive from HtmlGenericControl. Also, you won't be able to create an instance of Flash
on
the
server using the <object> tag because it doesn't derive from System.Web.UI.Control.

Are you attempting to interface with the Flash object on the web page?

If you need to invoke methods on the client instance of the Flash object (on the web page), then use scripting.
ActiveX uses <param> tags as a means for setting properties declaratively for runtime on the client without having to use COM.
Scripting will allow you to invoke methods on the Flash COM object after it is loaded into a web page. Just set the ID
property
of
the object, and use it in scripting as if it is the ShockWaveObj you speak of.

If you invoke methods on the Flash object in server-side code it is going to occur on the server. I just want to make sure
that
you
understand the difference. I'm not sure that invoking methods on the server would affect the client runtime environment of a
Flash
object in the way that you expect it to.


I hope it helps :)


--
Dave Sexton
[email protected]
-----------------------------------------------------------------------
Dave,

Thanks for your reply.

I actually need to access the functions and methods of the ShockWave Object
in the code behind. I, at some point had declared in the code behind the
object as a generic html control, however I could not cast it to the
ShockWaveObj (it was a compile error). Do you have any other suggestions?

Again, thanks for your help.

-Keith


:

If you are only attempting to add <param> tags within the object tag, then there is no need to use a Flash object in the
code
behind. Just use an HtmlGeneric control and add the <param> tags as sub controls of type LiteralControl.

GL

--
Dave Sexton
[email protected]
-----------------------------------------------------------------------
Hello,

I am trying to reference a Shockwave Flash Object on a vb code behind page
in an ASP.NET project and I receive the following error:

Guid should contain 32 digits with 4 dashes
(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).

On the aspx page I have the object tag as follows:

<object id="FlashObj" name="FlashObj" runat="server"
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="550" height="400"
VIEWASTEXT>
<param name="movie" value="formatTest.swf">
<param name="quality" value="high">
<embed src="formatTest.swf" quality="high"
pluginspage="http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash" width="550"
height="400"></embed></object>

On the code behind page I have:

Protected WithEvents FlashObj As ShockwaveFlashObjects.ShockwaveFlashClass

and then try to use the obeject in the following manner (on page load):

FlashObj.SetVariable("_root.testVar", "testvalue")

Any suggestions on what I'm doing wrong, or a better way to 'talk' back and
forth between .NET and Flash?

Thank you very much for your time.

Sincerely,

Keith

 
G

Guest

Dave,

That works just fine, thanks!

Now, the next level is, I need to be able to pass/set a variable to this
object when a user clicks a button. Is this possible? Rather, is it
possible to do this before the value the user entered in the flash object is
cleared out on the page reload?

-Keith

Dave said:
I made a test web page to try out my solution and was supprised to find that I had the same error as you. To solve the GUID error,
you'll see the problem in the design view of the page that contains the object tag. Open it in design view, and check out the
properties window for the object itself. Notice the Clsid property in the window appears as:

clsid:clsid:D27CDB6E-AE6D-11cf-96B8-444553540000

This is obviously invalid.

Apparrently since the designer shows objects at design time, the "object" tag is a special tag that is parsed immediately and cannot
be ran on the server as an object. This means you can't use runat="server". Here is a different solution, although sloppy it will
do the trick:

Instead of adding an object tag to the HTML, add the following:

<asp:placeHolder Runat="server" ID="FlashObj" EnableViewState="False"></asp:placeHolder>


Open the form in the designer so that it creates a declaration for the placeholder control in the code-behind, or enter it manually:

protected System.Web.UI.WebControls.PlaceHolder FlashObj;

Add this code into your Page_Load event handler:

HtmlGenericControl flash = new HtmlGenericControl("OBJECT");
flash.Attributes["clsid"] = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
flash.Attributes["codebase"] = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0";
flash.Attributes["width"] = "550";
flash.Attributes["height"] = "400";

HtmlGenericControl param = new HtmlGenericControl("PARAM");
param.Attributes["name"] = "movie";
param.Attributes["value"] = "formatTest.swf";
flash.Controls.Add(param);

param = new HtmlGenericControl("PARAM");
param.Attributes["name"] = "quality";
param.Attributes["value"] = "high";
flash.Controls.Add(param);

LiteralControl embed = new LiteralControl(@"
<embed src=""formatTest.swf"" quality=""high""
pluginspage=""http://www.macromedia.com/go/getflashplayer""
type=""application/x-shockwave-flash"" width=""550""
height=""400""></embed>
");

flash.Controls.Add(embed);

FlashObj.Controls.Add(flash);


As you can see, you may now add as many parameters as you would like to, and the designer will not change the state of your HTML. I
tested this implementation and it worked for me.

--
Dave Sexton
[email protected]
-----------------------------------------------------------------------
Keith Rowe said:
Dave,

That solution makes sense to me, however, I still receive the GUID error
anytime I try to put the runat='server' tag on the object. If I take that
tag off, then I get a object reference not set to an instance of an object
(as one would expect trying to a reference an object on the codebhind that
does not have a runat='server' tag). Do you have any ideas on what causes
the guid error?

-Keith

Dave said:
Review my original post which I believe addresses your need.

I will add to my original post by saying that the value you pass in may be dynamic, since it can be calculated on the server side
and emitted as HTML using the basic control implementation:

Having the following HTML...

<object id="FlashObj" name="FlashObj" runat="server"
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"
width="550" height="400" >
<param name="movie" value="formatTest.swf">
<param name="quality" value="high">
</object>

....switch to Design View and VS.NET will add a property in the code behind for you. It will probably be Typed as
HtmlGenericControl:

private void System.Web.UI.HtmlControls.HtmlGenericControl FlashObj;

Now, you can do the following in the code-behind:

protected virtual void OnLoad(EventArgs e)
{
base.OnLoad(e);

HtmlGenericControl param = new HtmlGenericControl("PARAM");
FlashObj.Controls.Add(param);

param.Attributes["name"] = "dynamic_prop";
param.Attributes["value"] = "the value!";
}


When you compile this code and view it in a browser, if you click "View Source" you should see something close to the following
at
the position in the page where you have the object HTML:

<object id="FlashObj" name="FlashObj" runat="server"
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"
width="550" height="400" >
<param name="movie" value="formatTest.swf">
<param name="quality" value="high">
<param name="dynamic_prop" value="the value!"></object>


--
Dave Sexton
[email protected]
-----------------------------------------------------------------------
Dave,

What I ultimately want to do is set a param value or pass a value into this
shockwave object on page load. The value is dynamic. Do you have
suggestions on an alternate approach?

Thanks for all your help with this.

-Keith

:

declared in the code behind the
object as a generic html control, however I could not cast it to the
ShockWaveObj (it was a compile error).

This is because ShockWaveObj does not derive from HtmlGenericControl. Also, you won't be able to create an instance of Flash
on
the
server using the <object> tag because it doesn't derive from System.Web.UI.Control.

Are you attempting to interface with the Flash object on the web page?

If you need to invoke methods on the client instance of the Flash object (on the web page), then use scripting.
ActiveX uses <param> tags as a means for setting properties declaratively for runtime on the client without having to use COM.
Scripting will allow you to invoke methods on the Flash COM object after it is loaded into a web page. Just set the ID
property
of
the object, and use it in scripting as if it is the ShockWaveObj you speak of.

If you invoke methods on the Flash object in server-side code it is going to occur on the server. I just want to make sure
that
you
understand the difference. I'm not sure that invoking methods on the server would affect the client runtime environment of a
Flash
object in the way that you expect it to.


I hope it helps :)


--
Dave Sexton
[email protected]
-----------------------------------------------------------------------
Dave,

Thanks for your reply.

I actually need to access the functions and methods of the ShockWave Object
in the code behind. I, at some point had declared in the code behind the
object as a generic html control, however I could not cast it to the
ShockWaveObj (it was a compile error). Do you have any other suggestions?

Again, thanks for your help.

-Keith


:

If you are only attempting to add <param> tags within the object tag, then there is no need to use a Flash object in the
code
behind. Just use an HtmlGeneric control and add the <param> tags as sub controls of type LiteralControl.

GL

--
Dave Sexton
[email protected]
-----------------------------------------------------------------------
Hello,

I am trying to reference a Shockwave Flash Object on a vb code behind page
in an ASP.NET project and I receive the following error:

Guid should contain 32 digits with 4 dashes
(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).

On the aspx page I have the object tag as follows:

<object id="FlashObj" name="FlashObj" runat="server"
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="550" height="400"
VIEWASTEXT>
<param name="movie" value="formatTest.swf">
<param name="quality" value="high">
<embed src="formatTest.swf" quality="high"
pluginspage="http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash" width="550"
height="400"></embed></object>

On the code behind page I have:

Protected WithEvents FlashObj As ShockwaveFlashObjects.ShockwaveFlashClass

and then try to use the obeject in the following manner (on page load):

FlashObj.SetVariable("_root.testVar", "testvalue")

Any suggestions on what I'm doing wrong, or a better way to 'talk' back and
forth between .NET and Flash?

Thank you very much for your time.

Sincerely,

Keith

 
D

Dave

I would recommend that you code against the flash object on the client (using scripting). You'll have to look into scripting
against the flash COM object... I'm sure it can be done using JavaScript or VBScript.

Handle the onclick event in the browser (no post-back) using scripting for the "button" you speak of and then "talk" to flash and do
what's required by your app. Again, you'll have to research how you can communicate with Flash via scripting.

--
Dave Sexton
[email protected]
-----------------------------------------------------------------------
Keith Rowe said:
Dave,

That works just fine, thanks!

Now, the next level is, I need to be able to pass/set a variable to this
object when a user clicks a button. Is this possible? Rather, is it
possible to do this before the value the user entered in the flash object is
cleared out on the page reload?

-Keith

Dave said:
I made a test web page to try out my solution and was supprised to find that I had the same error as you. To solve the GUID
error,
you'll see the problem in the design view of the page that contains the object tag. Open it in design view, and check out the
properties window for the object itself. Notice the Clsid property in the window appears as:

clsid:clsid:D27CDB6E-AE6D-11cf-96B8-444553540000

This is obviously invalid.

Apparrently since the designer shows objects at design time, the "object" tag is a special tag that is parsed immediately and
cannot
be ran on the server as an object. This means you can't use runat="server". Here is a different solution, although sloppy it
will
do the trick:

Instead of adding an object tag to the HTML, add the following:

<asp:placeHolder Runat="server" ID="FlashObj" EnableViewState="False"></asp:placeHolder>


Open the form in the designer so that it creates a declaration for the placeholder control in the code-behind, or enter it
manually:

protected System.Web.UI.WebControls.PlaceHolder FlashObj;

Add this code into your Page_Load event handler:

HtmlGenericControl flash = new HtmlGenericControl("OBJECT");
flash.Attributes["clsid"] = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
flash.Attributes["codebase"] = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0";
flash.Attributes["width"] = "550";
flash.Attributes["height"] = "400";

HtmlGenericControl param = new HtmlGenericControl("PARAM");
param.Attributes["name"] = "movie";
param.Attributes["value"] = "formatTest.swf";
flash.Controls.Add(param);

param = new HtmlGenericControl("PARAM");
param.Attributes["name"] = "quality";
param.Attributes["value"] = "high";
flash.Controls.Add(param);

LiteralControl embed = new LiteralControl(@"
<embed src=""formatTest.swf"" quality=""high""
pluginspage=""http://www.macromedia.com/go/getflashplayer""
type=""application/x-shockwave-flash"" width=""550""
height=""400""></embed>
");

flash.Controls.Add(embed);

FlashObj.Controls.Add(flash);


As you can see, you may now add as many parameters as you would like to, and the designer will not change the state of your HTML.
I
tested this implementation and it worked for me.

--
Dave Sexton
[email protected]
-----------------------------------------------------------------------
Keith Rowe said:
Dave,

That solution makes sense to me, however, I still receive the GUID error
anytime I try to put the runat='server' tag on the object. If I take that
tag off, then I get a object reference not set to an instance of an object
(as one would expect trying to a reference an object on the codebhind that
does not have a runat='server' tag). Do you have any ideas on what causes
the guid error?

-Keith

:

Review my original post which I believe addresses your need.

I will add to my original post by saying that the value you pass in may be dynamic, since it can be calculated on the server
side
and emitted as HTML using the basic control implementation:

Having the following HTML...

<object id="FlashObj" name="FlashObj" runat="server"
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"
width="550" height="400" >
<param name="movie" value="formatTest.swf">
<param name="quality" value="high">
</object>

....switch to Design View and VS.NET will add a property in the code behind for you. It will probably be Typed as
HtmlGenericControl:

private void System.Web.UI.HtmlControls.HtmlGenericControl FlashObj;

Now, you can do the following in the code-behind:

protected virtual void OnLoad(EventArgs e)
{
base.OnLoad(e);

HtmlGenericControl param = new HtmlGenericControl("PARAM");
FlashObj.Controls.Add(param);

param.Attributes["name"] = "dynamic_prop";
param.Attributes["value"] = "the value!";
}


When you compile this code and view it in a browser, if you click "View Source" you should see something close to the
following
at
the position in the page where you have the object HTML:

<object id="FlashObj" name="FlashObj" runat="server"
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"
width="550" height="400" >
<param name="movie" value="formatTest.swf">
<param name="quality" value="high">
<param name="dynamic_prop" value="the value!"></object>


--
Dave Sexton
[email protected]
-----------------------------------------------------------------------
Dave,

What I ultimately want to do is set a param value or pass a value into this
shockwave object on page load. The value is dynamic. Do you have
suggestions on an alternate approach?

Thanks for all your help with this.

-Keith

:

declared in the code behind the
object as a generic html control, however I could not cast it to the
ShockWaveObj (it was a compile error).

This is because ShockWaveObj does not derive from HtmlGenericControl. Also, you won't be able to create an instance of
Flash
on
the
server using the <object> tag because it doesn't derive from System.Web.UI.Control.

Are you attempting to interface with the Flash object on the web page?

If you need to invoke methods on the client instance of the Flash object (on the web page), then use scripting.
ActiveX uses <param> tags as a means for setting properties declaratively for runtime on the client without having to use
COM.
Scripting will allow you to invoke methods on the Flash COM object after it is loaded into a web page. Just set the ID
property
of
the object, and use it in scripting as if it is the ShockWaveObj you speak of.

If you invoke methods on the Flash object in server-side code it is going to occur on the server. I just want to make sure
that
you
understand the difference. I'm not sure that invoking methods on the server would affect the client runtime environment of
a
Flash
object in the way that you expect it to.


I hope it helps :)


--
Dave Sexton
[email protected]
-----------------------------------------------------------------------
Dave,

Thanks for your reply.

I actually need to access the functions and methods of the ShockWave Object
in the code behind. I, at some point had declared in the code behind the
object as a generic html control, however I could not cast it to the
ShockWaveObj (it was a compile error). Do you have any other suggestions?

Again, thanks for your help.

-Keith


:

If you are only attempting to add <param> tags within the object tag, then there is no need to use a Flash object in the
code
behind. Just use an HtmlGeneric control and add the <param> tags as sub controls of type LiteralControl.

GL

--
Dave Sexton
[email protected]
-----------------------------------------------------------------------
Hello,

I am trying to reference a Shockwave Flash Object on a vb code behind page
in an ASP.NET project and I receive the following error:

Guid should contain 32 digits with 4 dashes
(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).

On the aspx page I have the object tag as follows:

<object id="FlashObj" name="FlashObj" runat="server"
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="550"
height="400"
VIEWASTEXT>
<param name="movie" value="formatTest.swf">
<param name="quality" value="high">
<embed src="formatTest.swf" quality="high"
pluginspage="http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash" width="550"
height="400"></embed></object>

On the code behind page I have:

Protected WithEvents FlashObj As ShockwaveFlashObjects.ShockwaveFlashClass

and then try to use the obeject in the following manner (on page load):

FlashObj.SetVariable("_root.testVar", "testvalue")

Any suggestions on what I'm doing wrong, or a better way to 'talk' back and
forth between .NET and Flash?

Thank you very much for your time.

Sincerely,

Keith

 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top