| Ultrashock Forums
preloading dynamically loaded jpgs? |
|||
![]() |
||||
| Search this Thread | Thread Tools | Display Modes |
|
|
|||||||||||||||||||||||||
![]() |
Ultrashock Member Comments:
|
2003-03-04
#2 |
||
|
|
|
2003-03-04
#3 |
||
|
thank u for the quick answer...
...but i have to explain my problem in more detail! ![]() My preloader works fine when i use it in the first frame of a movieclip. The code for it is: perc = Math.round((_root.getBytesLoaded()/_root.getBytesTotal())*100); xperc = perc/100; barlength = 120; if ((perc == 100) and (bar._width == barlength)) { gotoAndPlay(4); //at this frame the bar fades out and _root is going to the next frame } else { nperc = perc+"%"; bar._width = barlength*xperc; bar._x = -60+(bar._width/2); } Because the bar and another small effekt (which is playing while preloading) are allready loaded for the root-scene, i wanted to use them for preloading the jpgs too. I duplicated and placed them in another movieclip with the path of the imageholder-MC in the actionscript (in this case (_root.imageholder.getBytesLoaded()/_root.imageholder.getBytesTotal()) ) You can see the result on: www.digitailor.de/test (in the supmenue 3DArtwork/highres) At the first time i thought that it did not work, because the new loaded jpg resets all settings of the imageholder-Mc and consequently my path would be wrong. Therefor i tried to use a variable path like this: for (i = 1; i<10, i++){ (_parent["myImageName"+i+".jpg"].getBytesLoaded()/_parent["myImageName"+i+".jpg"].getBytesTotal())...... Because i am not very familiar with programming and new to flash i tried different spellings without success. Do you know if itīs generally possible to preload a jpg from within another MC? |
|
|
|
2003-03-05
#4 |
||
|
Ok, ignore my last post and the theory of a path-problem! I used the onClipEvent (enterFrame) handler and it works! Thanks a lot to BradJ for that hint! For all who want to use a certain bar for preloading dynamically loaded jpgs or movies, this may will help: 1. Use the onClipEvent(enterFrame) for that matter. For more information about that look at: http://news.flashguru.co.uk/?aid=000044 2. Exsample Code: ////////////////////////////////////////////////////////////////////////////////// onClipEvent (enterFrame) { perc = Math.round((_root.MCimageholder.getBytesLoaded()/_root.MCimageholder.getBytesTotal())*100); xperc = perc/100; barlength = 120; if ((perc == 100) and (this._width == barlength)) { this._visible = false; } else { nperc = perc+"%"; this._visible = true; this._width = barlength*xperc; this._x = -60+(this._width/2); } } ////////////////////////////////////////////////////////////////////////////////// happyPreloading, ohara |
|
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|



3 comments
| 258 views



Linear Mode
put something to this effect on the movie clip that is for your bar that is going to scale:
onClipEvent (enterFrame) { this._xscale = (_root.photoHolder.getBytesLoaded()/_root.photoHolder.getBytesTotal())*100; if (this._xscale == 100) { this._visible = false; } else { this._visible = true; } }-brad