[RESOLVED] [vs2005] random flash banner
hi, how you load a random swf from code behind?
html
Code:
<Bewise:FlashControl ID="bannerflashcontrol" runat="server" Height="245px" MovieUrl="<%=rand_banner %>" Width="707px" loop="true" />
vb
Code:
Public Function rand_banner() As String
Dim banner_arr() As String = New String() {"~/images/banner1.swf", "~/images/banner2.swf", "~/images/banner3.swf"}
Dim i As Integer = a.RandomNumber(0, 2) 'call class helper to generate random num(min, max)
Return banner_arr(i).ToString
End Function
Thanks.
Re: [vs2005] random flash banner
so why does adding attributes did not turn to work as well?
vb
Code:
bannerflashcontrol.Attributes.Add("MovieUrl", "~/images/banner1.swf")
Re: [vs2005] random flash banner
Hey,
When you view the page in the browser, and right click and view source, what do you see on the page? By that I mean, find the bannerflashcontrol, and then copy and paste the html here.
Gary
Re: [vs2005] random flash banner
hey gep,
perfect! i ran the page with working swf and change the movie value to server side script...
html
Code:
<object id="bannerflashcontrol" width="707px" height="245px" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0">
<param name="movie" value="<%=rand_banner() %>">
<param name="quality" value="High">
<param name="play" value="True">
<param name="loop" value="True">
<param name="menu" value="False">
<param name="scale" value="Showall">
</object>
vb
Code:
Public Function rand_banner() As String
Dim arr() As String = New String() {"images/banner1.swf", "images/banner2.swf", "images/banner3.swf"}
Dim i As Integer = a.RandomNumber(0, 3)
Return arr(i).ToString()
End Function
Re: [RESOLVED] [vs2005] random flash banner
Hey,
Glad to hear that you got it working!
Gary