19 Replies Latest reply on Jul 25, 2012 10:42 AM by jthatcher@wvsom.edu

    Launching swf files with Director

    jthatcher@wvsom.edu

      I recently obtained Adobe Director 11.5 to create a menu for launching a series of Flash CS4 files.  I worked through Dean Utian’s excellent tutorial and found the following script to program a button to launch another Director file.  However, I can’t figure out how to get it to launch a swf file.  If someone could tell this poor soul how to get Director to launch swf files I would really appreciate it.  Thatch

       

      on mouseUp me    

        play movie "FileName”      

      end

        • 1. Re: Launching swf files with Director
          Sean_Wilson Adobe Community Professional

          Firstly, you shouldn't use the 'play movie' command unless you really understand the consequences. Better to use the _movie.go() command

           

          What do you want to do with your SWF files? Are they imported into Director, or are they external (with path dependencies, i.e. do they in turn load other SWF files or communicate with a web server)? Or are they standalone executable applications?

          1 person found this helpful
          • 2. Re: Launching swf files with Director
            jthatcher@wvsom.edu Level 1

            Thanks for the tip; I will play with the _movie.go() command.

             

            To answer your questions, my SWFs are standalone executable applications.  They are animated lessons presenting different topics for embryology, cell biology and genetics.  They are designed as visual aids for one to two hour lectures.  I’ve also programmed them with buttons that allow students to use them from self-study.   They are too large and there are too many to import into a single Director file, so I think they need to be linked externally.  They do not communicate with a web server but a few are programmed with buttons to load accessory SWFs. 

             

            I think it might be a good idea to explain what I’m trying to accomplish with Director.  My ultimate goal is to distribute these animations.  If instructors and students at other schools are going to accept them there must be a facile method to open them.  Trouble is to open an SWF you have to use Explorer, which requires about seven clicks of the mouse. So I’m hoping to use Director to create a file that will open on its own, and can be used as a menu to launch the SWFs

            • 3. Re: Launching swf files with Director
              James Newton, ACP Level 3

              Hi Thatch,

               

              Director 11.5 will certainly make it easy for you to do what you are planning to do.

               

              Can you share the link to the tutorial that you mentioned, so that we can see where you are starting from? Would it be possible for you to share links to a couple of SWF files that combine to form a single lesson, with one loading the other as an accessory?

              1 person found this helpful
              • 4. Re: Launching swf files with Director
                jthatcher@wvsom.edu Level 1

                Of course I would be happy to; I always love to show off my work.  The tutorial is at http://www.deansdirectortutorials.com/scripting/tut14.htm.  I've published a number of my Flash Animations on the HEAL and BEN websites.  Unfortunately HEAL is down for repairs but you can get to the BEN collection at http://www.apsarchive.org/.  Use their search engine with my name "Thatcher."

                 

                Now the stuff on these sites are excerpts from the lessons, and none of them link to additional SWFs.  I would be happy to send you a couple of the actual SWFs, but I don't know if I can send them through this forum and due to copyright concerns I don't think I should.  If you would provide me with your E-mail address and name I would be happy to zip them over.  I've used my E-mail for my ID (really should change that to something more interesting).  Thanks much, Thatch

                1 person found this helpful
                • 5. Re: Launching swf files with Director
                  James Newton, ACP Level 3

                  OK. I can see why Dean is suggesting the use of play... and play done. In his particular case, when you have finished viewing a child movie, you want to return to the main movie to choose another child movie. In your case, you want to view an SWF movie, not a Director movie, you will gain little advantage (and many potential headaches) from using play...

                   

                  To get your system to work it's important to test using SWF-movies-that-load-SWF-movies. I've sent you a private email on how to share a set of files like this with me.

                  • 6. Re: Launching swf files with Director
                    Dean Utian Adobe Community Professional

                    Other's have responded but I'll add something too - particularly since it was my tutorial that was being used:)

                     

                    That tutorial you've used is one I have long felt I should update but then get distracted and never get around to it. As was mentioned, I included 'play' because I wanted to illustate 'play done'. When you link to say movie3.dir from movie2,dir through 'play "movie3"', then 'play done' will link back to movie2.die. In othwr words, Director keeps track of every time 'play' is activated and allows you to backtrack along that list.

                     

                    The other way to link one movie to another is -
                      go to "markerName" of movie "movieName"

                    - or in an alternate syntax

                      _movie.go("markerNam", "movieName")


                    You can make Director launch a file with the associated program. I'd suggest using the Buddy API Xtra (http://www.mods.com.au/) with the following
                    on mouseup me

                      baOpenFile( the moviePath & "filename.swf" , "maximised" )

                    end


                    The above would work with swfs if you have the Flash Player installed. It works for all files and has often been used for launching PDFs with Aacrobat.

                     

                    Dean

                    • 7. Re: Launching swf files with Director
                      jthatcher@wvsom.edu Level 1

                      I’m reaching out from a disaster zone, trees blown down all over the place and no power.  I found a live socket to recharge my battery, but I have to get this message out before it goes dead again.

                       

                      I’ve experimented with various options for using Director to launch SWFs.  I’ve programmed buttons with the go movie"FILENAME.swf", _movie.go("", "FILENAME.swf") and play movie "FILENAME.swf" commands and nothing works (I know play movie isn’t advised, but I wanted to cover all the bases).  In each case I get an error message complaining that the SWF isn’t a Director file.  I tried it with and without the swf extension, no luck.  OpenSpark, did you get the same result with the files I downloaded into the dropbox?

                       

                      I also tried using Flash Component Buttons instead of Default Buttons.  Every time I tried that the button went completely dead, no response what so ever when I clicked it.  There’s the first question I have; do Flash Component Buttons require different script, if so what, and is that worth pursuing.

                       

                      The one promising result I‘ve had was to import an swf into a dir file and publish that as an exe or html.  The trouble is sometimes it works, other times not so much.  I’m still experimenting; hopefully I can figure out why (assuming I can find more power to recharge my battery).  I will say I’m not entirely satisfied with this solution.  All I’m doing is using Director to produce an exe or html to run the swf.  If I knew more about programming I could do that directly.  More importantly, I doubt this will allow me to take advantage Director’s full power. 

                       

                      Hope everyone else in the storm’s area is doing fine.  Thatch

                      • 8. Re: Launching swf files with Director
                        Dean Utian Adobe Community Professional

                        @jthatcher - sorry to hear things are rough at your end, both weather wise and Director.

                         

                        The Lingo you're using is giving errors as it is meant for launching Director movies only, not SWFs. You can link to a Director movie with a SWF embeeded and displayed on the stage. If you wnat to launch an external Flash Player that displays the SWF, you can use the BuddyAPI approach I mentioned before. Or you can link your Director movie to a HTM that calls the SWF.

                         

                        Dean

                        • 9. Re: Launching swf files with Director
                          jthatcher@wvsom.edu Level 1

                          Hi Dean, no need to be sorry about my problems; challenges are what make life interesting.  I have had some success with embedded SWFs, but sometimes they work and sometimes not so much.  I want to experiment to see if I can figure out how to get consistent results before I bother the forum with the gory details.  If that doesn't work I am very interested in exploring the BuddyAPI you suggested.  I looked it up and it looks like it will cost $255.  I'll be happy to pay that if necessary, but I want to be sure it will work.  One question I have for you.  You mentioned that I will need Flash Player.  I just want to confirm that you don't need the entire Flash program, just the player.  I have the program installed on my computer and I wouldn't want to get everything running just to discover that no one else can run it.

                           

                          One other thing.  You mentioned wanting to upgrade your tutorial.  That might be a good idea but I want to say that I found the tutorial an extremely helpful tool to get me started.  I reviewed your files and found the _movie.go command mentioned elsewhere.  This is just a case of a novice needing guidance to get started.  I have been very impressed with the helpfulness of this entire forum.  Thanks much.

                          • 10. Re: Launching swf files with Director
                            Dean Utian Adobe Community Professional

                            When your embedded SWFs don't work, what happens?

                             

                            Buddy API Xtra is free for limited use. So, if you are using it for just 1 function to launch an external file, it won't require you to buy the full version.

                             

                            On the Flash Player side, what I was reffering to was an external player that opens the SWF without the need to go to a browser. This Flash Player is set up when you install Flash. I'm npt 100% sure if you can download this without having Flash. If you link to a HTM that calls the SWF (which can be done without an Xtra), then it will play in a browser providing the end user has teh Flash plugin installed.

                             

                            Dean

                            • 11. Re: Launching swf files with Director
                              jthatcher@wvsom.edu Level 1

                              Ye, I was afraid that was the answer.  It probably rules out Buddy API.  My main objective is to allow users to open my animations directly, without the seven clicks required with Explorer.  A Xtra that only allows people to open it if they have Flash installed on their computer would not promote general distribution.  I understand that a link to HTM could avoid this problem, but I've had some success with HTM so I don't think I will need Buddy API.  I am having some problems with HTM, but I think I can work them out.  If not I will reconsider Buddy API.  Thanks for all your help, Thatch

                              • 12. Re: Launching swf files with Director
                                jthatcher@wvsom.edu Level 1

                                I’m so close but you know the saying, close only counts with horseshoes and bombs.  I tried importing SWFs into dir files, and publishing as exe and HTMs.  In both cases I got the SWFs to play, but in each case there’s a problem.  I’ve tried everything I can think of, so I’m asking if anyone can help this poor soul.

                                 

                                When I publish as an exe projector all the action script works, including the buttons that launch other SWFs.  The problem is when I maximize the window the SWF cast member doesn’t stretch.  It winds up in the upper left corner of the window, without increasing in size.  I thought about accepting this because it does give me full functionality, but it just looks too bush league. 

                                 

                                When I publish as an HTM I can get the SWF cast member to stretch, and most of the action script works, but I can’t get the buttons to launch other files.  Dean, I tried rereading your tutorial file called “Creating Director Shockwave,” but I couldn’t figure it out.  I also referred to the Director Bible by Underdahl, Nyquist and Martin, but that didn’t help. 

                                 

                                So now I’m stumped.  Any suggestions?  Dean do you still think Buddy API might work?  You also suggested linking to an HTM that calls an SWF, but I’m not sure how that would work.  Any guidance you or anyone else can give will be greatly appreciated.  Thatch

                                • 13. Re: Launching swf files with Director
                                  Sean_Wilson Adobe Community Professional

                                  In order to have your SWF stretch when you resize the stage window, you need to add some code to make this happen. Try adding the following handlers to a #movie script and re-publish your projector:

                                  on resizeWindow

                                    aw = _player.activeWindow

                                    awRect = aw.rect

                                    aw.drawRect = awRect.offset(-awRect.left, -awRect.top)

                                  end

                                   

                                  on zoomWindow

                                    resizeWindow()

                                  end

                                  • 14. Re: Launching swf files with Director
                                    Dean Utian Adobe Community Professional

                                    Hi Thatch,

                                     

                                    To clarify what you're doing - you want an EXE that lauches something that plays SWFs. From what I understand you created 2 versions:

                                    1. An EXE that launches an HTML that calls a DCR, where the SWF is embedded into the DCR.

                                    2. An EXE that launches another EXE with the SWF.

                                     

                                     

                                    Is the above correct? And do you want the DCR or EXE to fill the screen and the SWF inside it to strectch?

                                     

                                    To get the SWF to resize in an EXE, apply the script Sean suggested. To get the DCR to resize to fill the browser window, go to the HTML tab of the Publish Settings window and choose Sreatch Style - Stretch to Fill.

                                     

                                    Dean

                                    • 15. Re: Launching swf files with Director
                                      jthatcher@wvsom.edu Level 1

                                      No luck.  Let me be sure I did it correctly.  I pasted your script into the script channel.  Is that what you meant by a "#movie script?"  The frame already had script to pause the movie, so the final script read as follows.  Any suggestions for what to try next?

                                       

                                      on exitFrame

                                        go to the frame

                                      end

                                       

                                      on resizeWindow

                                        aw = _player.activeWindow

                                        awRect = aw.rect

                                        aw.drawRect = awRect.offset(-awRect.left, -awRect.top)

                                      end

                                       

                                      on zoomWindow

                                        resizeWindow()

                                      end

                                      • 16. Re: Launching swf files with Director
                                        jthatcher@wvsom.edu Level 1

                                        Hey Dean,

                                         

                                        To answer your questions I did try 2 versions.  In both cases I imported an SWF into a DIR. 

                                         

                                        With one version I published as an EXE.  However, I am not using it to launch another EXE.  The embedded SWF launches other SWFs directly.  The problem with this version is the embedded SWF won't resize. 

                                         

                                        For the other version I published as an HTML.  This does call the SWF embedded into the DCR, and I did get it to stretch.  The problem is I get it to launch additional SWFs.

                                         

                                        As you can see I did try Sean's suggestion but it didn't work.  However, I hope we're getting close.

                                         

                                        Thanks much, Thatch

                                         

                                        • 17. Re: Launching swf files with Director
                                          Sean_Wilson Adobe Community Professional

                                          I pasted your script into the script channel.  Is that what you meant by a "#movie script?"

                                          No, that's not a #movie script.

                                           

                                          Open your Director file and press Ctrl + Shift + U and a script window of the correct type will open. Paste in the handlers I posted, save, publish and test

                                          1 person found this helpful
                                          • 18. Re: Launching swf files with Director
                                            jthatcher@wvsom.edu Level 1

                                            Thank you, thank you, thank you.  That solved the problem.  It's works wonderfully.  There's only one minor issue where the proportions aren't maintained when it stretches, but that's very minor.  It's doing everything I need.  Thanks again to everyone on this forum; I am very impressed with the group.  I'm actually on vacation now, but when I get back I'll write up a synopsis of the procedure we developed in case anyone else wants to do what I've done.  Thanks again, Thatch

                                            • 19. Re: Launching swf files with Director
                                              jthatcher@wvsom.edu Level 1

                                              I don’t know if anyone else will ever need to do this, but just in case I thought I should share the final protocol we developed.  This will embed a Flash SWF file into a Director DIR, so it can be published in a form that can be opened directly, without the multiple clicks required to open an swf with Windows Explorer (or the MAC equivalent).  It has been tested with Director 11.5 and Flash CS4.  I hope my shorthand is clear.  Dean Utian, Sean Wilson and James Newton all helped me with this, and support their support was far above and beyond the call of duty. 

                                               

                                              1.) Resize the Director stage to match the Flash stage

                                              Click the Director stage > Windows > Property Inspector > Stage Size > 550 x 400

                                              (alternatively you can compose the Flash file with a stage that matches Director’s.   640 x 480 is the default)

                                               

                                              2.) Embed the SWF into Director

                                              File > Import > Browse to File > Import

                                              Drag cast member from cast window to stage

                                              ctrlK > distribute horizontal across stage > distribute vertical across stage

                                               

                                              3.) Type a pause script into the script channel of the score

                                              on exitFrame

                                                go to the frame

                                              end

                                               

                                              4.) Open the movie script window (Ctrl + Shift + U) and type in stretcher script (this allows the SWF cast member to resize if the final window is maximized)

                                              on resizeWindow

                                                aw = _player.activeWindow

                                                awRect = aw.rect

                                                aw.drawRect = awRect.offset(-awRect.left, -awRect.top)

                                              end

                                               

                                              on zoomWindow

                                                resizeWindow()

                                              end

                                               

                                              5.) Set publication settings

                                              File > Publish Settings > Projector > Shockwave

                                                                                                    > Center stage in monitor

                                                                                   > Shockwave > Allow movie scaling

                                                                                   > Html > Template > Shockwave Default

                                                                                              >  Stretch Style > Preserve Proportions

                                                                                              >  Stretch Position > Horizontal Align

                                                                                              >  Stretch Position > Vertical Align

                                                                                              >  Dimensions > Percentage of Browser Window

                                                                                              >  Width > 100

                                                                                              >  Width > 100

                                                                                   > Formats > Windows Projector (Creates an exe for Windows)

                                                                                                    > Macintosh Projector (Creates an app for MACs)

                                                                                                    > HTML (Creates an htm and dcr for Windows or MACs)

                                               

                                              1. 6.)Publish the movie

                                              File > Publish

                                               

                                               

                                              The Windows Projector will create a single exe file that can be opened by double clicking the icon.  If your SWF has addChild script, it will launch a second SWF, but the second SWF must be in the same folder as the exe. 

                                               

                                              The Macintosh Projector will create an app application that can be opened by double clicking the icon.  However this application actually consists of a folder with several subfolders and files.  You will not see this with the MAC file directory, but you will if you try to E-mail the application.  If your SWF has addChild script, it will launch a second SWF, but the second SWF must be in the same folder as the app.

                                               

                                              The HTM Projector will create a htm file and a dcr shockwave file.  Both must be in the same folder, and the user must double click the htm icon to open the dcr.  If your SWF has addChild script it will not launch a second SWF.