Results 1 to 5 of 5

Thread: [RESOLVED] [vs2005] random flash banner

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2007
    Posts
    617

    Resolved [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.
    Learn something new every .001 second.

  2. #2

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2007
    Posts
    617

    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")
    Learn something new every .001 second.

  3. #3
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    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

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2007
    Posts
    617

    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
    Learn something new every .001 second.

  5. #5
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: [RESOLVED] [vs2005] random flash banner

    Hey,

    Glad to hear that you got it working!

    Gary

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width