7 Replies Latest reply on Sep 5, 2007 12:32 PM by kglad

    External AS code will not pass through

    Rylz

      I can't figure out why script that works in Flash does NOT work when placed in an external AS!? As an example:

      employment_alpha_btn.onRelease = function() {
      gotoAndPlay("eaccess_rollout_to_employment");
      }

      This will work when placed on a frame in Flash, but it will NOT work when put in an external AS. However, I have other commands in the same external AS that work just fine:

      corpcomp_alpha.onRollOver = function() {
      gotoAndPlay("corpcomp_grow");
      };

      Can anyone help? Can you not do onRelase in an external AS? I'm stuck...
        • 1. Re: External AS code will not pass through
          kglad Adobe Community Professional & MVP
          your include statement probably is located on a frame where employment_alpha_btn does not exist, yet.
          • 2. Re: External AS code will not pass through
            Rylz Level 1
            From what I can tell, it does exist. I have a layer that expands the entire scene, simply to have "#include 'eaccess_buttons.as'" and make sure it runs throughout the scene. The scene lasts 115 frames and the aforementioned layer only has the one keyframe in frame 1, expanded to the last frame.

            Oddly enough, I just put in two more commands for it in the external AS: onRollOver & onRollOut. They work just fine and dandy:

            employment_alpha_btn.onRollOver = function() {
            employment_alpha_btn._alpha = 100;
            }
            employment_alpha_btn.onRollOut = function() {
            employment_alpha_btn._alpha = 50;
            }

            Again, within the same AS, here is an onRelease command that works (and does so on 15 other buttons):

            chartlink_alpha.onRelease = function() {
            var myStyle:TextField.StyleSheet = new TextField.StyleSheet();
            myStyle.load("index.css");
            eaccess_body.styleSheet = myStyle;
            eaccess_body.multiline = true;
            eaccess_body.wordWrap = true;
            eaccess_body.html = true;
            var story:XML = new XML();
            story.ignoreWhite = true;
            story.load("chartlink-explain.html");
            story.onLoad = function() {
            eaccess_body.htmlText = story;
            };
            }

            I'm so lost and confused...
            • 3. Re: External AS code will not pass through
              kglad Adobe Community Professional & MVP
              put a trace statement on your onRelease handler to see if it's executing. if it is, you have a movieclip reference issue or a frame label issue. otherwise, you may have another onRelease handler that's executing after your include statement.
              • 4. Re: External AS code will not pass through
                Rylz Level 1
                Gah! Now it works! I can't figure this out. Yes, every time I made a change in the external AS, I would save it and then re-publish the .fla. Every single time. Why would it all of a sudden start working?! It just doesn't make sense to me. I mean, hurray that it's working, but I'm afraid that it'll just stop working one day. Anybody have thoughts as to why it would not work and then work? There shouldn't be a "cache" in Flash, should there? I'm doing all of my SWF tests by doing the preview (CTRL+ENTER), so that should rule out the browser caching something.
                • 5. Re: External AS code will not pass through
                  kglad Adobe Community Professional & MVP
                  the only thing for certain is that it's not a flash issue: you erred.
                  • 6. Re: External AS code will not pass through
                    Rylz Level 1
                    OK, that's good enough for me. I can take critique on my own errors, so long as Flash wasn't doing something wrong or I was using the wrong commands. I'll triple-check my spelling and move on. Thanks for the help!
                    • 7. Re: External AS code will not pass through
                      kglad Adobe Community Professional & MVP
                      you're welcome.

                      p.s. i can't tell you how many times of debugged an .as file, making changes and failing to save that file, and have then be bewildered by seeing the same problem in the test environment. you must SAVE the .as file for the published swf and the swf in the test environment to reflect those changes.