Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2001-08-28
9
Medium Priority
?
297 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 400 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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.
Suggested Courses

886 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