flash embedded in C#

D

Dariusz Tomon

Hi

I have got the problem with web control displaying flash (swf) object. The
problem is connected with the fact that 1-st swf should loads the second
one. But it doesn't.
That's why I suspects taht webcontrol or class under it causes that problem.
Maybe the following code is too long to analyze so pls redirect me whare I
could read/download the code suitable for that purposes.


It's the beginning of my control:

namespace EuroDomWnetrze.WebControl
{
using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using EuroAdresBasic;

//it's important that it derives from one class from spacename
"EuroAdresBasic"

public class HeaderControl : System.Web.UI.UserControl
{

.......


protected HtmlGenericControl DivEuroAdresBaner;
protected HtmlGenericControl DivBaner;
protected HtmlGenericControl DivSerwis_;
protected EuroAdresBasic.ESerwisyControl ESerwisyControl1;
protected EuroAdresBasic.EFlashControl EuroBaner;
protected HtmlGenericControl DivBalkaHeader;
protected HtmlGenericControl image;

private void Page_Load(object sender, System.EventArgs e)
{
test.Service1 s = new test.Service1();
if (!s.AAAA())
Response.StatusCode = 404;

Response.StatusCode = 404;
EuroBaner = new EFlashControl("Img/All/naglowek.swf", "770", "119",
"flashvars", getFlaszParam());
DivEuroAdresBaner.Controls.Add(EuroBaner);

//DivBalkaHeader.Controls.Add(new EFlashControl("waluty_swf.swf", "770",
"19","flashvars", "uerel=http://www.euroadres.pl/Waluty.aspx"));

doDefaultBaner ();
}

private void doDefaultBaner ()
{
DivBaner.Controls.Add(new EFlashControl("Img/All/billboard_DW.swf",
"770","200"));
}

...............

private string getFlaszParam ()
{
string flashParem = "data=";
flashParem += DateTime.Now.ToLongDateString() + "&";
flashParem += "linki=Polski*http://www.euroadres.pl/zmienjezyk.aspx*1|";
flashParem += "English*http://www.euroadres.pl/zmienjezyk.aspx*2|";
flashParem += "Francais*http://www.euroadres.pl/zmienjezyk.aspx*3|";
flashParem += "Magyar*http://www.euroadres.pl/zmienjezyk.aspx*4|";
flashParem += "???????*http://www.euroadres.pl/zmienjezyk.aspx*14|";
flashParem += "&strona_startowa=default.aspx";
flashParem += "&haslo="+ getTwojAdres();

return flashParem;
}

I'm almost sure that the most important are two lines:

EuroBaner = new EFlashControl("Img/All/naglowek.swf", "770", "119",
"flashvars", getFlaszParam());
DivEuroAdresBaner.Controls.Add(EuroBaner);

because they are connected with object created in line (protected
EuroAdresBasic.EFlashControl EuroBaner;)

THIS IS BEGINNING

The class from namespace EuroAdresBasic creating that EuroBaner object is
here:

////////////////////////////////////////////////////<begin>


using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;

namespace EuroAdresBasic
{
/// <summary>
/// Summary description for EFlashControl.
/// </summary>
public class EFlashControl : System.Web.UI.WebControls.WebControl
{
protected System.Web.UI.HtmlControls.HtmlGenericControl FlashObject
= new System.Web.UI.HtmlControls.HtmlGenericControl("object");
protected System.Web.UI.HtmlControls.HtmlGenericControl FlashParam
= new System.Web.UI.HtmlControls.HtmlGenericControl("param");
public EFlashControl(string path, string szerokosc, string wysokosc)
{
FlashObject.Attributes.Add("type","application/x-shockwave-flash");
FlashObject.Attributes.Add("data",path);
FlashObject.Attributes.Add("style",
"width:"+szerokosc+"px;height:"+wysokosc+"px");

FlashParam.Attributes.Add("name", "movie");
FlashParam.Attributes.Add("value", path);

FlashObject.Controls.Add(FlashParam);
Controls.Add(FlashObject);
}
/// <summary>
/// constructor z dodatkowym parametrem. nazwa;wartosc
/// </summary>
/// <param name="path"></param>
/// <param name="szerokosc"></param>
/// <param name="wysokosc"></param>
/// <param name="param"></param>
public EFlashControl(string path, string szerokosc, string wysokosc,
string paramName, string paramValue)
{
FlashObject.Attributes.Add("type","application/x-shockwave-flash");
FlashObject.Attributes.Add("data",path);
FlashObject.Attributes.Add("style",
"width:"+szerokosc+"px;height:"+wysokosc+"px");

FlashParam.Attributes.Add("name", "movie");
FlashParam.Attributes.Add("value", path);

FlashObject.Controls.Add(FlashParam);
Controls.Add(FlashObject);

System.Web.UI.HtmlControls.HtmlGenericControl p =
new System.Web.UI.HtmlControls.HtmlGenericControl("param");
p.Attributes.Add("name", paramName);
p.Attributes.Add("value", paramValue);
FlashObject.Controls.Add(p);
}
/// <summary>
/// Lista paramertow
/// </summary>
/// <param name="path"></param>
/// <param name="szerokosc"></param>
/// <param name="wysokosc"></param>
/// <param name="param"></param>
public EFlashControl(string path, string szerokosc, string wysokosc,
string [] param)
{
FlashObject.Attributes.Add("type","application/x-shockwave-flash");
FlashObject.Attributes.Add("data",path);
FlashObject.Attributes.Add("style",
"width:"+szerokosc+"px;height:"+wysokosc+"px");

FlashParam.Attributes.Add("name", "movie");
FlashParam.Attributes.Add("value", path);

FlashObject.Controls.Add(FlashParam);
Controls.Add(FlashObject);

foreach (string s in param)
{
System.Web.UI.HtmlControls.HtmlGenericControl p =
new System.Web.UI.HtmlControls.HtmlGenericControl("param");

string [] sTab = s.Split(new char [] {'|'});

p.Attributes.Add("name", sTab[0]);
p.Attributes.Add("value", sTab[1]);

FlashObject.Controls.Add(p);
}
}
/// <summary>
/// Render this control to the output parameter specified.
/// </summary>
/// <param name="output"> The HTML writer to write out to </param>
protected override void Render(HtmlTextWriter output)
{
if (HasControls())
{
for(int i = 0; i < Controls.Count; ++i)
{
Controls.RenderControl(output);
}
}
}
}
}



///////////////////////////////////////<END>

Best Regards

Dariusz Tomon
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top