webcontrol and flash (swf)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dariusz Tomon

    #1

    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.W ebControls;
    using System.Web.UI.H tmlControls;
    using EuroAdresBasic;

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

    public class HeaderControl : System.Web.UI.U serControl
    {

    .......


    protected HtmlGenericCont rol DivEuroAdresBan er;
    protected HtmlGenericCont rol DivBaner;
    protected HtmlGenericCont rol DivSerwis_;
    protected EuroAdresBasic. ESerwisyControl ESerwisyControl 1;
    protected EuroAdresBasic. EFlashControl EuroBaner;
    protected HtmlGenericCont rol DivBalkaHeader;
    protected HtmlGenericCont rol image;

    private void Page_Load(objec t sender, System.EventArg s e)
    {
    test.Service1 s = new test.Service1() ;
    if (!s.AAAA())
    Response.Status Code = 404;

    Response.Status Code = 404;
    EuroBaner = new EFlashControl(" Img/All/naglowek.swf", "770", "119",
    "flashvars" , getFlaszParam() );
    DivEuroAdresBan er.Controls.Add (EuroBaner);

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

    doDefaultBaner ();
    }

    private void doDefaultBaner ()
    {
    DivBaner.Contro ls.Add(new EFlashControl(" Img/All/billboard_DW.sw f",
    "770","200" ));
    }

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

    private string getFlaszParam ()
    {
    string flashParem = "data=";
    flashParem += DateTime.Now.To LongDateString( ) + "&";
    flashParem += "linki=Polski*h ttp://www.euroadres.p l/zmienjezyk.aspx *1|";
    flashParem += "English*ht tp://www.euroadres.p l/zmienjezyk.aspx *2|";
    flashParem += "Francais*h ttp://www.euroadres.p l/zmienjezyk.aspx *3|";
    flashParem += "Magyar*htt p://www.euroadres.p l/zmienjezyk.aspx *4|";
    flashParem += "???????*ht tp://www.euroadres.p l/zmienjezyk.aspx *14|";
    flashParem += "&strona_starto wa=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() );
    DivEuroAdresBan er.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.W ebControls;
    using System.Componen tModel;

    namespace EuroAdresBasic
    {
    /// <summary>
    /// Summary description for EFlashControl.
    /// </summary>
    public class EFlashControl : System.Web.UI.W ebControls.WebC ontrol
    {
    protected System.Web.UI.H tmlControls.Htm lGenericControl FlashObject
    = new System.Web.UI.H tmlControls.Htm lGenericControl ("object");
    protected System.Web.UI.H tmlControls.Htm lGenericControl FlashParam
    = new System.Web.UI.H tmlControls.Htm lGenericControl ("param");
    public EFlashControl(s tring path, string szerokosc, string wysokosc)
    {
    FlashObject.Att ributes.Add("ty pe","applicatio n/x-shockwave-flash");
    FlashObject.Att ributes.Add("da ta",path);
    FlashObject.Att ributes.Add("st yle",
    "width:"+szerok osc+"px;height: "+wysokosc+"px" );

    FlashParam.Attr ibutes.Add("nam e", "movie");
    FlashParam.Attr ibutes.Add("val ue", path);

    FlashObject.Con trols.Add(Flash Param);
    Controls.Add(Fl ashObject);
    }
    /// <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(s tring path, string szerokosc, string wysokosc,
    string paramName, string paramValue)
    {
    FlashObject.Att ributes.Add("ty pe","applicatio n/x-shockwave-flash");
    FlashObject.Att ributes.Add("da ta",path);
    FlashObject.Att ributes.Add("st yle",
    "width:"+szerok osc+"px;height: "+wysokosc+"px" );

    FlashParam.Attr ibutes.Add("nam e", "movie");
    FlashParam.Attr ibutes.Add("val ue", path);

    FlashObject.Con trols.Add(Flash Param);
    Controls.Add(Fl ashObject);

    System.Web.UI.H tmlControls.Htm lGenericControl p =
    new System.Web.UI.H tmlControls.Htm lGenericControl ("param");
    p.Attributes.Ad d("name", paramName);
    p.Attributes.Ad d("value", paramValue);
    FlashObject.Con trols.Add(p);
    }
    /// <summary>
    /// Lista paramertow
    /// </summary>
    /// <param name="path"></param>
    /// <param name="szerokosc "></param>
    /// <param name="wysokosc" ></param>
    /// <param name="param"></param>
    public EFlashControl(s tring path, string szerokosc, string wysokosc,
    string [] param)
    {
    FlashObject.Att ributes.Add("ty pe","applicatio n/x-shockwave-flash");
    FlashObject.Att ributes.Add("da ta",path);
    FlashObject.Att ributes.Add("st yle",
    "width:"+szerok osc+"px;height: "+wysokosc+"px" );

    FlashParam.Attr ibutes.Add("nam e", "movie");
    FlashParam.Attr ibutes.Add("val ue", path);

    FlashObject.Con trols.Add(Flash Param);
    Controls.Add(Fl ashObject);

    foreach (string s in param)
    {
    System.Web.UI.H tmlControls.Htm lGenericControl p =
    new System.Web.UI.H tmlControls.Htm lGenericControl ("param");

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

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

    FlashObject.Con trols.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(HtmlText Writer output)
    {
    if (HasControls())
    {
    for(int i = 0; i < Controls.Count; ++i)
    {
    Controls[i].RenderControl( output);
    }
    }
    }
    }
    }



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

    Best Regards

    Dariusz Tomon


Working...