1 2 Previous Next 50 Replies Latest reply on Jan 7, 2007 4:24 AM by vinnio

    trace holder?

    vinnio Level 1
      Is there a way to trace what is loading into a holder? and the feedback? I only get to see error opening URL but I can't do enything with it. I have a lot of thumbs made out of movieclips and some images are missing on purpose for those thumbs.
      What I want to do is when a image is missing a script tells the movieclip HIDE. I already try for this.getBytesTotal = -1 but on externel movieclips it has no effect. Can anyone give me advice how to fix this problem?
        • 1. Re: trace holder?
          kglad Adobe Community Professional & MVP
          use the moviecliploader() class. it has an onLoadError() method that you can use.
          • 2. Re: trace holder?
            vinnio Level 1
            Thanks kglad for you reaction! Do you have maby an idea how can I do this within a movieclip?
            • 3. Re: trace holder?
              kglad Adobe Community Professional & MVP
              each thumb should be related to its corresponding load-target. that correspondance should be used within the onLoadError(target) method to make its corresponding thumb's _visible property false.
              • 4. Re: trace holder?
                vinnio Level 1
                I attempt I few things but I can't see this one through. I have on my first frame for examaple this script below. Thirst one is for the preloader and second one for the Movieclip buttons... How can I communicate inside the movieclips when error.. and say this.gotoAndStop("hide") for example?

                // Extern Movieclip ///////////
                var mcl:MovieClipLoader = new MovieClipLoader();
                var mclL:Object = new Object();
                mclL.onLoadError = function(target_mc:MovieClip, errorCode:String, httpStatus:Number) {
                trace(">> loadListener.onLoadError()");
                trace(">> ==========================");
                trace(">> errorCode: " + errorCode);
                trace(">> httpStatus: " + httpStatus);
                }
                mclL.onLoadProgress = function(target, loaded, total) {
                // Preload
                bar._visible = true;
                bar._xscale = (loaded/total*100);
                myTextField.text = Math.round((loaded/total)*100)+"%";
                };
                // When Preload Complete
                mclL.onLoadInit = function() {
                mc_Fade.gotoAndPlay(6);
                bar._visible = false;
                myTextField.text = "";
                };
                mcl.addListener(mclL);

                // Loading Buttons ///////////
                function LoadButtons() {
                buttonsArray = new Array();
                for (i=1; i<16; i++) {
                duplicateMovieClip(buttons, "button"+i, i);
                buttonsArray = _root["button"+i];
                // Button Position
                buttonsArray
                ._x = -30+i*42;
                buttonsArray ._y = 400;
                buttonsArray
                .ButtonNumber = i;
                buttonsArray .FileContainer = FilePath+"img_"+i+".jpg";
                buttonsArray
                .ThumbContainer = FilePath+"thumb_"+i+".jpg";
                }
                }
                • 5. Re: trace holder?
                  kglad Adobe Community Professional & MVP
                  each buttonArray element needs a movieclip into which to load ThumbContainer and another movieclip into which to load FileContainer.

                  you should assign those in your for-loop and then you can use target._parent.ButtonNumber (in your onLoadError method) to find the index of the array element that contains those movieclips. you can then use that element to handle the _visible property of the appropriate container.
                  • 6. Re: trace holder?
                    vinnio Level 1
                    Thanks again for your reaction but I can't get this right. I have now so far this script below. When a thumb is missing this buttonsArray ._visible = false else the thumb loads in mc_thumbHolder that is the intention...

                    function LoadButtons() {
                    buttonsArray = new Array();
                    for (i=1; i<16; i++) {
                    duplicateMovieClip(buttons, "button"+i, i);
                    buttonsArray
                    = _root["button"+i];
                    // Button Position
                    buttonsArray ._x = -30+i*42;
                    buttonsArray
                    ._y = 400;
                    buttonsArray .ButtonNumber = i;
                    buttonsArray
                    .FileContainer = FilePath+"img_"+i+".jpg";
                    buttonsArray .ThumbContainer = FilePath+"thumb_"+i+".jpg";
                    nameButton = "_root.button"+_root.i;
                    var mclListener:Object = new Object();
                    mclListener.onLoadError = function(nameButton, errorCode:String) {
                    buttonsArray
                    .loadClip(FilePath+"thumb_"+i+".jpg", mc_thumbHolder);
                    buttonsArray ._visible = false;
                    trace("ERROR");
                    };
                    buttonsArray
                    .addListener(mclListener);
                    }
                    }
                    • 7. Re: trace holder?
                      kglad Adobe Community Professional & MVP
                      first, use the attach code option to post your code. this forum interprets [ i ] as encoding for italic font and that pretty well messes up your code.

                      second, into what target does buttonsArray[ i ].FileContainer load?
                      • 8. Re: trace holder?
                        vinnio Level 1
                        buttonsArray[ i ].FileContainer is a variable that I use into movieclips (buttons). I saw somewhere that Container is a name used the same as a holder...Maby it is better for later that I change this name in something else.
                        This is how it looks like in a movieclip (button1) when it duplicates,

                        this.onRelease = function() {
                        // For Button Active or Not
                        this._parent.ButtonActive = ButtonNumber;
                        // Loads a File
                        this._parent.mcl.loadClip(FileContainer, this._parent.mc_navHolder);
                        // Fade Animation
                        this._parent.mc_Fade.gotoAndPlay(2);
                        // Var for Textfields
                        this._parent.TextVar = ButtonNumber;
                        // Load Function TextLoad
                        _root.TextLoad();
                        gotoAndStop(6);
                        };

                        I shall post the last script by attach code. Thanks for the tip and already for your time!
                        • 9. Re: trace holder?
                          kglad Adobe Community Professional & MVP
                          this._parent.mc_navHolder is the target into which your loading your images. what you're calling fileContainer is not a container in any sense but, despite it's misleading name, that's not causing a problem.

                          in your button handler use:

                          • 10. Re: trace holder?
                            vinnio Level 1
                            Thanks for your time kglad but It dons't work, yet. I have improve the names in my script and I post a better explained Code. I also made the changes of your last post in it. Sorry for the inconvenience..
                            What is a button handler stand for in english in actionscript? Is it between () or is it the whole function.. I spend a lot of time trying things out but I can't see this one through you really help me out if you can look at it.. Thanks!
                            • 11. Re: trace holder?
                              kglad Adobe Community Professional & MVP
                              i put comments in your LoadButtons() function explaining why that code is going to fail. to fix it you need to explain where mc_thumbHolder is created and why you're only using one mc_thumbHolder and trying to load repeated images into one holder. ie, that's a logical error that needs to be fixed.

                              • 12. Re: trace holder?
                                vinnio Level 1
                                I made it more easy to set the onLoadError script in the movieclip (button). The error works but the only thing is that the button stays visable..
                                • 13. Re: trace holder?
                                  kglad Adobe Community Professional & MVP
                                  where's ThumbVar (in LoadThumb() ) defined?
                                  • 14. Re: trace holder?
                                    vinnio Level 1
                                    They are also in the button
                                    • 15. Re: trace holder?
                                      vinnio Level 1
                                      Correction, they are also in the movieclip on the 1ste frame.
                                      • 16. Re: trace holder?
                                        kglad Adobe Community Professional & MVP
                                        that's great but that doesn't make it defined in LoadThumb() (and, in fact, it is undefined).

                                        how many thumbVar images do you want loaded at any one time?

                                        • 17. Re: trace holder?
                                          vinnio Level 1
                                          I have not many experience with external movieclip loaders as you notice. But can you give me a example how this must be build? The reason why I duplicate a button is for working in a more graphic environment. I hope I'm understanding you right.

                                          mcLoader.loadClip(ThumbVar, mc_thumbHolder) in function LoadThumb() is difined by
                                          buttonsArray[ i ].ThumbVar = FilePath+"thumb_"+ i +".jpg" in function LoadButtons()
                                          Or maby I don't no how to define the script this script..

                                          The Pictures in the mc_thumbHolder are working fine.. I want to load about 50 pictures.

                                          In my output I get,

                                          >> loadListener.onLoadError()
                                          =======================
                                          >> errorCode: URLnotFound
                                          >> httpStatus: 0
                                          Error opening URL
                                          File:///img/thumb_6.jpg etc.

                                          I hope you have something with this information. thanks again for your time!
                                          • 18. Re: trace holder?
                                            kglad Adobe Community Professional & MVP
                                            you have 16 buttons on-stage. how are they related to the 50 thumbVar images that you want to display/
                                            • 19. Re: trace holder?
                                              vinnio Level 1
                                              I'm first testing 16 images
                                              • 20. Re: trace holder?
                                                kglad Adobe Community Professional & MVP
                                                so, ultimately will you be loading about 50 thumbnails and each of these will be a button that when clicked will load a larger (corresponding) image?
                                                • 21. trace holder?
                                                  vinnio Level 1
                                                  --
                                                  • 22. Re: trace holder?
                                                    vinnio Level 1
                                                    Yes, precisely. I think what a gonna tell you is maby repeating but after all those actionscript I have cross-eyes and its better to tell it in basic words and practice my english ;) . What I have now so far is one movieclip that is going to be duplicate by a function in the first keyframe and tells how the movieclip is called, put in the variables etc. When the movieclip is duplicated you can press with your mouse on it and when you press a variable tells the nav_holder to load the big picture and the external preloaderscript is doing his job on the first frame. Now the problem is that I don't now how I can put the structure in place to load a thumbnail images into the duplicated movieclips and when they are missing its hide the right one... Nice would be if the script is also on the first frame of the flashfile to keep it clean. I don't have a lot of experience with duplicated movieclip and so far its going well but this problem I can't get right. I searched for a lot of examples but they are rare..
                                                    • 23. Re: trace holder?
                                                      kglad Adobe Community Professional & MVP
                                                      the only additional code needed is in onLoadInit() where you need to supply the target for the full-sized image to load when a thumbnail is pressed.

                                                      addendum: i don't know what that code below the stop() is doing. but i suspect it has bugs, too even after ButtonNumber is defined.
                                                      • 24. Re: trace holder?
                                                        vinnio Level 1
                                                        It is almost working! :) First I didn't work but I have set i to 0 instead of 1 and now the thumbs are hiding one by one. The only thing is that I lose my script and graphics in the movieclip probably because there is a function OnPress or onLoadInit. Is it passible to keep al those things in de movieclip and how can I fix this? Thanks for your work!!!
                                                        • 25. Re: trace holder?
                                                          kglad Adobe Community Professional & MVP
                                                          you'll need all your mouse handlers for the target movieclip in the onLoadInit() method. they are lost as soon as you execute your loadClip() method.

                                                          i don't see any mouse handlers (except the ones assigned to "this"). if you show your handlers for your buttonsArray() movieclips, i'll show you how to add those handlers to onLoadInit().
                                                          • 26. Re: trace holder?
                                                            vinnio Level 1
                                                            I understand. Is it also passible to duplicate an extra movieclip for example "RolloverButton" on top of the same places as on the duplicated buttons to use it as a rollover animation? Its also usefull that I can tune my rollover in whatever graphic I like.

                                                            Below I have the script that I used earlier for the mouse handlers and now have to get a place in the onLoadInit(). You can use the last actionscript that I posted as reference. Many Thanks!
                                                            • 27. Re: trace holder?
                                                              kglad Adobe Community Professional & MVP
                                                              you can create a movieclip that contains a child movieclip which is the target of your loadMovie() or loadClip() methods. that way you CAN assign mouse handlers to the parent clip before, during or after the child movieclip is targeted by one of those methods and those handlers will not be removed.

                                                              try:

                                                              • 28. Re: trace holder?
                                                                vinnio Level 1
                                                                I made some adjustments and now the images en textfields are working nice! :) Can you give me a exaple in the script how I can set up the script for the child movieclip? I made a movieclip "Hit" on the root to use as a child. Below a have the adjusted script. Thanks!
                                                                • 29. Re: trace holder?
                                                                  kglad Adobe Community Professional & MVP
                                                                  if it's working now, just leave it.

                                                                  for future use, you might create a movieclip (parentMC) and create a child movieclip (childMC) of parentMC. you can then assign mouse handlers to parentMC and use childMC as a download target without losing the mouse handlers when the download starts.
                                                                  • 30. Re: trace holder?
                                                                    vinnio Level 1
                                                                    The rollover isn't working yet. I don't now where I can set up the childmovieclip. Can I also use duplicateMovieClip for the child next to duplicateMovieClip "buttons" something like that? Or is it best to create a new script with the same coordinates?
                                                                    • 31. Re: trace holder?
                                                                      kglad Adobe Community Professional & MVP
                                                                      did you try the code i gave in my last message? if so, what rollover/rollout problem was there?
                                                                      • 32. Re: trace holder?
                                                                        vinnio Level 1
                                                                        When I rollover with my mouse everthing is hiding, the buttons and the mc_navholder.. The script that you wright is that also for the movieclip "Allbuttons" on the root? And if I understand it right will the button work again with that script of do you still need a childmovieclip? Can you give me a example in the script how I can set up a childmovieclip idea..? Thanks for your help.
                                                                        • 33. Re: trace holder?
                                                                          kglad Adobe Community Professional & MVP
                                                                          for the rollover/rollout for your buttons i used your rollover/rollout handlers that you use for "this". i see that didn't make any sense in your code and it doesn't make any sense in the code i wrote, either.

                                                                          what's supposed to happen when one of your thumbnails is rolled-over?
                                                                          • 34. Re: trace holder?
                                                                            vinnio Level 1
                                                                            In my last post I made notes // child movieclip of part of the script that have to communicate with the child movieclips but there are no childmovieclips only a movieclip "Allbuttons" for loading the thumb image.So if I understand it right I have to make a nother movieclip called "childMc" beside or in the movieclip "AllButtons"? "AllButtons" is actually used as "parentMC" in your example.. Shall I change the "AllButtons name into "parentMC" for more clarity and send the script with the new names?

                                                                            Meaning of the rollover is that a square shape above the thumb is going to be alpha 0% to 80% and when you press the thumb its stays 100% intill a other thumbs is pressed. Also importent is that you can not press the button twice when the button is active.
                                                                            • 35. Re: trace holder?
                                                                              kglad Adobe Community Professional & MVP
                                                                              each thumb has a different square movieclip above it or there's just one square above all the thumbs? and what is (are) the instance name(s) of the square movieclip(s).
                                                                              • 36. Re: trace holder?
                                                                                vinnio Level 1
                                                                                Yes, so that you get I mouse roll-over above every thumb image. I called the movieclip "hit" and within the movieclip I use a graphic square on the first six frames for the animation alhpa 0 to 80% and on frame 7 a square with alpha 100% for when the button is pressed. When you rollout with your mouse the current frame is reversed to alpha 0%. "hit" must be duplicated on all the thumb images I think..
                                                                                • 37. Re: trace holder?
                                                                                  kglad Adobe Community Professional & MVP
                                                                                  how far above your thumbs do you want the hit movieclips positioned?
                                                                                  • 38. Re: trace holder?
                                                                                    vinnio Level 1
                                                                                    precisely on top of the thumbs.
                                                                                    • 39. Re: trace holder?
                                                                                      kglad Adobe Community Professional & MVP
                                                                                      above the thumbs or on top of the thumbs? if you mean above try the following after assigning a linkage id to your hit movieclip (hitID):

                                                                                      p.s. other than the loadMovie statement, i'm not sure what you're doing in the target_mc.onRelease handler.


                                                                                      1 2 Previous Next