471,315 Members | 1,519 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,315 software developers and data experts.

webcontrol and flash (swf)


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;)

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("obj ect");
protected System.Web.UI.HtmlControls.HtmlGenericControl FlashParam
= new System.Web.UI.HtmlControls.HtmlGenericControl("par am");
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("par am");
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("par am");

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[i].RenderControl(output);
}
}
}
}
}

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

Best Regards

Dariusz Tomon
Feb 4 '06 #1
0 1888

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by Steve Cook | last post: by
2 posts views Thread by avanhalen | last post: by
2 posts views Thread by lionbarrage | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.