AdRotator and Flash

ManicCW

Well-known member
Joined
Jul 21, 2005
Messages
428
Location
Mostar
Programming Experience
Beginner
I see peaople are buying components to display flash in arrotator. There is no need for that because there is a simple solution. I pull my data for rotator from database but this can be also done with xml.
In my table for adrotator i have added column IsFlash (bit) and when i upload flash and write data to table it sets IsFlash to True if file has swf extension.

no when i bind adrotator to sqldatasource i just add this in adcreated event:

VB.NET:
    Protected Sub arOglasi_AdCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.AdCreatedEventArgs) Handles arOglasi.AdCreated
        If CBool(e.AdProperties.Item("IsFlash")) = True Then
            'flash  u literal
            Me.arOglasi.Visible = False
            Me.litFlashOglas.Text = "<object type=""application/x-shockwave-flash"" data=""" & e.AdProperties.Item("ImageURL") & """ " & _
            "width=""" & e.AdProperties.Item("Width") & """ height=""" & e.AdProperties.Item("Height") & """>"
            Me.litFlashOglas.Text &= "<param name=""movie"" value=""" & e.AdProperties.Item("ImageURL") & """ />"
            Me.litFlashOglas.Text &= "<param name=""menu"" value=""false"" />"
            Me.litFlashOglas.Text &= "</object>"
        Else
            Me.arOglasi.Visible = True
            Me.litFlashOglas.Visible = False
            Me.arOglasi.Width = Unit.Pixel(e.AdProperties.Item("Width"))
            Me.arOglasi.Height = Unit.Pixel(e.AdProperties.Item("Height"))
            Me.arOglasi.ToolTip = e.AdProperties.Item("AlternateText")
        End If
    End Sub

Basicaly, i put code for flash in literal and hide rotator. rotator and literal are in one table (cell).
And it validates (w3c)! in my case as xhtml 1.0 Transitional. Hope this helps to someone.
 
Back
Top