31 Replies Latest reply on Feb 23, 2008 7:10 PM by kglad

    a movie clip button cant detect its AS code

    badhams
      On my root timeline the code below referencing a movie clip button, which cannot be detected when I place my mouse over it. It has been given an instance name. I dont know why it work. I have done other buttons the same way and they work.It only works when I place my code in the binary_mc timeline, which I dont want to do as I like to keep all of my code centralized.

      Any ideas?
        • 1. Re: a movie clip button cant detect its AS code
          kglad Adobe Community Professional & MVP
          you have a typo or path problem. or you have mouse handlers defined for whatIsBinary_mc.
          • 2. Re: a movie clip button cant detect its AS code
            badhams Level 1
            I am certain its not a typo as I used the find target option in AS. I cant see any code which directly relates to the Binary_mc in the movie explorer
            • 3. Re: a movie clip button cant detect its AS code
              kglad Adobe Community Professional & MVP
              on the timeline that contains homeButton_mc, place:

              trace(this);

              // and copy and paste the output panel result
              • 4. Re: a movie clip button cant detect its AS code
                badhams Level 1
                This code has been placed in the whatIsBinary_mc timeline as that is where the home button is located. I have attached the code below.
                • 5. Re: a movie clip button cant detect its AS code
                  rlc5611 Level 1
                  Can you replace the trace(this) with the attached in exactly the same place on the same timeline?

                  (And then attached what you get in the output window?)
                  • 6. Re: a movie clip button cant detect its AS code
                    rlc5611 Level 1
                    Wait. I have a better suggestion. In the main timeline where you have your onRelease function, place the attached and report back what you get in the output window. I attached the onRelease function to show that you should put that script right before it.
                    • 7. Re: a movie clip button cant detect its AS code
                      badhams Level 1
                      Please find attached.

                      From what i can see I have three movie clips apart from the buttons but I cant see why they are coming up instance 33 etc as they have been given instance names
                      • 8. a movie clip button cant detect its AS code
                        badhams Level 1
                        I cant get anything to come up when I try the second option

                        I thought it would be best if I was to uploda the file. The binary movie clip is on the fourth frame of the root time line and the buttons I am on about are in frame 170 of the binary_mc movie clip. The buttons work at the minute as I have put the code in the binary_mc frame but I would like to place the code in the main timeline as I did for the objectives mc.

                        http://download.yousendit.com/8DC6A75E7A087BCD
                        • 9. Re: a movie clip button cant detect its AS code
                          kglad Adobe Community Professional & MVP
                          you can't code for your buttons until they exist. you can put your handler code in a function that you call from frame 170 of binary_mc, so all your important code is on the main timeline.

                          otherwise, to put all of it on the main timeline, you'll need to create a loop on your main timeline that repeatedly checks the _currentframe property of binary_mc and when it reaches 170, then terminate the loop and define your handlers.
                          • 10. Re: a movie clip button cant detect its AS code
                            badhams Level 1
                            I kind of see what you. I dont get why if thats the case the first set of binary test buttons work
                            • 11. Re: a movie clip button cant detect its AS code
                              kglad Adobe Community Professional & MVP
                              i have no idea what you mean by the first set of binary buttons, but if you write code for an object before that object exists, the code will be meaningless because it applies to undefined objects.

                              so, if code for "the first set of binary test buttons work", those objects must exist when the code is executed.
                              • 12. Re: a movie clip button cant detect its AS code
                                rlc5611 Level 1
                                Well I did download that file and it is somewhat of a mess. But I did look inside the whatIsBinary_mc and I cannot find a single instance of anything called "homeButton_mc". What I did see was a (mc) button with the word "Home" written on it so I'm guessing that is the button you are trying to target. The LIBRARY name of that mc button is "homeBtn_mc" which is not the same as homeButton_mc. Regardless, the LIBRARY name is immaterial. The only thing that matters is the INSTANCE name and the INSTANCE name of that mc button is "whatIsBinaryHomeButton_mc" (not "homeButton_mc") so I suspect that if you had scripted the following, it would likely work if and only if the mc instance exists at the time you try to apply the code just as kglad said. But you clearly have the instance name of the movie clip wrong at the very least. I also see you are publishing for Flash 8 so remember that instance names are case sensitive. For example, homeButton and HomeButton would be two different instances.
                                • 13. Re: a movie clip button cant detect its AS code
                                  rlc5611 Level 1
                                  I looked at your FLA a little more and kglad is right. There is no possible way to target your whatIsBinaryHomeButton_mc clip from the _root timeline. When your _root timeline hits frame 4 where the whatIsBinary_mc itself becomes instantiated, that movie clip is also on its frame 1. So your AS to target a clip within that clip executes when the frame is entered but the clip you are targeting with that clip is not instantiated until frame 170 of the clip. Since you are running at 12 FPS, the clip you are trying to target with your _root AS will not exist until about 14 seconds after the AS is executed. So your script is wasted and does nothing.

                                  So if you truly need to target that button mc from the _root, what I suggest you do is place the whatIsBinaryHomeButton_mc on frame 1 of the whatIsBinary_mc rather than on frame 170 and make it invisible on frame 1 and until you reach frame 170 where you then make it visible. Of course making it invisible will effectively disable the button until you make it visible so your "Hellow" test wouldn't actually work.

                                  Frame 1:
                                  whatIsBinaryHomeButton_mc._visible = 0;

                                  Frame 170:
                                  whatIsBinaryHomeButton_mc._visible = 1;
                                  whatIsBinaryHomeButton_mc.onRollOver = function()
                                  {
                                  _root.onMouseRollOver(whatIsBinaryHomeButton_mc);
                                  }
                                  whatIsBinaryHomeButton_mc.onRollOut = function()
                                  {
                                  _root.onMouseRollOut(whatIsBinaryHomeButton_mc);
                                  }
                                  whatIsBinaryHomeButton_mc.onRelease = function()
                                  {
                                  _root.gotoAndStop("_mainMenu");
                                  }
                                  • 14. Re: a movie clip button cant detect its AS code
                                    rlc5611 Level 1
                                    The way you are scripting for buttons for your binary test from the main timeline, only the first question will work. None of the remaining questions' buttons will receive their script as they don't yet exist when you are trying to script them. Your "correct_mc" clip has no instance name so the BinaryCorrectContinueButton_mc button will be very difficult (although not absolutely impossible) to target. On the other hand, I cannot see that you have even attempted to script that button anywhere in the FLA.

                                    The bottom line is that you really need to rethink a lot of what you are trying to do and structure this differently.
                                    • 15. Re: a movie clip button cant detect its AS code
                                      badhams Level 1
                                      To be honest I do agree with you but its a project and the hand in date is close.When I have finished it I plan to look in flash a lot more. Its just the way I have got used to through my university studies
                                      • 16. Re: a movie clip button cant detect its AS code
                                        kglad Adobe Community Professional & MVP
                                        i gave two ways to solve the issue.
                                        • 17. Re: a movie clip button cant detect its AS code
                                          badhams Level 1
                                          Sorry kglad. Please accept my apologies. I have used your idea of placing the code when the button(s) are initiated

                                          Thanks again.
                                          Sorry to be a pain and post silly questions
                                          • 18. Re: a movie clip button cant detect its AS code
                                            kglad Adobe Community Professional & MVP
                                            you're welcome. and you shouldn't feel badly: i don't think anyone's made as many dumb mistakes as i've made. and your issue wasn't because of a dumb mistake.
                                            • 19. Re: a movie clip button cant detect its AS code
                                              badhams Level 1
                                              This gets better. I am trying to code a button at the same point when it exist but the code is not functioning correctly.

                                              Its a binary test button located in the binary test movieclip. It has a instance name but the code does not work correctly unless I do this.onRelease = function()
                                              {
                                              //do this
                                              }

                                              Using the _root.whatIsBinary_mc.button1.onRelease etc it does not work. It takes me to the main menu but I want it to take me to the next scene in the whatIsBinary_mc movie clip. I dont know why. I cant find any duplicate code using the movie explorer.

                                              Thanks
                                              Phil

                                              ps I used the find target option so I am sure its not a typo
                                              • 20. Re: a movie clip button cant detect its AS code
                                                kglad Adobe Community Professional & MVP
                                                if you want to control the whatIsBinary_mc timeline use:

                                                • 21. Re: a movie clip button cant detect its AS code
                                                  badhams Level 1
                                                  Is that not just the same as the _root one I posted earlier? I have read that using parent it makes any reworks easier as the path does not have to be changed if the button is moved, but apart from that I cant see why the root one does not work
                                                  • 22. Re: a movie clip button cant detect its AS code
                                                    kglad Adobe Community Professional & MVP
                                                    if the code i posted in my 2/20 message works, then so will:

                                                    • 23. Re: a movie clip button cant detect its AS code
                                                      badhams Level 1
                                                      The aannoying thing is I have used the above in other buttons within the whatIsBinary_mc movieclip and it works. I have copied and changed the instance name as appropriate but it dont work. I cant see why.

                                                      I have tried to check for duplicate instance name and also duplicate frame names. The thing I dont understand is why i movie explorer the name of the frames are shown in brackets for the _root timeline but not for any frames in movieclips, which are located inside the root time line. For example the whatIsBinary_mc movie clip.
                                                      It just shows the frame number and no brackets.

                                                      • 24. Re: a movie clip button cant detect its AS code
                                                        kglad Adobe Community Professional & MVP
                                                        if you can create a fla that contains just the essence of your problem, i can show you how to correct it.
                                                        • 25. Re: a movie clip button cant detect its AS code
                                                          badhams Level 1
                                                          Shall I just upload the latest version of what I have so that it gives you the full picture??
                                                          • 26. Re: a movie clip button cant detect its AS code
                                                            kglad Adobe Community Professional & MVP
                                                            no. i don't want the full picture. it would take too much time to find the essence of the problem. i just want to see the essence of the problem.

                                                            create a new fla and duplicate just the essentials to recreate the problem.
                                                            • 27. Re: a movie clip button cant detect its AS code
                                                              badhams Level 1
                                                              Please find attached the problem file. The trouble code is n frame 428 of the whatIsBinary_mc movie clip. The frame has the label _binaryToDenaryPageOne

                                                              Both the replay and next buttons take me back to the main menu but the previous and home buttons work fine

                                                              http://download.yousendit.com/AB2F5D5B7DB1C606
                                                              • 28. Re: a movie clip button cant detect its AS code
                                                                rlc5611 Level 1
                                                                It appears to me that your replay button is doing eaxctly what you are telling it to. You should try to logically follow what you are asking it to.

                                                                For your next button, you have a "_root." stuck in all by itself that is a typo and should be removed. Your next button is also doing exactly what you are asking it to. It does, in fact, go to the frame label _binaryToDenaryPage Two where it executes the script on frame # 469 which is what is then sending you back to the main menu.

                                                                It would be helpful to you if you could debug your FLA a little better and try to tract its actions. For example, try to comment out all the AS on frame 469 except for the stop();

                                                                You are assuming your button script is not working because they don't appear to be doing what you are asking them to but that is only appearance. So you are looking for the needle in the wrong haystack.

                                                                I also noticed that in frame 469, you reference several frame labels that don't exist such as _B2D3 and _B2D2. I tried changing those to the labels I think you mean and now my Flash crashes every time I try to test your movie so I give up.
                                                                • 29. Re: a movie clip button cant detect its AS code
                                                                  rlc5611 Level 1
                                                                  Okay that was so obvious it was hard.

                                                                  Apart from what I already said before in the previous post, if you will go to frame 469 of the movie clip in question you will see that you have misspelled the word "function" in every instance. You have written "funcion". So your mc was, in fact, going to frame 469 when you hit the next button and then it was getting total lost.

                                                                  Edited to add you have a similar problem in frame 497 although in frame 497 you only spelled it wrong part of the time so it is easier to see. Since "funcion" is a perfectly good word in Spanish, it was hard for me to see.
                                                                  • 30. Re: a movie clip button cant detect its AS code
                                                                    badhams Level 1
                                                                    Thanks a lot everyone. I knew it was something stupid. Most of my errors are from typos. I think it might be becasue I have been at it for so long now, staring so hard that I just did not see it.

                                                                    Not doubt I wil be back with another series of errors.
                                                                    I am so not cut out for this.
                                                                    • 31. Re: a movie clip button cant detect its AS code
                                                                      kglad Adobe Community Professional & MVP
                                                                      learn to use the trace() function. it's essential to debugging flash.