Solved

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

Posted on 2001-08-28
9
268 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 6

Expert Comment

by:Jaymol
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 6

Expert Comment

by:rootdir
Comment Utility
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
Comment Utility
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
Comment Utility
Okay, ta.  We'll have a look at it then.

John.
0
 

Author Comment

by:sjp060497
Comment Utility
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
Comment Utility
That could be a proble, yeah. :)

Glad you've got it sorted.

John.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
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 live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now