3 Replies Latest reply on Apr 7, 2007 1:26 PM by Newsgroup_User

    Automatic code functions

    tdriley Level 1
      Hi, i've been experimenting with ways of making it quicker to build file launcher menus in director, ie - you've got 500 different PDF files with all sorts of filenames that you need to build a menu interface for, but don't want to type out new mouseup behavious for every single link.

      At the moment, the best I've come up with is this (using buddyAPI) - it opens the file which has whatever name that is the text of the text member that the user is clicking on:

      on mouseup me

      baOpenFile(_movie.Path & "Files" & delimiter & sprite(me.spritenum).member.text & ".pdf", "")

      end

      That seems to work quite well, but it is limited by exactly what it does! - I cannot have text that says one thing, but launches a file with an (even slightly) different name. Also it messes up if any of the filenames are long and get changedwhen I burn to disc.

      Anybody have any similar functions/ways to automate making file launcher code?

      Thanks!
        • 1. Re: Automatic code functions
          SafariTECH Level 1
          If you use a database app (i.e INM) you could use one field for the menu information and another field for the file ... when they click on the menu item have the database lookup the file name based on the criteria pulled from the menu and open it using Buddy.

          It adds another expense, but once you have that DB xtra (that is x-platform) it can be used in so many ways for so many projects.


          The filename thing is a horse of a different colour though ... CDs, especially to be B/C and X-platform, need to be in ISO/UDF format and that means you are only allowed filenames of a certain length. You should ensure all the files follow strict ISO limits to ensure you have no issues on older platforms or other OS's. I think you are allowed 11 characters for strict ISO.



          • 2. Re: Automatic code functions
            tdriley Level 1
            great, sounds good, i'll look into it.

            thanks
            • 3. Re: Automatic code functions
              Level 7
              You could add a getPropertyDescriptionList handler so that you can
              re-use a single behavior. You could even have it present a browse dialog
              so that you can select the file to open rather than (mis-)typing its
              filename.