8 Replies Latest reply on Nov 21, 2007 5:42 AM by Greg Dove

    Better in AS or ASP?

    SteveH59 Level 1

      I am a complete newcomer to Flash (but keen to learn!) and have a question about inserting the current date into a Flash site I am trying to customise.

      The site uses a logo in the top left hand corner and has been drawn on a background which streches right across the page from left to right.

      I would like to draw in a text box (dynamic text box?) on the right hand side of the background.

      I also have some asp script - which I know works - and which I would like to use with my new Flash site.

      Am I correct in saying that I save the asp file, let's call it date.asp, in the same directory on my server as my Flash files, and that this asp file stands between my Flash interface and the server?

      If so, then my question(s) concerns how to draw in this dynamic text box on my background. Do I simply click on the A font tool and insert choose Dynamic Text in Properties while leaving the actual text box blank (because what appears here will be determined by the asp file)?

      Or am I barking up the wrong tree? Can the date be written using Action Script? I would be grateful for any advice/tutorial links on how to do it, if possible, but it is important that the date is written in this format:

      1st February 2007
      22nd December 1978
      3rd May 2000
      4th October 2005


      Many thanks.

        • 1. Better in AS or ASP?
          Greg Dove Level 4
          You could do it either way, depending on whether you want the server date or the local date (they can be different by a day depending on where you are in the world!). It would probably be easiest if you were doing it from the server to pass it in as a flashvar.

          But its even easier inside flash (NOTE : This is as2 code). Try pasting this code on the timeline. I think it will do something like what you need.

          • 2. Re: Better in AS or ASP?
            SteveH59 Level 1
            Hello GWD

            Very many thanks for your time.

            Actions Script would remove the need for an external .asp file which probably makes things easier. I have come across this before about pasting code on the timeline, but what does it mean? How can I paste code there? The date would need to be visible throughout the site. Do I create a Dynamic Text box at the top of my page and paste your script into Action Script? I don't think that is what you mean, do you?

            I'm gateful again for your help and apologies for my naivete!

            • 3. Re: Better in AS or ASP?
              Greg Dove Level 4
              to try that code, just do this:

              File--> New
              (if you're using CS3, choose Flash File actionscript 2 )

              1.click on the first frame in the timeline, so you see it selected.
              2. in menu, choose Window-->actions
              3. paste that code in there
              4. Ctrl-Enter to test Movie

              If you have a textfield that is 'Dynamic' that you put on stage manually, and you give it the name 'dateField' in the properties panel, then you can remove the line it that code that starts with 'this.createTextField...'

              • 4. Re: Better in AS or ASP?
                SteveH59 Level 1
                Hello GWD

                Many thanks again for your message.

                I decided to crate a new layer, then a dynamic text box, input dateField in the 'instance name' field and then copied and pasted your script. I needed to position the text box a little and messed about with a couple of colours and, do you know what?

                IT WORKS!!!!!!!!!

                I'm delighted! It looks great!

                Very many thanks for all your help and patience!

                • 5. Re: Better in AS or ASP?
                  Greg Dove Level 4
                  You're welcome.
                  • 6. Re: Better in AS or ASP?
                    Greg Dove Level 4
                    Actually I just realised an error with my code.

                    It will output

                    and 12nd
                    Because I was just checking the last digit and didn't think about those exceptions. I just thought about that. I'll fix it and correct the original code above. Give me 5 mins from the time of this post.

                    • 7. Re: Better in AS or ASP?
                      SteveH59 Level 1
                      OK, no worries. That has happened to me before in VB script.

                      I'll look out for your post.

                      Thanks again.

                      • 8. Re: Better in AS or ASP?
                        Greg Dove Level 4
                        I already corrected it above in the original code I posted.