Ok this is the case: I am trying to create a site for viewing pictures. The jpg-pictures should be loaded behind the menu. I want the menu to be drop-down and I want it to be 85% transparent with seperation in three categories. Each categorie is supposed to have like 30 to 40 jpg-pictures within and therefore have two buttons to jump to next and previous. I have tried to load the jpg's with loadmovie and loadmovienum. This works fine exept that the next-button and the previous-button disapears. I have placed the target-clip in a layer underneath the button-layer. Anyone that knows why this is? Or maybe know of a better way of doing this? I would really be thankfull for any help. Best, Thomas
Thank you for answering kglad. I tried to use the swapDepths() but nothing happend. I have a button that trigger a actionscript that looks like this: -------------------------------------------------------------------------------- on (release) { // (holderName is an optional parameter) MovieClip.prototype.loadjpg = function(picName, holderName) { // holderName can be passed in case needed for progress indicator // if not passed, use 'holder' as default var h = holderName==undefined ? "holder" : holderName; this.createEmptyMovieClip(h, 1); this._visible = false; this.loadMovie(picName); var id = setInterval(function (mc) { if (mc._width > 0) { mc._alpha = 99; clearInterval(id); // may want to move this next line to the onComplete routine // instead, if visibility is to be set after positioning // mc._visible = true; mc.onComplete(); } else { mc.onLoading(); } }, 80, this); }; this.onLoading = function() { trace("LOADING: This="+this+" has loaded:"+this.h.getBytesLoaded()+"/"+this.h.getBytesTotal()+" bytes"); }; this.onComplete = function() { trace("This="+this+" is COMPLETE"); }; this.loadjpg("fashion00"+teller+".jpg","target_mc"); teller++; stop(); } -------------------------------------------------------------------------------- I also tried to put the button in a clip that I used the swapDepth() with, but then I couldn't get the jpg-file to load. Do you see whats wrong?
i don't see any place where you're swapping depths in that code. and there are some problems with that code. your use of "this" in you loadjpg() function refers to the timeline that contains that code, not to an emptyMovieClip. and you probably don't want that prototype function defined each time you press your button. once is enough. here's a rearrangement of your code: attached to your button: on (release) { this.loadjpg("fashion00"+teller+".jpg", "target_mc"); teller++; stop(); } and attached to a frame: MovieClip.prototype.loadjpg = function(picName, holderName) { var h = holderName == undefined ? "holder" : holderName; rclip = this.createEmptyMovieClip(h, 1); rclip._alpha = 0; // _visibile property is reset when loadMovie initiates, though for loading a jpg you won't see a partial load anyway so there's no need in this situation to set the _alpha to 0 and then reset to 99 unless you wanted to fade your pic into view. rclip.loadMovie(picName); id = setInterval(loadF, 1, rclip); }; MovieClip.prototype.onLoading = function() { trace("LOADING: This = "+this+" is loading: "+this.getBytesLoaded()+"/"+this.getBytesTotal()+" bytes"); }; MovieClip.prototype.onComplete = function() { trace("This = "+this+" has COMPLETED LOADING"); }; function loadF(mc) { if (mc._width>0) { // this preloader doesn't really accomplish much each to generate those trace statements. mc._alpha = 99; // why 99? clearInterval(id); mc.onComplete(); } else { mc.onLoading(); } }
Beautiful. Now it works perfectly. Except for one thing (of course). I would like to have a text that tells the user how much that have been loaded ( in bytes). I tried to put a dynamic textbox in, and wrote trace in the variable-field. Nothing is sent to the text-box. Did the corrections you pointed out and my code looks like this now: Button_Next: on (release) { teller++; if (teller<10) { this.loadjpg("fashion00"+teller+".jpg", "target_mc"); } else if (teller<totalPics+1) { this.loadjpg("fashion0"+teller+".jpg", "target_mc"); } else if (teller>totalPics) { _parent.gotoAndPlay(1); } stop(); } Button_Previous: on (release) { teller--; if (teller<0){ teller=totalPics; this.loadjpg("fashion0"+totalPics+".jpg", "target_mc"); } else if (teller<1) {_parent.gotoAndPlay(1);} else if (teller<10) {this.loadjpg("fashion00"+teller+".jpg", "target_mc");} else if (teller<totalPics) {this.loadjpg("fashion0"+teller+".jpg", "target_mc");} stop(); } Frame: MovieClip.prototype.loadjpg = function(picName, holderName) { var h = holderName == undefined ? "holder" : holderName; rclip = this.createEmptyMovieClip(h, 1); rclip.loadMovie(picName); id = setInterval(loadF, 1, rclip); }; MovieClip.prototype.onLoading = function() { trace("Loaded "+this.getBytesLoaded()+" bytes of"+this.getBytesTotal()+" bytes."); }; MovieClip.prototype.onComplete = function() { trace("This = "+this+" has COMPLETED LOADING"); }
Don't see what you're looking for? Try a search.
|