1 2 Previous Next 57 Replies Latest reply on Nov 21, 2007 6:27 PM by kglad

    Why error message?

    eddiwill9 Level 1
      I am attempting to learn to do in Flash some things I have typically done in Director. Needless to say, it's been a tough go. I have been using some of the Lynda.com stuff and it's been helpful, but I now have a problem I can't figure out. I am using a script that Lynda.com uses in their tutorial movies. I copied it (except using my names for things, of course) and from what I can tell, I did it correctly, but I keep getting an error message. Here is my action script (in it's own layer):

      stop();

      function onIntroClick(evt:MouseEvent):void {
      gotoAndStop("intro");
      }
      introbut2jpg.addEventListener(MouseEvent.CLICK, onIntroClick);

      It's just a graphic I turned into a button that should jump to the frame labeled "intro" and stop there. Works great in the tutorial, but I get:

      Location: Scene = Scene 1, layer = Actions, frame=39, Line 3
      Description: The class or interface 'MouseEvent' could not be loaded.
      Source: function onIntroClick(evt:MouseEvent):void {
        • 1. Re: Why error message?
          eddiwill9 Level 1
          Got cut off:

          I wonder if it's because I have the button swap out onmouseover? I tried the script with both button names (the normal state name as well as mouseover state name, but it didn't help).

          I would greatly appreciate any help; I am SO close to actually completing this thing! :)

          • 2. Re: Why error message?
            kglad Adobe Community Professional & MVP
            change your publish settings (file/publish settings/flash) to actionscript 3.
            • 3. Re: Why error message?
              eddiwill9 Level 1
              Wow! That was fast! Thank you so much-- it fixed it!

              BUT, I now have a new error (of course!):
              WARNING: The component 'FLVPlayback' requires ActionScript 2.0.

              I am guessing this is the movie that I have in place that should play when it goes to that frame. Is there an easy way around this?

              Sorry for what must be very basic questions-- been awhile since I've been such a newb!
              • 4. Re: Why error message?
                kglad Adobe Community Professional & MVP
                when you had your publish settings set at as2, you added an flvplayback component. delete that from your library. while your publish settings are set at as3, add an flvplayback component. retest.

                (while the two components look the same, they are not. as2 components will not work in as3. flash changes your component library when you change your publish settings so you can't pick the wrong component version (unless you change your publish settings).
                • 5. Re: Why error message?
                  eddiwill9 Level 1
                  kglad,

                  I can not thank you enough. I haven't had to learn something from the ground up in years and help from folks like you is invaluable.

                  I will give it a shot now.
                  • 6. Re: Why error message?
                    kglad Adobe Community Professional & MVP
                    you're welcome.
                    • 7. Re: Why error message?
                      eddiwill9 Level 1
                      So close.....

                      Switching to the as3 component killed that error message, but still having trouble with my original script (the button).

                      Now it says:
                      Description: 1120: Access of undefined property intro_butjpg.
                      • 8. Re: Why error message?
                        kglad Adobe Community Professional & MVP
                        there's some other code causing that problem. copy and paste it using the attach code option.
                        • 9. Re: Why error message?
                          eddiwill9 Level 1
                          Here it is. Not sure I did that correctly (attaching)
                          • 10. Re: Why error message?
                            eddiwill9 Level 1
                            I think I figured it out.. I had not named the instance of the button (I feel like I have to name things 3 or 4 times in 3 or 4 places-- haven't gotten the hang of it quite yet!).

                            Now the movie tests with no errors, but it doesn't appear to do what I have asked it to do, namely go to the frames labeled "intro" and play the movie I have there.

                            I'll keep messing with it and see if I can post the correct question for that problem.
                            • 11. Re: Why error message?
                              kglad Adobe Community Professional & MVP
                              "intro" needs to be the label of a frame in the timeline that contains that code. and it's best to use the goto methods, NOT the goto functions:

                              • 12. Re: Why error message?
                                eddiwill9 Level 1
                                Thanks again, but I must be more dense than usual this a.m.

                                Based on what I saw in the Lynda.com stuff (sorry-- all I have to go on at this point), I made a layer just to contain scripts and called it "Actions."

                                I have another layer called "movies" where I have 5 sections of frames (instead of frame numbers) labeled for each of the short clips I want to play. I have 5 buttons to click to get to the movies. I was just going to get this first button to work, (intro_butjpg, which should jump to the section of frames called "intro") and then copy and paste--and change accordingly-- for the other 4 buttons.

                                I am not sure where your new script should go.
                                • 13. Re: Why error message?
                                  kglad Adobe Community Professional & MVP
                                  that script is almost the same as yours. it would replace your script.

                                  use the trace() function to debug your code. place a trace() funciton on onIntroClick to make sure you function is being called. place a trace() on your "intro" frame.
                                  • 14. Re: Why error message?
                                    eddiwill9 Level 1
                                    Yes! That works great! I am still so new that I don't really understand WHY it works-- that's going to take some time and experience--and help, of course!

                                    I have also learned that if I have a stop action in the timeline BEFORE this script, this second script doesn't work. I guess stop really means "stop!" But moving it to a point at the same time as the stop action seems to be fine. Is that the best way to do it? I basically had the playback stop right after the buttons and all of the other graphics come on stage and just "wait" for the user to select a button.
                                    • 15. Re: Why error message?
                                      kglad Adobe Community Professional & MVP
                                      stop() stops your timeline from advancing, but does not stop code from executing. however, if you used "stop" instead of "stop()", the flash compiler may have thrown an error and refused to execute any code.
                                      • 16. Re: Why error message?
                                        eddiwill9 Level 1
                                        That's odd. If I have "stop()" even one frame prior to the script for my button, it won't execute. I don't get a message or anything, but the playhead doesn't jump. If I move my button script to the same frame, or a prior frame, all works fine.

                                        I'll just keep them together for the time being, since that works.

                                        I've taken up more than my share of your time today and don't want to wear out my welcome!
                                        • 17. Re: Why error message?
                                          kglad Adobe Community Professional & MVP
                                          if the timeline does not enter a frame that has code attached, the code will not execute. so, having stop() in a frame the plays prior to a frame that contains code will prevent the code from executing. having a stop() in the same frame as code, does not stop that code from executing.
                                          • 18. Re: Why error message?
                                            eddiwill9 Level 1
                                            Didn't think I would be back again so soon! Now that my nav button works, I have begun duplicating it. The only problem is, once you paly one movie and move to another, the first movie continues at the same time. I guess I need something to tell any previous movie to stop, while allowing the current selection to play.
                                            • 19. Re: Why error message?
                                              eddiwill9 Level 1
                                              I found this bit of code "not_set_yet.stop", which looks like it wants me to enter a particular video to stop. I need something that stops whichever of the 5 that may be playing.
                                              • 20. Re: Why error message?
                                                kglad Adobe Community Professional & MVP
                                                that "bit of code" means nothing in actionscript.
                                                • 21. Re: Why error message?
                                                  EddieWilliams
                                                  Oh well,that's what I get for poking around! :)

                                                  Is there a simple fix to globally stop whichever flv is playing so that the newly selected one plays alone?

                                                  Thanks!
                                                  • 22. Re: Why error message?
                                                    kglad Adobe Community Professional & MVP
                                                    you should apply the stop() method to the flvplayback instance that's currently playing.
                                                    • 23. Re: Why error message?
                                                      EddieWilliams Level 1
                                                      I have tried putting the stop in a couple of places; but can't figure out where the stop should go. I was thinking a stop needed to be at the start of each instance, so that whatever is playing when the new instance is selected will stop. Am I looking at it wrong?
                                                      • 24. Re: Why error message?
                                                        kglad Adobe Community Professional & MVP
                                                        do you have more than one flvplayback instance?
                                                        • 25. Why error message?
                                                          eddiwil9
                                                          Yes-- I am now thinking that I should have only 1 instance, and just have it load different content at different keyframes, yes?

                                                          Edit: I have now changed it to only one instance of the FLVPlayback-- that does seem like the smarter way, but it still doesn't stop a selection from playing when you go to another.
                                                          • 26. Re: Why error message?
                                                            kglad Adobe Community Professional & MVP
                                                            are you applying the stop() method to your flvplayback instance just prior to all your start() methods?
                                                            • 27. Why error message?
                                                              eddiwil9 Level 1
                                                              I have the stop()method starting each as for each button click, :
                                                              ____________
                                                              stop();
                                                              function onTeachingClick(evt:MouseEvent):void {
                                                              tl.gotoAndStop("teaching");
                                                              }
                                                              teaching_nav.addEventListener(MouseEvent.CLICK, onTeachingClick);
                                                              __________
                                                              but no as at all on the actual component instance itself. If I placed a stop() there, will it play anything at all?

                                                              I just placed a stop() at the beginning of one of the instances-- it didn't do anything. My error, I 'm sure!
                                                              • 28. Re: Why error message?
                                                                kglad Adobe Community Professional & MVP
                                                                no, that's not going to work.

                                                                show the code you use to start your flvplayback instance playing a flv.
                                                                • 29. Re: Why error message?
                                                                  eddiwil9 Level 1
                                                                  That's the only code I have (duplicated per each button/flv), sending it to the labeled area on each button click. Then I just use the component parameters to select which flv should be playing for that particular instance of the flvplayback.
                                                                  • 30. Re: Why error message?
                                                                    kglad Adobe Community Professional & MVP
                                                                    then you have different flvplayback instances and you can't use actionscript to control them unless you reference their instance names whenever and whereever you want to stop the play of one instance and start the play of another.

                                                                    • 31. Re: Why error message?
                                                                      eddiwil9 Level 1
                                                                      Great; I thought that might be the case.

                                                                      Is there a way that's fairly easy for a beginner to accomplish this (other than using different flvplayback instances?).

                                                                      Oh well, learning how NOT to do something is also pretty important! :)

                                                                      • 32. Re: Why error message?
                                                                        kglad Adobe Community Professional & MVP
                                                                        if you're using the flvplayback on your main timeline, from your library drag an flvplayback symbol to the first frame of your main timeline. give it an instance name. add a frame at the end of your main timeline so your flvplayback instance exists in all frame of your main timeline.

                                                                        now, you can use its _visible property in any frames where you don't want it to be visible and you can use its start() and stop() methods to start and stop playback and you can use its contentPath property to specify the flv to play.
                                                                        • 33. Re: Why error message?
                                                                          eddiwil9 Level 1
                                                                          Thanks-- I'll try that now.
                                                                          • 34. Why error message?
                                                                            eddiwil9 Level 1
                                                                            Testing this out, looks like a great solution!

                                                                            I see the as for the _visible property, but it won't let me apply to a component.

                                                                            The SkinAutoHide parameter works OK, unless the user mouses over the player area before they click the button. (I can fix that by setting it off stage in the beginning)

                                                                            EDIT: I think I understand-- I should apply the as for the _visible property in the timeline. Is that right?

                                                                            I just need to figure out how that is expressed. I realize I am in way over my head and that I MUST learn the structures of the as. Preferably, without someone breathing down my neck for thi sproject!
                                                                            • 35. Re: Why error message?
                                                                              eddiwil9 Level 1
                                                                              Ugh! I am close to pulling out what little hair I have! This works so well with 2 buttons, but whenever I add a 3rd, it breaks and I get this (in this case for the "mental" button):

                                                                              1120: Access of undefined property mentalbut.
                                                                              • 36. Why error message?
                                                                                eddiwil9 Level 1
                                                                                Here is the code for all 3 buttons playing the flvs:

                                                                                stop();
                                                                                var tl:MovieClip = this;
                                                                                function onIntroClick(evt:MouseEvent):void {
                                                                                tl.gotoAndStop("intro");
                                                                                }
                                                                                intro_butjpg.addEventListener(MouseEvent.CLICK, onIntroClick);


                                                                                stop();
                                                                                function onTeachingClick(evt:MouseEvent):void {
                                                                                tl.gotoAndStop("teaching");
                                                                                }
                                                                                teachbut.addEventListener(MouseEvent.CLICK, onTeachingClick);


                                                                                stop();
                                                                                function onMentalClick(evt:MouseEvent):void {
                                                                                tl.gotoAndStop("mental");
                                                                                }
                                                                                mentalbut.addEventListener(MouseEvent.CLICK, onMentalClick);
                                                                                ________

                                                                                I don't understand why it works with 1, then with 2, but not with 3.
                                                                                • 37. Re: Why error message?
                                                                                  Buntu
                                                                                  Hi,

                                                                                  Check the frame whether it has a label "mental" and also whether or not the button is being clicked. Put a trace statement in your onMentalClick function; something like trace("mentalbut clicked");

                                                                                  • 38. Re: Why error message?
                                                                                    eddiwil9 Level 1
                                                                                    Hi Buntu, Thanks for the input. The frames appear to be correctly labeled. As to running the trace statement, as kglad has discovered, I am in WAY over my head, without the proper foundation (which is coming, I hope, by way of a class in a few weeks) and so, I would need to know "exactly" where to place that script to make it work. Being a newb is a real drag...
                                                                                    • 39. Re: Why error message?
                                                                                      kglad Adobe Community Professional & MVP
                                                                                      flash doesn't think mentalbut is an interactivedisplayobject.

                                                                                      what kind of object is mentalbut? do you use that name somewhere else in your code (eg, as a variable name or a function name)?
                                                                                      1 2 Previous Next