Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2001-08-28
9
Medium Priority
?
289 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Technology Partners: 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!

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…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
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…
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

715 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