In message <11**********************@f14g2000cwb.googlegroups .com>,
trint <tr***********@gmail.com> writes
Ok,
I have created a flash animated button that I want to use as a regular
button in my c# web app.
Using actionscript, do you know how to call the c# functions in the
project?
I'm not sure you want or need to do that, if you want to use it as a
regular button. All you need to do is to make clicking on the button
generate a server-side event via a postback.
Subclass Panel and implement IPostBackEventHandler.
Add a Click event:
public event ImageClickEventHandler Click;
In CreateChildControls, create a literal containing the HTML to display
your Flash object and add it to controls.
When creating the HTML, use
this.Page.GetPostBackClientEvent(this,"")
to get the text of a javascript function to cause a postback to the
control and make it the target of the onclick event either of the
<embed> tag or of an <a> tag surrounding the <embed> tag.
eg.
string html = "<embed onclick=\"" +
this.Page.GetPostBackClientEvent(this,"") +
"\" type=\"application/x-shockwave-flash\"" +
".....</embed>";
etc.
I can't remember whether onclick works for <embed> in all or indeed any
browsers, try <a> also. I got some combination of these to work.
Raise the Click event in the RaisePostBackEvent method:
public void RaisePostBackEvent(string eventArgument)
{
if(this.Click !=null)
{
this.Click(this,new ImageClickEventArgs(0,0));
}
}
You then have a button with a server-side click event which renders as a
flash movie.
--
Steve Walker