6 Replies Latest reply on Aug 31, 2007 9:00 AM by Bob_Robertson

    Weird code problem

    Bob_Robertson Level 1
      I'm trying to create a hotkey of sorts. The idea is that the user should press Crtl-Shift-T to make the movie jump to a special frame. The code attached works correctly when put onto an empty frame in a fresh movie. However, when I use the exact same code (literally a copy-paste) in the intended application, it doesn't trigger. I have Control->Disable Keyboard Shortcuts enabled, and I have observed this behavior both locally and remotely.

      Could someone more experienced please advise me in what could be causing this? I've never seen anything of the sort before.

      Many Thanks,
      Bob Robertson
        • 1. Re: Weird code problem
          Bob_Robertson Level 1
          Okay, found something interesting. When I publish the application for players 7 and 8, things work perfectly. However, when I try to publish for 6 and under, it doesn't work. This is not the case for other applications of the same kind that I have worked on: publishing for 6, 7, and 8 all work correctly.

          Does anybody have any idea what's going on here? I have to publish for player 6; that's unavoidable. At the same time, I need this feature to work properly, and I don't know how to even start debugging something like this.

          Many Thanks,
          Bob Robertson
          • 2. Re: Weird code problem
            kglad Adobe Community Professional & MVP
            try:

            • 3. Re: Weird code problem
              Bob_Robertson Level 1
              No joy, unfortunately. I did discover an additional datum, though. Somehow, my app is killing the Key service class entirely:

              When I trace typeof(Key) in both the good and the trouble apps, it outputs 'movieclip'.

              When I trace typeof(Key._listeners) in a normally functioning sister app, it outputs 'object'; when I trace typeof(Key._listeners) in the problem app, it outputs 'undefined'.

              When I trace Key._listeners.length after adding a listener in the functional version, it returns '1'; when I trace Key._listeners.length after adding a listener in the trouble app, it returns 'undefined'.

              This is utterly bizarre, and I've never encountered anything like it before. The only place the 'Key' keyword shows up is in the listener definition. Have you seen this before? Have I found a compiler bug?

              Thanks,
              Bob Robertson
              • 4. Weird code problem
                Bob_Robertson Level 1
                /*repost*/
                Whoops, sorry. Firefox isn't getting along with the server, apparently.
                • 5. Re: Weird code problem
                  kglad Adobe Community Professional & MVP
                  i've never had a problem with the key class and i don't recall seeing any posts about others having similar difficulties.

                  to find the issue, i would make a copy of your problem application and start eliminating major chunks of code and objects until the problem is narrowed. you should be able to find the essential part of your code/objects that cause your key problems.

                  but you should be using the code i gave: you can't reference myOnKeyDown before it is defined.
                  • 6. Re: Weird code problem
                    Bob_Robertson Level 1
                    No joy, unfortunately. I did discover that my app is apparently somehow killing the Key instance, though:

                    When I trace typeof(Key) in both the trouble app and a working sister app, it outputs 'movieclip'.

                    When I trace typeof(Key._listeners) in the working app, it outputs 'object'; when I do it in the trouble app, it outputs 'undefined'.

                    When I trace typeof(Key._listeners.length) in the working app, it outputs 'number'; when I do it in the trouble app, it outputs 'undefined'.

                    When I trace Key._listeners.length in the working app after adding a listener, it outputs'1';when I do it in the trouble app, it outputs 'undefined'.

                    The 'Key' keyword doesn't even appear in the app besides at that point, so I don't know how it's getting corrupted. I've never encountered anything like this before. Do you have any ideas? Have I found a compiler bug? Am I doing something tacitly verboten that no one mentioned?

                    Many Thanks,
                    Bob Robertson

                    PS: sorry if this is a multiple repost; I think something's wonky with the combination of the servers, my machine, and the proxy I'm going through.