Professional Web Applications Themes

loop - Macromedia Flash Sitedesign

well, what's the problem??? PK...

Sponsored Links
  1. #1

    Default Re: loop

    well,

    what's the problem???


    PK

    Sponsored Links
    Pixel Komando Guest

  2. #2

    Default Loop

    Hi,

    Total newb here so my apologies if I break any scripting standards. I
    have some code that pulls reservation times from a database. It is
    supposed to print green cells in a table until the time of the
    reservation and then print red cells until the reserved period has
    ended and then continue printing green cells. Example: reservation
    period is 11:00 AM to 2:00 PM. Print green cells until representing
    every half hour until 11. Print red cells until 2 then print green
    cells until end of day(7 PM). I ran into a problem and statically
    assigned values to take the DB out of the loop. Below is the code. Can
    anyone tell me why is it that if the reservation start time is before
    9:30 AM that the loop breaks and doesn't print red cells. Sorry for
    being lengthy,...

    Brian


    <%

    vtime = TimeValue(#7:00#)
    btime = TimeValue(#9:30#)


    Response.Write "<table border=1>"

    For i = 1 to 30

    If vtime > btime AND vtime < TimeValue(#12:31#) Then
    Response.Write "<td bgcolor='#F0E68C'>" & Left(vtime, 5) & "</td>"
    vtime = DateAdd("n", 30, vtime)

    Else

    Response.Write "<td bgcolor='#F0E68C'>" & Left(vtime, 4) & "</td>"
    vtime = DateAdd("n", 30, vtime)

    End If
    Next
    Response.Write "</tr>"


    vtime = TimeValue(#7:00#)
    stime = TimeValue(#8:00#)
    btime = TimeValue(#9:30#)
    etime = TimeValue(#11:00#)

    Response.Write "<tr height=20>"



    Do while Left(vtime, 4) <> Left(stime, 4)

    Response.Write "<td bgcolor='#3CB371'></td>"

    vtime = DateAdd("n", 30, vtime)



    Loop



    Do while Left(vtime, 4) <= Left(etime, 5)

    Response.Write "<td bgcolor='#F08080'></td>"

    vtime = DateAdd("n", 30, vtime)

    Loop









    Response.Write "</table>"

    %>
    Brian Guest

  3. #3

    Default Re: Loop

    "Brian" <slidercapecod.net> wrote in message
    news:69156115.0310060541.2824e6f2posting.google.c om...
    > Hi,
    >
    > Total newb here so my apologies if I break any scripting standards. I
    > have some code that pulls reservation times from a database. It is
    > supposed to print green cells in a table until the time of the
    > reservation and then print red cells until the reserved period has
    > ended and then continue printing green cells. Example: reservation
    > period is 11:00 AM to 2:00 PM. Print green cells until representing
    > every half hour until 11. Print red cells until 2 then print green
    > cells until end of day(7 PM). I ran into a problem and statically
    > assigned values to take the DB out of the loop. Below is the code. Can
    > anyone tell me why is it that if the reservation start time is before
    > 9:30 AM that the loop breaks and doesn't print red cells. Sorry for
    > being lengthy,...
    >
    > Brian
    >
    >
    > <%
    >
    > vtime = TimeValue(#7:00#)
    > btime = TimeValue(#9:30#)
    >
    >
    > Response.Write "<table border=1>"
    >
    > For i = 1 to 30
    >
    > If vtime > btime AND vtime < TimeValue(#12:31#) Then
    > Response.Write "<td bgcolor='#F0E68C'>" & Left(vtime, 5) & "</td>"
    > vtime = DateAdd("n", 30, vtime)
    >
    > Else
    >
    > Response.Write "<td bgcolor='#F0E68C'>" & Left(vtime, 4) & "</td>"
    > vtime = DateAdd("n", 30, vtime)
    >
    > End If
    > Next
    > Response.Write "</tr>"
    >
    >
    > vtime = TimeValue(#7:00#)
    > stime = TimeValue(#8:00#)
    > btime = TimeValue(#9:30#)
    > etime = TimeValue(#11:00#)
    >
    > Response.Write "<tr height=20>"
    >
    >
    >
    > Do while Left(vtime, 4) <> Left(stime, 4)
    >
    > Response.Write "<td bgcolor='#3CB371'></td>"
    >
    > vtime = DateAdd("n", 30, vtime)
    >
    >
    >
    > Loop
    >
    >
    >
    > Do while Left(vtime, 4) <= Left(etime, 5)
    >
    > Response.Write "<td bgcolor='#F08080'></td>"
    >
    > vtime = DateAdd("n", 30, vtime)
    >
    > Loop
    >
    >
    >
    >
    >
    >
    >
    >
    >
    > Response.Write "</table>"
    >
    > %>
    By using the Left function, your comparing string values not time
    values. As such, lexically (alphabetically), "8:00" occurs after
    "11:00". Here's some revised code for your review:

    <%
    Dim d,s,e,i
    s = #11:00:00#
    e = #14:00:00#

    With Response
    .Write "<table border='1'>"
    .Write "<tr>"
    For i = 14 To 35
    d = DateAdd("n",i*30,0)
    .Write "<td bgcolor='F0E68C'>"
    .Write FormatDateTime(d,vbShortTime)
    .Write "</td>"
    Next
    .Write "</tr>"

    .Write "<tr>"
    For i = 14 To 35
    d = DateAdd("n",i*30,0)
    If (e > d) And (s < DateAdd("n",30,d)) Then
    .Write "<td bgcolor='#F08080'>&nbsp;</td>"
    Else
    .Write "<td bgcolor='#3CB371'>&nbsp;</td>"
    End If
    Next
    .Write "</tr>"
    .Write "</table>"
    End With
    %>

    Notes:
    1. Consider using ISO-8601 standard date/time formats (yyyy-mm-dd
    hh:nn:ss)
    2. Consider using a browser-safe color palette.
    3. Refer to the following article for advice on formatting date/time
    values. aspfaq.com/2313

    HTH
    -Chris Hohmann


    Chris Hohmann Guest

  4. #4

    Default Re: Loop

    "Chris Hohmann" <hohmannATyahooDOTcom> wrote in message news:<ubxQpqCjDHA.2768TK2MSFTNGP10.phx.gbl>...
    > "Brian" <slidercapecod.net> wrote in message
    > news:69156115.0310060541.2824e6f2posting.google.c om...
    > > Hi,
    > >
    > > Total newb here so my apologies if I break any scripting standards. I
    > > have some code that pulls reservation times from a database. It is
    > > supposed to print green cells in a table until the time of the
    > > reservation and then print red cells until the reserved period has
    > > ended and then continue printing green cells. Example: reservation
    > > period is 11:00 AM to 2:00 PM. Print green cells until representing
    > > every half hour until 11. Print red cells until 2 then print green
    > > cells until end of day(7 PM). I ran into a problem and statically
    > > assigned values to take the DB out of the loop. Below is the code. Can
    > > anyone tell me why is it that if the reservation start time is before
    > > 9:30 AM that the loop breaks and doesn't print red cells. Sorry for
    > > being lengthy,...
    > >
    > > Brian
    > >
    > >
    > > <%
    > >
    > > vtime = TimeValue(#7:00#)
    > > btime = TimeValue(#9:30#)
    > >
    > >
    > > Response.Write "<table border=1>"
    > >
    > > For i = 1 to 30
    > >
    > > If vtime > btime AND vtime < TimeValue(#12:31#) Then
    > > Response.Write "<td bgcolor='#F0E68C'>" & Left(vtime, 5) & "</td>"
    > > vtime = DateAdd("n", 30, vtime)
    > >
    > > Else
    > >
    > > Response.Write "<td bgcolor='#F0E68C'>" & Left(vtime, 4) & "</td>"
    > > vtime = DateAdd("n", 30, vtime)
    > >
    > > End If
    > > Next
    > > Response.Write "</tr>"
    > >
    > >
    > > vtime = TimeValue(#7:00#)
    > > stime = TimeValue(#8:00#)
    > > btime = TimeValue(#9:30#)
    > > etime = TimeValue(#11:00#)
    > >
    > > Response.Write "<tr height=20>"
    > >
    > >
    > >
    > > Do while Left(vtime, 4) <> Left(stime, 4)
    > >
    > > Response.Write "<td bgcolor='#3CB371'></td>"
    > >
    > > vtime = DateAdd("n", 30, vtime)
    > >
    > >
    > >
    > > Loop
    > >
    > >
    > >
    > > Do while Left(vtime, 4) <= Left(etime, 5)
    > >
    > > Response.Write "<td bgcolor='#F08080'></td>"
    > >
    > > vtime = DateAdd("n", 30, vtime)
    > >
    > > Loop
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > > Response.Write "</table>"
    > >
    > > %>
    >
    > By using the Left function, your comparing string values not time
    > values. As such, lexically (alphabetically), "8:00" occurs after
    > "11:00". Here's some revised code for your review:
    >
    > <%
    > Dim d,s,e,i
    > s = #11:00:00#
    > e = #14:00:00#
    >
    > With Response
    > .Write "<table border='1'>"
    > .Write "<tr>"
    > For i = 14 To 35
    > d = DateAdd("n",i*30,0)
    > .Write "<td bgcolor='F0E68C'>"
    > .Write FormatDateTime(d,vbShortTime)
    > .Write "</td>"
    > Next
    > .Write "</tr>"
    >
    > .Write "<tr>"
    > For i = 14 To 35
    > d = DateAdd("n",i*30,0)
    > If (e > d) And (s < DateAdd("n",30,d)) Then
    > .Write "<td bgcolor='#F08080'>&nbsp;</td>"
    > Else
    > .Write "<td bgcolor='#3CB371'>&nbsp;</td>"
    > End If
    > Next
    > .Write "</tr>"
    > .Write "</table>"
    > End With
    > %>
    >
    > Notes:
    > 1. Consider using ISO-8601 standard date/time formats (yyyy-mm-dd
    > hh:nn:ss)
    > 2. Consider using a browser-safe color palette.
    > 3. Refer to the following article for advice on formatting date/time
    > values. aspfaq.com/2313
    >
    > HTH
    > -Chris Hohmann
    Yes, that helps a lot. It makes sense now. Thank you.
    Just curious, why do you say that I should consider using a
    browser-safe color palette?

    Brian
    Brian Guest

  5. #5

    Default Re: Loop

    "Brian" <slidercapecod.net> wrote in message
    news:69156115.0310070544.2122a1acposting.google.c om...
    > Yes, that helps a lot. It makes sense now. Thank you.
    > Just curious, why do you say that I should consider using a
    > browser-safe color palette?
    Force of habit mainly. :) It's really not that much of an issue anymore.
    Here are some points:

    1. Some miniscule fraction of your user population may be using 8 bit
    (256) color depth. For those people, a browser safe palette avoids
    dithering.

    2. There no harm in using a browser-safe palette. True/high color
    displays deal with them as well as they do any other color.

    3. Browser-safe palettes may come into vogue again as more web content
    is "retooled" for mobile display technologies (PDA's, mobile phones,
    etc...) with limited color depths

    4. CSS allows you to abbreviate browser safe hex codes. For example, you
    can specify #f00 for red.

    Here are some articles:
    [url]http://www.lynda.com/hex.html[/url]
    [url]http://hotwired.lycos.com/webmonkey/00/37/index2a.html?tw=design[/url]

    HTH
    -Chris


    Chris Hohmann Guest

  6. #6

    Default Loop

    I'm trying to perform a loop to display the contents of my DB, the only
    issue is that I would only like to display 10 results maximum this is
    relatively easy but what happens if there are less than 10 results in the
    DB. If I was going to do a :

    Do Until objRS.EOF

    Then it would display the full records, likewise if i put a counter on the
    loop then it will run into errors if I have less records than the
    count.......

    ideas ?

    thanks.


    John Smith Guest

  7. #7

    Default Loop

    I'm trying to perform a loop to display the contents of my DB, the only
    issue is that I would only like to display 10 results maximum this is
    relatively easy but what happens if there are less than 10 results in the
    DB. If I was going to do a :

    Do Until objRS.EOF

    Then it would display the full records, likewise if i put a counter on the
    loop then it will run into errors if I have less records than the
    count.......

    ideas ?

    thanks.



    John Smith Guest

  8. #8

    Default Re: Loop

    John Smith wrote:
    > I'm trying to perform a loop to display the contents of my DB, the
    > only issue is that I would only like to display 10 results maximum
    > this is relatively easy but what happens if there are less than 10
    > results in the DB. If I was going to do a :
    >
    > Do Until objRS.EOF
    >
    > Then it would display the full records, likewise if i put a counter
    > on the loop then it will run into errors if I have less records than
    > the count.......
    >
    > ideas ?
    >
    > thanks.
    What database?
    With Access and SQL Server, you can use the TOP n construct in your query to
    limit the records returned (SELECT TOP 10 <field list> FROM table ...). With
    SQL Server, you can also use SET ROWCOUNT to do the same thing.

    If you have an antique database that does not support TOP, then simply
    combine your counter idea with your DO loop:

    dim i
    i = 0
    Do Until rs.eof OR i = 10
    ....
    i = i + 1
    rs.movenext
    loop

    HTH,
    Bob Barrows

    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"


    Bob Barrows Guest

  9. #9

    Default Re: Loop

    On Mon, 20 Oct 2003 22:46:09 +0000 (UTC), "John Smith"
    <johnsmith.smith> wrote:
    >I'm trying to perform a loop to display the contents of my DB, the only
    >issue is that I would only like to display 10 results maximum this is
    >relatively easy but what happens if there are less than 10 results in the
    >DB. If I was going to do a :
    >
    >Do Until objRS.EOF
    >
    >Then it would display the full records, likewise if i put a counter on the
    >loop then it will run into errors if I have less records than the
    >count.......
    >
    >ideas ?
    Why not just do:

    Do Until objRS.EOF OR count=10

    Jeff
    Jeff Cochran Guest

  10. #10

    Default Loop

    I am trying to make a loop from a nested movieclip of my main movieclip that
    doesn't suppose to loop, it stops at the last frame. My client wants to offer
    his customer the opportunity to make it loop for special presentations. And I
    dont know how to do this....can anyone help me??

    Thanks

    monimo Guest

  11. #11

    Default Re: Loop

    not sure what you mean. If the nested movie clip does not have a stop action
    on its' last frame, and the movie clip layer is extended to the end of the
    main time line, it will loop forever unless you have a script to turn it
    off. You can always put a button in the movie clip telling it to stop. Or on
    the main stage telling it to stop or setting it's visibility to false and
    that will make it disappear.

    --
    Al Winchell
    [url]www.Amazingwebs.com[/url]
    den.tigersquadron.com


    AWD Guest

  12. #12

    Default Re: Loop

    What I mean is that I have a main movie that stops at the last frame--i put a
    stop action in the last frame(it supose to stop) and then i have another movie
    clip that pops up over my main movie clip from a button, to give my client the
    opportunity to loop the main movie when he has a presentation. so i dont know
    how to make that stop action in the last frame to be desactivated just when i
    click a button from that other movie clip. I dont know if you understand
    me.....or if this is posible.

    I am still trying to get it to work. :(

    I can use any advise

    thanks

    monimo Guest

  13. #13

    Default Re: Loop

    I think I understand although not necessarily. Couple of ways you can do it.
    An easy way would be to duplicate your main movie with OUT the stop action
    on it.

    Call this "duplicateMovie".

    Put a stop action on the FIRST frame and a goToAndPlay Fame(2) on the last
    frame of his duplicateMovie

    Put this movie above the original main movie on the timeline.

    When you click to activate your new movie also tell it to play frame 2 of
    the duplicateMovie.

    When you close the new movie also tell it to goToAndStop on frame 1 of the
    duplicateMovie.

    could also do it with variables and visiblitly but I think this would be
    easier.

    If you need an example mail me at [email]alwinchmsn.com[/email]

    --
    Al Winchell
    [url]www.Amazingwebs.com[/url]
    den.tigersquadron.com


    AWD Guest

  14. #14

    Default Loop

    Collision Loop

    Two 3D objects collide then go to marker where the play head is held in a
    continuous loop. Need something to terminate the loop and reset the 3D world.
    I?m assuming that the two objects are still attached and causing the loop.
    What code to use to stop this and where should it be placed before, after or
    inside the Step frame?

    Thanks


    TJGY Guest

Similar Threads

  1. Loop option set, but flash doesn't loop
    By uj666 in forum Macromedia Flash Player
    Replies: 6
    Last Post: October 21st, 04:23 AM
  2. Can a film loop play once, then loop on the last frame(s)?
    By Schiemer webforumsuser@macromedia.com in forum Macromedia Director Lingo
    Replies: 0
    Last Post: November 29th, 03:35 AM
  3. Film loop rollovers working with tell sprite, but only if Loop is checked
    By Schiemer webforumsuser@macromedia.com in forum Macromedia Director Basics
    Replies: 0
    Last Post: November 27th, 06:02 AM
  4. Urgent: Repeat loop and Film loop clash!
    By Jai G in forum Macromedia Director Lingo
    Replies: 4
    Last Post: July 31st, 04:39 AM
  5. Help with loop inside loop and mysql queries
    By Petre Agenbag in forum PHP Development
    Replies: 1
    Last Post: July 16th, 07:36 AM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139