473,325 Members | 2,442 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

MovieClipLoader

Hi, ive managed to import files into a main fla document using a moviecliploader command. The code tracks the percentage of the file downloaded so far and shows this information in a preloader bar. The problem is whenever I import a swf file it tries to play before it is 100% loaded. To counter this I added some more code to solve this (see bold text). The code is supposed to hide the swf file until it is 100% loaded then show and play it. The code hides and shows the swf fine, but still seems to play the file in the background. Would really appreciate some help with this one, hear is the code:

loadbar._visible = false;

//set up a MovieClipLoader and a Listener for "listening" to the callback events of the MovieClipLoader
var myLoader:MovieClipLoader = new MovieClipLoader();
var myListener:Object = new Object();

myListener.onLoadStart = function(){
trace ("started loading" );
}
myListener.onLoadProgress = function(){
percent = Math.floor(box5.getBytesLoaded()/box5.getBytesTotal() * 100);
loadbar._visible = true;
loadbar.gotoAndStop( percent );
trace ( percent );

//script to ensure that the movieclip is only displayed and played when it is 100% loaded
if (percent < 100){
gotoAndStop(box5);
box5._visible = false;
} else {
box5._visible = true;
gotoAndPlay(box5);
}
}


myListener.onLoadComplete = function(){
trace ("loaded");
loadbar._visible = false;
}

// add the listener object to the movieCLipLoader
myLoader.addListener(myListener);
myLoader.loadClip ("materials/rotoscope.swf" , box5);

stop();

Thanks in advance,

Martin
Jun 28 '07 #1
2 2261
Doesn't matter, problem solved now
Jun 29 '07 #2
Motoma
3,237 Expert 2GB
Care to post your solution so others may learn from it as well?
Jun 29 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Colazz | last post by:
var myMCL:MovieClipLoader = new MovieClipLoader(); myMCL.loadClip("apin.jpg", "container"); //container is an instance of a movie clip. Now, the size of "apin.jpg" is too large.. is there any...
5
by: Colazz | last post by:
Suppose that i load a picture inside my movie clip mc.loadMovie("pic.jpg"); How can i know the dimension of the "pic.jpg" ? I need the info such as the width and height of the pic to continue...
4
by: Martin84 | last post by:
Hi, im attempting to build a portfolio website in flash professional 8 and want to import an .swf file into the .fla document but I cant get it to work. I created white square then converted it...
1
by: Tarik Monem | last post by:
Hi Everyone, As usual, after trying what I can, I come here to ask for your help. Once I found out that scrollToIndex was not working in Flash, but it was working within Flex, then I started to...
2
by: Max58kl | last post by:
Hi I am trying to load a swf file using the MovieClip loader object. var myMCL:MovieClipLoader = new MovieClipLoader(); var myListener:Object = new Object(); myMCL.addListener(myListener); ...
8
by: chromis | last post by:
Hi, I've been struggling to get sounds to work with attachSound when the sounds are stored in a swf loaded into another swf. I came across a post on a forum which supposedly explains how to to do...
0
nomad
by: nomad | last post by:
Hello Everyone. I founded an Flash and xml photo gallery. It works but I took it to another step What I want is to have six different galleries in one Flash file. I figure out how to do that but ...
49
anfetienne
by: anfetienne | last post by:
is it possible to add php array to vars in the swfobject code?
1
anfetienne
by: anfetienne | last post by:
i have this code below that i made....it loads vars from txt file splits it then puts it into an array....once in an array it the brings the pics in from the array to create thumbnails and a larger...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.