3 Replies Latest reply on Oct 20, 2011 7:16 PM by Professor S.

    Why won't my D8 code work in D11.5?

    Professor S. Level 1

      I have been running some eductional apps that I built for students for years in D8 and D10.  I upgraded to 11.5 two years ago, but could not get my apps to work and have not had the time to figure out why, so I don't use  it.  Unfortunately now, Apple has dropped Rosetta in Lion and so my projectors produced on Windows will not work on the latest Mac. Here is an example of some code from one of my apps that has problems. The first is a frame script that controls a basic dialog.  The students clicks a sentence on the stage (sprite 2) and the program responds with an answer above in "FAResponse" field. I used to use an on mouseUp handler in the frame script but that stopped working in D5 or D6 (I can't remember) and someone here told me to use a behavior script under my sprite 2 called dialogEngine, which is supposed to return the number of the sprite clicked. It used to work.  Now it returns VOID to the frame script.  Why is that happening now? Before I could click on sprite 2, 3 or 4 and the behavior script would return the sprite number clicked to my frame script. How do I fix this?


      The second problem is where I set the text of field "FAResponse" = "  to the response to the question clicked.   They used to show in white over a black background. Now nothing shows up.  I spent hours trying to figure out why and figured out that I now need an updateStage before setting text in the response field. Why do I have to do this now?  I have several lines in the program that send text to the response field.  I tried placing the updateStage in the on Loop handler (since I only need one updateStage) which waits for a SPACE to continue the discussion but that doesn't work. Is there a way to get the text to appear in the FAResponse filed without updatStage or  a way to update without having to do it before hundreds of places in the program?  This was not easy to explain.  I hope someone can help, thanks!


      Frame scripts:


      on exitFrame

        go to the frame



      on dialogEngine me, spriteNumber 

      global gPam1Response1, gPam1Response2, gPam1Response3, gNumTicks, gTalkedManager1 

      put spriteNumber  -- I checked to see what my behavior script under sprite was returning and found it to be VOID

        if spriteNumber = 2 and gPam1Response1 = 0 then 




            gNumTicks =.4*60


            set the foreColor of member 8 to 0

            set the text of field "FAResponse" = "Great, first you need to familiarize yourself with the company."  

            gNumTicks = 4.8*60


            set the text of field "FAResponse" = ""

            gNumTicks =.3*60


      else if spriteNumber = 2 and gPam1Response2 = 0 then





      dialogEngine behavior for above frame script:


      on mouseUp me

        -- simply tell the frame script that this sprite was clicked


        put "dialog behavior executed"



      movie script handlers for frame script above:


      on countTime

        global gNumTicks


        repeat while the timer < gNumTicks


        end repeat

      end countTime


      on loop

        put "on loop executed"

        global gToggle

        if gToggle = "space" then

          repeat while the keypressed <> SPACE


          end repeat



        end if

      end loop

        • 1. Re: Why won't my D8 code work in D11.5?
          Wolfgang Herold Level 2

          1. are you shure that behaviours on invisible sprites are executing.

          2. I never sent a message to sprite(0), maybe that does not work anymore.

              I suggest to add an invisible sprite ( positioned outside of the visible area) and attach your "on dialogengine me..."

              inside a spritescript attached to this "invisible" sprite.




          • 2. Re: Why won't my D8 code work in D11.5?
            Sean_Wilson Adobe Community Professional

            In order to get the spriteNum sent to the frameScript, try altering your mouseUp handler to:

            on mouseUp me
              --  tell the frame script that this sprite was clicked
              sendAllSprites(,#dialogEngine, me.spriteNum)
              put "dialog behavior executed"


            Your other problem/s I suspect are related to the tight repeat loops you involve in the #countTime and #loop handlers (I would suggest renaming your 'loop' hander to something that isn't a Director keyword). Altering your code to avoid these loops won't prove easy but is something you should try in a limited fashion to see if it helps.


            Also, the updateStage() command is broken on the Mac platform - I forget details (whether only SW or projectors too) and this isn't documented in a TN anywhere either.

            • 3. Re: Why won't my D8 code work in D11.5?
              Professor S. Level 1

              Thanks Sean, you're a life saver. This got me going and now I have discovered more problems - this time with windows and communicating from a MIAW to the stage.  Will open in a new thread.