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
27CDB6E-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
27CDB6E-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="clsid27CDB6E-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