23 Replies Latest reply on Feb 9, 2007 6:59 AM by greatone305

    InstanceName Problem

    greatone305
      OK
      heres my problem. I got this set of button that are in an mc on the main timeline. those button need to call upon and load other mc's with other buttons that have basic functions like gotoAndPlay(). which i have done by using

      loadMovie(_level.contholder_mc.loadMovie("contractor_mc.swf", 1);

      this works fine the first time i click on the button, but when the button is clicked for the second time i click this button for some reason it is giving mcs that are called up on a different instance name every time. Like one time it will be instance11, the next instance 12 and so forth. can't really figure it out. Can some please help me on this.
        • 1. Re: InstanceName Problem
          GerryIsHere Level 1
          Humm... a bit clumsy...
          It will be better to have the .fla available for download...
          • 2. Re: InstanceName Problem
            SymTsb Level 2
            try this instead....

            in main movie add this line of AS at the top of frame 1 myTimeline = this;

            now your loadMovie statement on the first set of buttons should look like this....

            myTimeline.loadMovie("contractor_mc.swf", 1);

            I'm not certain what you are doing exactly, but this may be a bit sloppy. If you could elaborate more, I could help you a bit better.
            • 3. Re: InstanceName Problem
              greatone305 Level 1
              i'll try it, ill elaborate more, but im not sure how to put it into words without making it sound more complicated.

              on my main timeline i have i have a couple internal mc's
              one containing my buttons( section_buttons_mc) and some other various mcs that do a couple other things. now each button in the button_mc is suspose to load another mc like for instance contractor_btn loads contractor.swf and so on.

              now here is where my problem starts. Each of the external swf's has page_buttons inside them that controls the timeline. like gotoAndPlay (page_1) and gotoAndPlay (page_2). once the external swf is loaded onto the main timeline, the page buttons work the first time they are clicked. if i click on a different button inside the section_buttons_mc and then go back click on the same button again the page buttons inside the swf doesn't work. it give the swf a different instance name everytime and ive tried to name it but i can't get it to see the name.

              hope this helps.
              • 4. Re: InstanceName Problem
                GerryIsHere Level 1
                Well, I think I understand what your problem is...

                Don't do what SymTsb suggest (not because it's wrong but because of the following I suggest).

                Don't touch any script on your Main Timeline.
                Just be sure that in each of the .swf you are loading the actions called by the buttons they contain are always referring to "this".

                Example:
                For a button in first.swf action will be

                on (release) {
                this.gotoAndPlay("frame_label");
                }

                All buttons in first.swf will be scripted that way and all buttons in second.swf or third.swf ALSO !!!
                • 5. Re: InstanceName Problem
                  greatone305 Level 1
                  i'll try it. thanks gerryishere and SymTsb, im realtively new at this stuff kinda learning as i go. you know the hard way LOL.

                  • 6. Re: InstanceName Problem
                    greatone305 Level 1
                    thanks gerryishere i tried it and it worked perfectly. again thanks for helping out a dumb newbie
                    • 7. Re: InstanceName Problem
                      greatone305 Level 1
                      sorry to be a bother again but i have another problem. i got the page buttons to work and im really grateful. but here is my other problem, in the external swf i have 5 frames named different things like contractor info, licensing info etc... and to control those labels i created a scrolling menu mc and stuck it on the main timeline of the external swf. when each is clicked it is suspose to jump to that specific point on the timeline, but i cannot get it to do it. i have tried everything i can think of but no luck. i hope i have explained it good enough. can anyone help me.
                      • 8. InstanceName Problem
                        GerryIsHere Level 1
                        on (release) {
                        name_of_the_loaded_movie.gotoAndPlay("frame_label_in_the_loaded_movie");
                        }

                        All buttons in the Main Timeline must indicate the target of the action.
                        In this case the target is the .swf you loaded.

                        If you loaded it via loadMovieNum target the _level in which you loaded it.
                        If you loaded it via loadMovie in a movie clip used as a container, target the instance name of this container.
                        • 9. Re: InstanceName Problem
                          greatone305 Level 1
                          i tried that but i cannot get my path right. Mainly because it says my swf is undefined. i have tried everything to get it work. im completely lost
                          • 10. Re: InstanceName Problem
                            GerryIsHere Level 1
                            Which method did you use to load your .swf ?

                            loadMovieNum
                            or
                            loadMovie
                            • 11. Re: InstanceName Problem
                              greatone305 Level 1
                              loadMovie

                              Im wondering if i should be using the _lockroot method.
                              • 12. InstanceName Problem
                                GerryIsHere Level 1
                                If you did use this method, you must have targeted an empty movie clip as the target in which the loaded .swf must be placed.

                                So, your code must be (in the button placed on the Main Timeline commonly named "_root"):

                                on (release) {
                                name_of_the_targeted_movie_clip_used_as_a_container.gotoAndPlay("frame_label");
                                }

                                This suppose, of course, that a labelled frame exists in the loaded .swf !!!!!

                                • 13. Re: InstanceName Problem
                                  greatone305 Level 1
                                  In that case i don't think the _lockroot method would work. Let me see if i can explain it a little more in depth.

                                  ive tried moving these button to different palce to make it work. you know trying to get as simple as possible. but the buttons(which are scrolling buttons) im refering to are in the loaded swf (the same swf that the page buttons are on)as a nested mc called sub_btns.

                                  I can make these buttons work by using this code on the sub_btns
                                  on (rollOver) {
                                  this._root.gotoAndPlay ("consumer_info");
                                  }
                                  But if i vary the code the least little bit it doesn't work. The method above works until i load another swf by using the main button on the main timeline called (section_btns) and then try to reload the same swf. the swf reloads but the sub_btns don't work no more, because it says that the instance name has changed. i hope this helps some becuase im in a real pickle.

                                  thanks for all your help gerryishere

                                  • 14. InstanceName Problem
                                    GerryIsHere Level 1
                                    Okay, I understand...

                                    It's just because before loading the second (or the third or the fourth) .swf, you didn't specify:

                                    unloadMovie(""name_of_the_swf_previously_loaded", name_of_the_targeted_movie_clip_used_as_a_container);
                                    • 15. Re: InstanceName Problem
                                      greatone305 Level 1
                                      ok tried it and still the same problem. once the movie is unloaded and then loaded again for the second time it doesn't work. tried a trace(_target);
                                      when the movie is unloaded and then loaded again it gives it a different instance name. how come?? im not understanding why this is happening. im sorry im being a pain. im really really new at this.
                                      • 16. Re: InstanceName Problem
                                        greatone305 Level 1
                                        here is a link to the fla so maybe you can understand what im talking about. i think i have made it to confusing trying to explain it.

                                        http://www.labor.state.wv.us/website2.4.fla
                                        • 17. Re: InstanceName Problem
                                          GerryIsHere Level 1
                                          I'm downloading it now.
                                          But how big may your .swf be with such a huge source document?
                                          More than 80 MB !!!

                                          How long does it takes to export the .swf?
                                          • 18. Re: InstanceName Problem
                                            greatone305 Level 1
                                            im trying to make it as small as possible. the people i work for wanteed it done with all kinds of bells and whistles. have any suggestions on how to make it smaller
                                            • 19. InstanceName Problem
                                              GerryIsHere Level 1
                                              Well...
                                              I'm looking at your .fla ...
                                              We gonna make it step by step.

                                              First:
                                              Why do you unload a container, always the same, (homeholder_mc) and load another, always the same, (contholder_mc)???

                                              I'm quite sure this discrepancy is part of your Problemmmmmmm...
                                              Or maybe I'm missing something...
                                              • 20. InstanceName Problem
                                                GerryIsHere Level 1
                                                Second:
                                                You wrote:
                                                on(press){
                                                _level.homeholder_mc.unloadMovie("home_mc.swf", 1);
                                                }
                                                on(release){
                                                _level.contholder_mc.loadMovie("contractor_mc.swf", 1);
                                                }

                                                This makes no sense for me.
                                                You should have wrote:
                                                on(press){
                                                _level0.homeholder_mc.unloadMovie("home_mc.swf", 1);
                                                }
                                                on(release){
                                                _level0.contholder_mc.loadMovie("contractor_mc.swf", 1);
                                                }

                                                or

                                                on(press){
                                                _root.homeholder_mc.unloadMovie("home_mc.swf", 1);
                                                }
                                                on(release){
                                                _root.contholder_mc.loadMovie("contractor_mc.swf", 1);
                                                }

                                                I think the process should be wrote that way:

                                                on(press){
                                                _root.homeholder_mc.unloadMovie("home_mc.swf", 1);
                                                }
                                                on(release){
                                                _root. homeholder_mc.loadMovie("contractor_mc.swf", 1);
                                                }

                                                load and unload operations must be taking place in the same holder...
                                                There's no need for different containers which is confusing...

                                                PS: You didn't provide me with the .swf supposed to be loaded and unloaded... I can't verify if the site works...
                                                • 21. Re: InstanceName Problem
                                                  GerryIsHere Level 1
                                                  quote:

                                                  Originally posted by: greatone305
                                                  im trying to make it as small as possible. the people i work for wanteed it done with all kinds of bells and whistles. have any suggestions on how to make it smaller


                                                  Never listen to such requirements from the client, dammit !!! Arrrrggggghhhhhh !

                                                  You have a serious very big problem with the obesity of your images !
                                                  You don't need images of 3076x2308 pixels.
                                                  And you must uncheck the box "Use document default quality" in the Get info Window (double click a bitmap in the Library to show this window) and set the quality to 10 %, then click Test.
                                                  You will see that the result is very good...

                                                  • 22. Re: InstanceName Problem
                                                    GerryIsHere Level 1
                                                    I must leave now for two or three hours...
                                                    • 23. Re: InstanceName Problem
                                                      greatone305 Level 1
                                                      ok sorry we had some network trouble yesterday after my last post and was unable to back on until today. the reason i was using different holder was to make it easier about centering everything up. because i tried doing it with a script but had no success. i shrink my images like you said. also the reason for not posting the other swf was because i when i posted them so you could get them all it would do was open the swf up in explorer, would let me download it. is there anyway you could just go into the sections folder and export the contractor_mc in the contractor licensing folder and home_txt in the homepage folder.

                                                      Im know im a real pain and im really gratefull for all help you have given me.