Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 07-31-2005, 12:12 AM   #1
Navarone
Don
 
Navarone's Avatar
 
Join Date: Feb 2003
Location: Akron, Ohio USA
Posts: 2,077
Default onLoadstart and onLoadInit ?

I have question related to these two methods as I am calling them both in my code. I have three scrollpanes on the stage, the first loads a list of names, when you click on any name in the list, it then loads images into the second scrollpane, in the form of thumbnails. Also, when this happens I have a text box that displays a "Loading..." text. Now what seems to happen is, initially when I click on a name, the loading text appears in conjunction with the images loading. It works ok....

However, when I go to click on a different name it seems that flash is removing old images first and then loading in new ones. I don't have a problem with this thats how it is supposed to work, and my Loading text appears as it should, but how can I capture this "flushing" or removing process so I can display a text that says something like, " Clearing out old images...". Because sometimes there is a noticable lag.

Here is my code I have a lot happening, so it might be hard to follow.
ActionScript Code:
_root.zoom_txt.autoSize = true; _root.zoom_txt.text = "0"+"%"; _root.zoom_in.enabled = false; _root.zoom_out.enabled = false; _root.timer_txt.autoSize = true; //////////////////////////////////////////////////////////////////// var pictures:mx.containers.ScrollPane; pictures.contentPath = 'Holder_mc'; //////////////////////////////////////////////////////////////// // load btn_ding bgSound = new Sound(MyMusic_mc); bgSound.loadSound("btn_ding.mp3", event); /////////////////////////////////////////////////////////////////////////////////////////////////// // set variables to remember the orginal scale this.zoom_out.onPress = function() {     if (pictures.content.myLoader.scaleX<=25) {         this.zoom_out.enabled = false;         bgSound.start();     } else {         pictures.content.myLoader.scaleX -= 25;         pictures.content.myLoader.scaleY -= 25;         trace(Math.floor(pictures.content.myLoader.scaleX));         _root.zoom_txt.text = +Math.floor(pictures.content.myLoader.scaleX)+"%";     }     pictures.invalidate(); }; this.zoom_in.onPress = function() {     if (pictures.content.myLoader.scaleX>=500) {         this.zoom_in.enabled = false;         bgSound.start();     } else {         pictures.content.myLoader.scaleX += 25;         pictures.content.myLoader.scaleY += 25;         trace(Math.floor(pictures.content.myLoader.scaleX));         _root.zoom_txt.text = +Math.floor(pictures.content.myLoader.scaleX)+"%";     }     pictures.invalidate(); }; //////////////////////////////////////////////////////////////////// // create thumbnail images var MAX_WIDTH:Number = 65; var MAX_HEIGHT:Number = 65; var mclListener:Object = new Object(); ///////////////////////////////////////////////////////////////////////////// mclListener.onLoadStart = function(mc:MovieClip) {     _root.timer_txt._visible = true;     _root.timer_txt.text = "Loading...."; }; //////////////////////////////////////////////////////////////////////////////// mclListener.onLoadInit = function(mc:MovieClip) {     _root.timer_txt.text = "Loading....";     // set variables to keep the original image dimensions     var xw = mc._width;     var xh = mc._height;     trace(xw);     trace(xh);     // where image width is greater than image height     if (mc._width>mc._height) {         mc._width = MAX_WIDTH;         mc._height = (mc._height*MAX_WIDTH)/xw;         // center image         mc._y = (75-mc._height)/2;     }     //where image height is greater than image width     if (mc._height>mc._width) {         mc._height = MAX_HEIGHT;         mc._width = (mc._width*MAX_HEIGHT)/xh;         mc._x = (75-mc._width)/2;     }     _root.timer_txt._visible = false; }; ///////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// MyLoadVars = new LoadVars(); MyLoadVars.load("image_txt_files/folders.txt"); MyLoadVars.onLoad = function(success) {     if (success) {         var c_mc:MovieClip;         Rc = this["Rc"];         //trace(Rc);         for (i=0; i<=Rc-1; i++) {             c_mc = _root.scrollPane.content.attachMovie("Folder_mc", "clip"+i, i, this.getNextHighestDepth());             c_mc.name.autoSize = true;             c_mc.name.text = this["Folder"+i];             c_mc._x = 5;             c_mc._y = 5+(i*20);             c_mc.i = i;             c_mc.location = this["Folder"+i];             c_mc.onRelease = function() {                 ////////////////////////////////////                 _root.timer_txt.text = "Loading....";                 _root.zoom_in.enabled = false;                 _root.zoom_out.enabled = false;                 _root.instruct_txt.autoSize = true;                 _root.instruct_txt.multiline = true;                 _root.instruct_txt.text = "Scroll through the thumb nail images and click on that image to see it in the picture window.";                 //////////////////////////////////                 // this repopulates the scrollpane at runtime                 thumbs.refreshPane();                 pictures.refreshPane();                 for (i=0; i<=6; i++) {                     t_mc = _root.thumbs.content.attachMovie("thumb_mc", "tip"+i, i, this.getNextHighestDepth());                     t_mc._x = 5;                     t_mc._y = 5+(i*80);                     t_mc.i = i;                     thumbs.invalidate();                 }                 /////////////////////////////////////                 //if (this.name.text == "Dadphotos") {                 if (this.location == this.location) {                     //trace("test "+this.location);                     var elf = this.location;                     MyPicVars = new LoadVars();                     MyPicVars.load("image_txt_files/"+elf+".txt");                     MyPicVars.onLoad = function(success) {                         if (success) {                             //trace("success");                             //trace(elf);                             var t_mc:MovieClip;                             Rc = this["Rc"];                             //;                             /////////////////////////////////////////                                                  for (i=0; i<=Rc-1; i++) {                                 t_mc = _root.thumbs.content.attachMovie("thumb_mc", "tip"+i, i, this.getNextHighestDepth());                                 t_mc._x = 5;                                 t_mc._y = 5+(i*80);                                 /////////////////////                     _root["mc"+i] = new MovieClipLoader();                                 _root["mc"+i].addListener(mclListener);                                 _root["mc"+i].loadClip(+elf+"/"+this["pic"+i], t_mc.container_mc);                                 /////////////////////////                  t_mc.i = i;                                 t_mc.location = this["pic"+i];                                 t_mc.onRelease = function() {                                     _root.zoom_in.enabled = true;                                     _root.zoom_out.enabled = true;                                     _root.zoom_txt.text = "100"+"%";                                     _root.instruct_txt.text = "You can navigate the picture by using the zoom buttons or scroll bars as they appear. ";                                     //load image into pictures scroll pane                                                       pictures.content.myLoader.contentPath = +elf+"/"+this.location;                                     // reset the images to 100%                                     pictures.content.myLoader.scaleX = 100;                                     pictures.content.myLoader.scaleY = 100;                                     // redraw component only when changes occur                                     pictures.invalidate();                                 };                                 //////////////////////////////////////////                                 thumbs.invalidate();                             }                         } else {                             trace("not loaded");                         }                     };                 } else {                     //do nothing                 }             };             scrollPane.invalidate();         }     } else {         trace("not loaded");     } };
__________________
Damn the torpedoes! Full speed ahead.
Navarone is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:17 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.