Solved

Using a "GetBytesLoaded" type preloader with a loading MC?

Posted on 2001-08-28
9
272 Views
Last Modified: 2012-06-22
Hello,
We have a preloader on our site that uses the "getBytesLoaded" function.  It works great when loading the home page.  However, I would also like to use it when a movie clip is loaded from the home page (the home page is loaded into _level0).  Actually, I would like to use it when a mc (loaded into a target called "subtarget") is loaded from another mc (target = "target"), which is loaded from another mc (target="target1").  I suspect that I am having a problem getting the correct path, again.  I assume that the line that is causing the problem is the one in the preloader scene that checks to see how much of the BytesTotal is loaded.  I have tried the following:

if (_level0.target1.target.subtarget.getBytesLoaded() !=_level.target1.target.subtarget.getBytesTotal()){
    gotoAndPlay(1);
     }

I have also tried:
if (this.getBytesLoaded() != this.getBytesTotal()){
    gotoAndPlay(1);
     }
In both cases, the movie clip will play, but the loading bar in the preloader is not showing the progression of the loading (as it does when we use this preloader on the home page).

Any idea how I write this actionscript to check for the bytesloaded in a loading mc?
Thanks,
Stephen Pintauro


0
Comment
Question by:sjp060497
  • 4
  • 3
  • 2
9 Comments
 
LVL 6

Accepted Solution

by:
Jaymol earned 100 total points
ID: 6431819
Hi.

Try this....

if (_root.target1.target.subtarget.getBytesLoaded() !=_root.target1.target.subtarget.getBytesTotal()){


It's pretty much what you had already, but with "_root" instead of "_level0" which doesn't actually mean anything.

Good luck,

John.
0
 
LVL 6

Expert Comment

by:rootdir
ID: 6433097
sip

see your if condition is wrong

if (_level0.target1.target.subtarget.getBytesLoaded() !=_level.target1.target.subtarget.getBytesTotal())
   

it should be

if (_level0.target1.target.subtarget.getBytesLoaded() !=_level0.target1.target.subtarget.getBytesTotal())

John has given correct answer. User _root or _flash like this

if (_flash.target1.target.subtarget.getBytesLoaded() !=_flash.target1.target.subtarget.getBytesTotal())

Cheers
RootDir
   
   
0
 

Author Comment

by:sjp060497
ID: 6436138
Well, I tried using the following:

if (_root.target1.target.subtarget.getBytesLoaded() !=_root.target1.target.subtarget.getBytesTotal())

The preloader bar loads, but it doesn't show any progress.  It simply loads with the bar "full" and then waits there until the "subtarget" movie clip begins playing.  
Any ideas?
Thanks,
Stephen
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Expert Comment

by:Jaymol
ID: 6436165
Realistically, we'd need to see the script for the whole preloading procedure to answer what you are asking now.  Give us more detail and I'm sure we can help you.

John.
0
 
LVL 6

Expert Comment

by:rootdir
ID: 6438811
sjp,

  Why don't you post your movie on net. we will take a look or send your move to rotdir@hotmail.com

Cheers
RootDir
0
 

Author Comment

by:sjp060497
ID: 6440233
Hello rootdir and John,
Thanks for the continued help.  I have a very busy day today, but I will definately post the movie and/or the actionscript I am using by tomorrow.
Thanks again,
Stephen
0
 
LVL 6

Expert Comment

by:Jaymol
ID: 6440235
Okay, ta.  We'll have a look at it then.

John.
0
 

Author Comment

by:sjp060497
ID: 6445086
Hi again,
OK....the script for the whole preloading procedure is as follows:

From the home page (which is at _level0), the user would select a button that would load a movie into a target called "target1".  From this loaded movie, the user would select a button that would load another movie into a target called "target".  From this movie, a user could select another button that would load a movie clip into a target called "subtarget".  I know this is a bad choice of target names.  When we get a chance, we will change them to something more intuitive.  

Anyway, the movie clip that is loaded into "subtarget" contains two scenes.  The first scene in the order is called "Preloader" and the second scene is called "Wiley".  The "preloader" scene contains 3 frames and two layers.  The first (actions layer) contains 3 frames.  The first frame is a blank keyframe.  The second frame contains the following actionscript:

if (_root.target1.target.subtarget.getBytesLoaded() != _root.target1.target.subtarget.getBytesTotal())
     {
     gotoAndPlay (1);
     }

Frame 3 of the actions layer contains the following script:

gotoAndPlay ("Wiley", 1);

The second layer in the "Preloader" scence contains just one keyframe in frame one, containg the preloader bar movie clip.  This is just a colered bar with an action layer as follows:

setProperty (this, _xscale,(_root.getBytesLoaded() / _root.getBytesTotal())*100);

Woops!!!!!
I think I just found the problem.  I changed the path in the earlier script to "_root.target1.target.subtarget", but I did not change the path in the actionscript for the preloader bar graphic above.  This would make sense as to why the bar shows up, but does not show the progress.  The _root movie is already loaded and so the above formula would already be at "100".  
Is that the problem?
Thanks,
Stephen

0
 
LVL 6

Expert Comment

by:Jaymol
ID: 6456208
That could be a proble, yeah. :)

Glad you've got it sorted.

John.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question