9 Replies Latest reply on Aug 21, 2006 10:47 AM by Newsgroup_User

    updating from text file on web server?

    kyleg Level 1
      Per suggestion of a fellow user, I am trying to update a global property list from the contents of a on-line text file.

      1st I just trying to get a field to show the text.

      I am trying the preloadnetthing command in the prepare movie so it is in cache and then on exitframe are trying to check if it is done and pull it from cache or if waiting show the text "updating"

      here is what I have in my movie script:

      on prepareMovie
      global glist, gtheNetID
      set gtheNetID= preloadNetThing(" http://www.foreveryoursmedia.com/seats.txt")
      end


      on exitframe
      global gtheNetID
      if netDone(gtheNetID) then
      sprite(13).member.text = netTextResult(gtheNetID)
      else sprite(13).member.text = "updating"
      end if
      end

      doesn't seem to work

      have I left a step out?

      thanks
        • 1. Re: updating from text file on web server?
          Level 7
          The first thing I'd try is to GetNetText () instead of PreloadNetThing()

          But also, try replacing your code with the following, make it a behavior and
          place it on the text sprite. It worked for me...I saw your property list
          property pStatus, pNetID, pResult

          on beginSprite me
          pStatus = #request
          pNetID = -1
          pResult = ""
          end


          on exitframe
          case pStatus of
          #request:
          pNetID = GetNetText (" http://www.foreveryoursmedia.com/seats.txt")
          sprite (me.spriteNum).member.text = "updating"
          pStatus = #wait
          #wait:
          if netDone (pNetID) = 1 then
          pResult = netTextResult (pNetID)
          put "pResult = " & pResult
          pStatus = #update
          end if
          #update:
          sprite (me.spriteNum).member.text = pResult
          pStatus = #done
          end case
          if pStatus <> #done then
          go to the frame
          end if
          end




          --
          Craig Wollman
          Word of Mouth Productions

          phone 212 928 9581
          fax 212 928 9582
          159-00 Riverside Drive West #5H-70
          NY, NY 10032
          www.wordofmouthpros.com


          "kyleg" <webforumsuser@macromedia.com> wrote in message
          news:ebv9ea$9p$1@forums.macromedia.com...
          > Per suggestion of a fellow user, I am trying to update a global property
          > list
          > from the contents of a on-line text file.
          >
          > 1st I just trying to get a field to show the text.
          >
          > I am trying the preloadnetthing command in the prepare movie so it is in
          > cache
          > and then on exitframe are trying to check if it is done and pull it from
          > cache
          > or if waiting show the text "updating"
          >
          > here is what I have in my movie script:
          >
          > on prepareMovie
          > global glist, gtheNetID
          > set gtheNetID=
          > preloadNetThing(" http://www.foreveryoursmedia.com/seats.txt")
          > end
          >
          >
          > on exitframe
          > global gtheNetID
          > if netDone(gtheNetID) then
          > sprite(13).member.text = netTextResult(gtheNetID)
          > else sprite(13).member.text = "updating"
          > end if
          > end
          >
          > doesn't seem to work
          >
          > have I left a step out?
          >
          > thanks
          >


          • 2. Re: updating from text file on web server?
            Level 7
            Just so you know, one thing that was an issue in yours is that your
            exitFrame handler might be executing only once so if netDone isn't 1 when
            the exitFrame is passed, it will never have a chance to get the result. The
            network request could take 1/2 second or it could take 5 or more seconds
            depending on a lot of things so you need to give the request a chance to
            complete.

            If you do have a go to the frame somewhere else then it's still a problem
            because it will constantly be putting either type of text into the member
            and it becomes very inefficient.

            --
            Craig Wollman
            Word of Mouth Productions

            phone 212 928 9581
            fax 212 928 9582
            159-00 Riverside Drive West #5H-70
            NY, NY 10032
            www.wordofmouthpros.com


            "kyleg" <webforumsuser@macromedia.com> wrote in message
            news:ebv9ea$9p$1@forums.macromedia.com...
            > Per suggestion of a fellow user, I am trying to update a global property
            > list
            > from the contents of a on-line text file.
            >
            > 1st I just trying to get a field to show the text.
            >
            > I am trying the preloadnetthing command in the prepare movie so it is in
            > cache
            > and then on exitframe are trying to check if it is done and pull it from
            > cache
            > or if waiting show the text "updating"
            >
            > here is what I have in my movie script:
            >
            > on prepareMovie
            > global glist, gtheNetID
            > set gtheNetID=
            > preloadNetThing(" http://www.foreveryoursmedia.com/seats.txt")
            > end
            >
            >
            > on exitframe
            > global gtheNetID
            > if netDone(gtheNetID) then
            > sprite(13).member.text = netTextResult(gtheNetID)
            > else sprite(13).member.text = "updating"
            > end if
            > end
            >
            > doesn't seem to work
            >
            > have I left a step out?
            >
            > thanks
            >


            • 3. updating from text file on web server?
              kyleg Level 1
              Craig,

              do you have an example dir file showing what you are saying? I have

              property pStatus, pNetID, pResult

              on beginSprite me
              pStatus = #request
              pNetID = -1
              pResult = ""
              end

              as a behavior for the text field and the following as a frame script for frame 1

              on exitframe
              case pStatus of
              #request:
              pNetID = GetNetText (" http://www.foreveryoursmedia.com/seats.txt")
              sprite (me.spriteNum).member.text = "updating"
              pStatus = #wait
              #wait:
              if netDone (pNetID) = 1 then
              pResult = netTextResult (pNetID)
              put "pResult = " & pResult
              pStatus = #update
              end if
              #update:
              sprite (me.spriteNum).member.text = pResult
              pStatus = #done
              end case
              if pStatus <> #done then
              go to the frame
              end if
              end

              I do not see "updating in the field or the results from the web text file

              any help would be appreciated.

              kyle.gonyer@dana.com
              • 4. Re: updating from text file on web server?
                Level 7
                No, no, no. I had said to put that all in ONE behavior and attach it to the
                text sprite. I'm sure the frame script gave you all sorts of errors.

                --
                Craig Wollman
                Word of Mouth Productions

                phone 212 928 9581
                fax 212 928 9582
                159-00 Riverside Drive West #5H-70
                NY, NY 10032
                www.wordofmouthpros.com


                "kyleg" <webforumsuser@macromedia.com> wrote in message
                news:ec2ape$l21$1@forums.macromedia.com...
                > Craig,
                >
                > do you have an example dir file showing what you are saying? I have
                >
                > property pStatus, pNetID, pResult
                >
                > on beginSprite me
                > pStatus = #request
                > pNetID = -1
                > pResult = ""
                > end
                >
                > as a behavior for the text field and the following as a frame script for
                > frame
                > 1
                >
                > on exitframe
                > case pStatus of
                > #request:
                > pNetID = GetNetText (" http://www.foreveryoursmedia.com/seats.txt")
                > sprite (me.spriteNum).member.text = "updating"
                > pStatus = #wait
                > #wait:
                > if netDone (pNetID) = 1 then
                > pResult = netTextResult (pNetID)
                > put "pResult = " & pResult
                > pStatus = #update
                > end if
                > #update:
                > sprite (me.spriteNum).member.text = pResult
                > pStatus = #done
                > end case
                > if pStatus <> #done then
                > go to the frame
                > end if
                > end
                >
                > I do not see "updating in the field or the results from the web text file
                >
                > any help would be appreciated.
                >


                • 5. updating from text file on web server?
                  kyleg Level 1
                  Craig,

                  I figured the exitframe handler belonged in a frame or movie script......never put that handler on a sprite.

                  I suppose it does the same as if it is in a frame script?

                  I have all in 1 behavior now but I get the error varible used before assigning a value on:

                  sprite(me.?spriteNum).member.text = "updating"

                  took out the "me." and declared spritenum as a property and it goes with no error, but I get no results.

                  does it need to be "me.spritenum" ?

                  If it helps the 1st frame is being held by a go the frame loop. Is this causing any issues?

                  thanks!
                  • 6. Re: updating from text file on web server?
                    Level 7
                    Yes, keep the me but add it after the exitframe. I don't know how I lost
                    that but it was there when I tested. The line shoule be:

                    on exitFrame me

                    This is the only way the properties can be passed into the handlers unless
                    you do what you did but I don't recommend that method.

                    Just for testing purposes get rid of the exitFrame on the first frame that
                    you mentioned and make your text sprite longer. Then put an exitframe at
                    the end of that sprite span in the frame script (but of course keep the
                    exitFrame in the sprite behavior.

                    This will give the behavior the space it needs to execute but will also
                    allow the movie to continue running after it's done it's thing.

                    --
                    Craig Wollman
                    Word of Mouth Productions

                    phone 212 928 9581
                    fax 212 928 9582
                    159-00 Riverside Drive West #5H-70
                    NY, NY 10032
                    www.wordofmouthpros.com


                    "kyleg" <webforumsuser@macromedia.com> wrote in message
                    news:ec4fbf$96v$1@forums.macromedia.com...
                    > Craig,
                    >
                    > I figured the exitframe handler belonged in a frame or movie
                    > script......never
                    > put that handler on a sprite.
                    >
                    > I suppose it does the same as if it is in a frame script?
                    >
                    > I have all in 1 behavior but I get the error varible used before assigning
                    > a
                    > value on:
                    >
                    > sprite(me.?spriteNum).member.text = "updating"
                    >
                    > took out the "me." and declared spritenum as a property and it goes with
                    > no
                    > error, but I get no results.
                    >
                    > does it need to be "me.spritenum" ?
                    >
                    > If it helps the 1st frame is being held by a go the frame loop. Is this
                    > causing any issues?
                    >
                    > thanks!
                    >


                    • 7. Re: updating from text file on web server?
                      kyleg Level 1
                      Craig,

                      I made the changes you suggested (moved all over 35 frames), but it hangs on

                      sprite(me.spriteNum).member.text = "updating" - (updating text displays though)

                      with the changes, it is barks at the ".text" claiming that it is a property that it is not found

                      #text


                      ------------------------------------------
                      here is the script so far


                      property pStatus, pNetID, pResult


                      on beginSprite me
                      pStatus = #request
                      pNetID = -1
                      pResult = ""
                      end


                      on exitframe me
                      case pStatus of
                      #request:
                      pNetID = GetNetText (" http://www.foreveryoursmedia.com/seats.txt")
                      sprite(me.spriteNum).member.text = "updating"
                      pStatus = #wait
                      #wait:
                      if netDone (pNetID) = 1 then
                      pResult = netTextResult (pNetID)
                      put "pResult = " & pResult
                      pStatus = #update
                      end if
                      #update:
                      sprite(me.spriteNum).member.text = pResult
                      pStatus = #done
                      end case
                      if pStatus <> #done then
                      go to the frame
                      end if
                      end
                      • 8. Re: updating from text file on web server?
                        Level 7
                        Did you get my movie I sent as a sample?



                        --
                        Craig Wollman
                        Word of Mouth Productions

                        phone 212 928 9581
                        fax 212 928 9582
                        159-00 Riverside Drive West #5H-70
                        NY, NY 10032
                        www.wordofmouthpros.com


                        "kyleg" <webforumsuser@macromedia.com> wrote in message
                        news:eccc8k$bgd$1@forums.macromedia.com...
                        > Craig,
                        >
                        > I made the changes you suggested (moved all over 35 frames), but it hangs
                        > on
                        >
                        > sprite(me.spriteNum).member.text = "updating" - (updating text displays
                        > though)
                        >
                        > with the changes, it is barks at the ".text" claiming that it is a
                        > property
                        > that it is not found
                        >
                        > #text
                        >
                        >
                        > ------------------------------------------
                        > here is the script so far
                        >
                        >
                        > property pStatus, pNetID, pResult
                        >
                        >
                        > on beginSprite me
                        > pStatus = #request
                        > pNetID = -1
                        > pResult = ""
                        > end
                        >
                        >
                        > on exitframe me
                        > case pStatus of
                        > #request:
                        > pNetID = GetNetText (" http://www.foreveryoursmedia.com/seats.txt")
                        > sprite(me.spriteNum).member.text = "updating"
                        > pStatus = #wait
                        > #wait:
                        > if netDone (pNetID) = 1 then
                        > pResult = netTextResult (pNetID)
                        > put "pResult = " & pResult
                        > pStatus = #update
                        > end if
                        > #update:
                        > sprite(me.spriteNum).member.text = pResult
                        > pStatus = #done
                        > end case
                        > if pStatus <> #done then
                        > go to the frame
                        > end if
                        > end
                        >


                        • 9. Re: updating from text file on web server?
                          Level 7
                          Then the behavior isn't on a sprite that contains a text cast member.


                          --
                          Craig Wollman
                          Word of Mouth Productions

                          phone 212 928 9581
                          fax 212 928 9582
                          159-00 Riverside Drive West #5H-70
                          NY, NY 10032
                          www.wordofmouthpros.com


                          "kyleg" <webforumsuser@macromedia.com> wrote in message
                          news:eccc8k$bgd$1@forums.macromedia.com...
                          > Craig,
                          >
                          > I made the changes you suggested (moved all over 35 frames), but it hangs
                          > on
                          >
                          > sprite(me.spriteNum).member.text = "updating" - (updating text displays
                          > though)
                          >
                          > with the changes, it is barks at the ".text" claiming that it is a
                          > property
                          > that it is not found
                          >
                          > #text
                          >
                          >
                          > ------------------------------------------
                          > here is the script so far
                          >
                          >
                          > property pStatus, pNetID, pResult
                          >
                          >
                          > on beginSprite me
                          > pStatus = #request
                          > pNetID = -1
                          > pResult = ""
                          > end
                          >
                          >
                          > on exitframe me
                          > case pStatus of
                          > #request:
                          > pNetID = GetNetText (" http://www.foreveryoursmedia.com/seats.txt")
                          > sprite(me.spriteNum).member.text = "updating"
                          > pStatus = #wait
                          > #wait:
                          > if netDone (pNetID) = 1 then
                          > pResult = netTextResult (pNetID)
                          > put "pResult = " & pResult
                          > pStatus = #update
                          > end if
                          > #update:
                          > sprite(me.spriteNum).member.text = pResult
                          > pStatus = #done
                          > end case
                          > if pStatus <> #done then
                          > go to the frame
                          > end if
                          > end
                          >