Preloader Woes.....?
OK, I have used this code before on sites and it works just fine, but now for some reason it fails to work properly. Here is the preloader code I am using....
Code: onClipEvent (enterFrame) { //framesLoaded = (Math.ceil (( _parent._framesloaded / _parent._totalframes) * 100)); framesLoaded = (Math.round(_root.getBytesLoaded()/_root.getBytesTotal()*100)); trace(framesLoaded); gotoAndStop(framesLoaded); info.text = framesLoaded+"% charged"; if (framesLoaded>99) { _root.gotoAndPlay("Welcome", 1); } }
As you can see I have tried 2 ways to get the "% loaded", the "framesloaded" way, and the "getBytesLoaded" way.
My movie is 2 scenes, Preloader and Welcome. The above code is on a movie clip instance on the first scene. The movie clip is a 100 frame long clip that tweens a graphic. So in theory if the movie is 59% loaded then the 59th frame will be shown, and so on and so forth.
I have a "stop();" action on my first frame on both scenes.
The movie won't display anything until it is 97% loaded and then the preloader runs and the it goes to the second scene. So it works, but only 3% !!
Please and thanks guys for any help!!
Ultrashock Forums > Flash > ActionScript
Posted on: 2003-07-15
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Preloader Woes.
Hello.
I have made a movie which will be loading in level 0.
But I have not made any room at the start of this movie for a preloader to check if all the frames/bytes are loaded.
I now need a preloader to display a loading message while the rest of the 100K movie loads.
I was thinking of a separate movie on level 1 which would hide the level 0 movie and display 'loading etc' while it checks if the movie on level 1 has loaded or not.
Does anyone have any suggestions, bits of script etc so that I can continue with this project.
I have tried a few things already and haven't managed to accomplish what I wanted.
Cheers.
References to any movies within flashkit would be good.
Gav
Preloader Woes....
Hi All,
I am using the following code as the guts of my preloader...
code:
____________________________________________
loadedbytes = getBytesLoaded();
totalbytes = getBytesTotal();
loadedkbytes = Math.ceil(loadedbytes / 1000);
totalkbytes = Math.ceil(totalbytes / 1000);
frame = Math.ceil(loadedbytes / totalbytes * 100);
_root.loaderin.gotoAndStop(_root.frame);
if(loadedbytes == totalbytes){
nextScene();
}
____________________________________________
it works, but my load bar doesn't
if you could have a quick look and let me know why...
http://www.millenniumit.freewebsitehosting.com
Cheers for your help and time
Preloader Woes....
Hi All,
Im still having trouble with my preloader..
http://www.millenniumit.freewebsitehosting.com/
everything works except for the freakin' loader bar...it just seems to loop bacl to the start every second
heres the code im using...(thanks to XFM ):
Code:
loadedbytes = getBytesLoaded();
totalbytes = getBytesTotal();
loadedkbytes = Math.ceil(loadedbytes / 1000);
totalkbytes = Math.ceil(totalbytes / 1000);
frame = Math.ceil(loadedbytes / totalbytes * 100);
_root.loaderin.gotoAndStop(_root.frame);
if(loadedbytes == totalbytes){
nextScene();
}
If someone could help me with this, that would be great
Cheers boys
Preloader Woes...
Hi,
I built a pre-loader for a short 49K movie of mine. The loader has its own scene and the main movie is in its own scene. When the preloader finishes I have a gotoandplay command that points to the next scene and frame 1.
PROBLEM: The scene that gets loaded, doesn't play from scene one. It is already at the end of the movie clip. Do I need a stop command in the scene I am using the pre-loader for?
Confused,
Keith
Preloader Woes
My preloader won't work, it won't start to be precise. When my movie starts the preloader screen appears, but it doesn't do anything, and all the sound from the next scene start playing. Could I email it to someone, since I don't think I could understandably post it here and I can't upload anything because my comp freezes up every time I try?
Preloader Woes
Hi:
A have an intro that I get to preload properly.
Here is the script I am currently using:
Code:
onClipEvent (load) {
_visible=true;
}
onClipEvent(enterFrame) {
percentloaded=Math.round(_level1.getBytesLoaded()/_level1.getBytesTotal()*100);
percentDisplay=percentloaded + "%";
if(percentloaded==100 && !initialized) {
initialized=true;
_visible=false;
_level1.gotoAndStop (1);
}
}
I tried using the above script as a single frame in a "preloader" scene (above Scene 1) in the main (intro) movie, but the percentage always shows up at around 60% loaded, then immediately disappears, and the movie starts to play.
Now, as you can see (i.e.,_level1), I created an empty movie, containing nothing but my preloader script & the (percentDisplay) text field, then loaded my intro into it.
The preloader starts from 0% in this case, but the movie still starts at around 60-70%, while the preloader is still counting down on screen.
I use this same preloader to load music sound tracks on my portfolio site, and it works fine.
Also, I tried using another preloader with this intro, the one which I use to preload my portfolio, but it doesn't work either, altough it works great on my site, under the same circumstances, i.e., as a preloader scene.
Can anyone offer an suggestions as to why these don't work with this intro? I don't want the intro to start playing while the preloader is still on screen counting down, and I'm not catching on as to why I have to load this intro into level one, and preload it from another movie. Any advice?
The intro can be found here:
http://www.ekigroup.com
Thanks,
James
He is risen!!!
Preloader Woes...
I have a preloader for my web page...(which is pretty rough flash usage, i know)...but it doesn't seem to work.
When I load the page for the first time with IE6.0, it seems to want to load the whole thing before playing any of the preload. I am running straight from the .swf file online, could this be my problem?
(I just found that integrating the .swf file in html is 1 extra step and it's not best for all screen sizes.)
Note: The preloader will work if I completely load the page, go to IE and delete all offline content (while still on the page), and then press the reload button. But otherwise it's completely useless.
Any help's much appreciated...
- stsren
below is the link to the page (1.5 meg page, mind you..)which has the preloader that doesn't really preload.
http://ssquad.clanpages.com/Flash/menu_sshots.swf
Preloader Woes
I have the preloader at my portfolio site working except for the fact it seems to take longer then it should for the preloader to come up. My preloader contains some simple text, some vector panels made in Flash and a small JPEG in the background. You can check it out here: http://likely.reallyrules.com
Any help would be very much appreciated.
Preloader Woes
We need a preloader that will load show percentage however when I put one together it is loading the entire movie and it's very large so it took a few minutes. Anyone know of a way to only load like the first half before playing but for the percentage to still go up to 100%?
Preloader Woes
Trying to make a preloader, the bar works ok
but the dynamic text (counterpercent) is not displayed
The following code is in the bar movie clip instance
Quote:
onClipEvent (load) {
//set the status bar width to zero;
_xscale = 0;
}
onClipEvent (enterFrame) {
//calculate the load as a percentage;
counter = math.floor(_root.getBytesLoaded()/_root.getBytesTotal()*100);
_root.counterpercent = counter+"%";
//if loaded, play;
if (counter>=100) {
gotoAndPlay(2);
} else {
//if not loaded, set the status bar width;
_xscale = counter;
_root.counterpercent = counter+"%";
}
}
Any ideas what I'm doing wrong?
Preloader Woes
Help. I'm new to flash, but not computers. I understand the concept of preloaders and they seem relatively simple. But I'm pulling my hair out and I think I know why but can't find a solution.
A friend of mine designed a flash file for my website...he provided both the SWF and FLA file. It's only 500kb....but I still want a preloader for visitors with slower connections.
The problem is that the SWF file preloads completely...no streaming. Consequently, no preloader seems to work. I created them and added them to my FLA (using the standard scene 1, scene 2, looping, etc), but when I go to check out my website on a 56k connection, I don't see the prelaoder, instead a white screen shows until the whole movie loads and starts playing (no streaming).
I have spent 3 days now searching on the web....the only clue I had when I downlaoded WildForm Linx demo. When I import my SWF file in Linx it gives me the message that this file plays independently in a sprite mode and file will not stream...it will preload completely before playing.
Do I have a flash file that can't use a Preloader??? What is wrong with this picture or what is it I'm not grasping? Any help please email at city3204@hotmail.com I would really apprecaite it.
Eileen
Preloader Woes
Hello All
when testing out my preloader, my movie starts at frame zero instead of frame 1. would anyone know why? all feedback welcomed. Thanks
tone
Preloader Woes
Hey all,
I've created 2 flash documents, 1 that is 83KB and another that is 32KB, I want to make a preloader for each of these. My problem is that when I run the movies and use the bandwidth profiler, i notice that ALL the content is loaded into frame 1. What the heck? Why does it do this and how can i get around this? My first frame is empty except for an actionscript load movie to load my preloader (which is only 1KB). Any suggestions. Thanks in advance!
Preloader Woes...
Can someone help me with a dilemma i'm having? I'm doing a site for a photographer and rather than loading all his photos into the site frmo external jpgs they are embedded so i can load once and surf around the site, so the file is rather large. Now, i'm willing to deal with longish loading times, but the thing is before my preloader even shows up i get a big black box and then my preloader zips through to the end and the site shows up... is there any way to have the preloader appear right away and avoid the black box?
Thanks,
-Nick
Preloader Woes
Hey,
I've just taken over a project from someone and there is a preloader that is acting really weirdly. Basically the bar is hidden and the % number to until aorund 97% when the bar will appear as well as the numbers. I have read other posts with this problem and it is not because of the size of the bar or anything like that which seems to be the cause for alot of people.
I have 3 frames in a row with the following code on:
FRAME ONE:
iBytesTotal = eval(_level0._root.toplayer2).getBytesTotal();
iBytesLoaded = eval(_level0._root.toplayer2).getBytesLoaded();
if (iBytesLoaded>=iBytesTotal) {
gotoAndPlay("image");
} else {
gotoAndPlay("loading");
}
FRAME TWO:
iBytesTotal = eval(_level0._root.toplayer2).getBytesTotal();
iBytesLoaded = eval(_level0._root.toplayer2).getBytesLoaded();
iBytes = (iBytesLoaded/iBytesTotal)*100;
percent = Math.round(iBytes)+"%";
setProperty(this.progress2.pbar, _xscale, iBytes);
FRAME THREE:
if (iBytes<100) {
gotoAndPlay("loading");
} else {
gotoAndPlay("image");
}
I am using FLash MX 2004 Pro by the way.
If anyone has any ideas or anything please post and save my life!
cheers,
jb
[F8] Preloader Woes...
I want a preloader that loads an external SWF file, and when it has completed loading it, takes it to that SWF file and plays it from frame 1. I have been tweaking some code that preloads content internally (which is great for my movie later on), but I am not sure how to code it so that this preloader (index.swf) will load index2.swf and then take us there. Here is what I have so far:
Code:
stop();
progressbar._xscale = 1;
var loadingCall:Number = setInterval(preloadSite, 50);
function preloadSite():Void {
var siteLoaded:Number = _root.getBytesLoaded();
var siteTotal:Number = _root.getBytesTotal();
var percentage:Number = Math.round(siteLoaded/siteTotal*100);
progressbar._xscale = percentage;
percentClip.percentDisplay.text = percentage + "%";
percentClip._x = progressbar._x + progressbar._width;
bytesDisplay.text = "loaded " + siteLoaded + " of " + siteTotal + " bytes";
if (siteLoaded >= siteTotal) {
clearInterval(loadingCall);
gotoAndStop(25);
}
}
So right now, it preloads the content here, and then takes me to frame 25, but I need to modify it so it loads index2.swf and then takes me there.
Any suggestions?
Preloader Woes
I am having a problem after my preloader reaches the SWF movie being loaded. The SWF animation moves much faster than it should, about twice the speed. How can this be fixed?
this is the script I am using on the preloader:
onClipEvent (enterFrame) {
loading = _parent.getBytesLoaded();
total = _parent.getBytesTotal();
percent -= (percent-((loading/total)*100))*.25;
per = int(percent);
percentage = per+"%";
loadBar._width = per;
if (percent>99) {
_parent.gotoAndStop(2);
}
}
Thanks
Preloader Woes
For the last couple of days i have tried everything to firgure out why this is happening.
What happens is when i go to my wesites domain in IE7 or firefox it will load the whole movie before playing it (thats if its one swf) or if its a swf loading a external swf, there will be a delay of 10 seconds or so before the swf is displyed and starts to show the progress of loading the external swf.
I have tried 7 different preloader ways all does the same or shows nothing and i have tried 3 different hosts and 2 other pcs to see if it was the server or just me. all had the same results.
at first i thought it was swfaddress, swfobject or swffit but slowly peeling away even just creating a new flash from start and just having a index.html and test.swf still does it.
I have also googled this alot and found other people had problems with the preloading but no solutions.
heres a simplest of the simplest of preloader i made
http://www.just4usalonandspa.com/test
ActionScript Code:
import flash.events.ProgressEvent;
function update(e:ProgressEvent):void
{
var percent:Number = Math.floor( (e.bytesLoaded*100)/e.bytesTotal);
if(PB is MovieClip){
PB.scaleX = percent/100;
}
if(percent == 100){
play();
}
}
loaderInfo.addEventListener(ProgressEvent.PROGRESS, update);
stop();
the html is just the default page that flash makes during the publishing.
Thank you
Preloader Woes
The File
The problem i am having is that my preloader doesn't work (or isn't working properly like it's supposed to... I get the white screen of nothingness when i "test" my flash... and I attempted to create a preloader to rid myself of the white screen... but it seems i can't escape it... Help!
ActionScript Code:
stop();
this.loaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgress);
this.loaderInfo.addEventListener(Event.COMPLETE, onComplete);
function onProgress(e:ProgressEvent):void {
var loaded:Number = stage.loaderInfo.bytesLoaded;
var total:Number = stage.loaderInfo.bytesTotal;
var pct:Number = loaded/total;
preloader1.scaleX = pct;
preloader_txt.text = "Now Loading... " + (Math.round(pct * 100)) + "%";
}
function onComplete(e:Event):void {
nextFrame();
}
So then after that didn't work i found this one... and altered it... to fit my flash project...
ActionScript Code:
stop();
//this script loads itself ...best attached to the content file.
addEventListener(Event.ENTER_FRAME, loading);
function loading(event:Event)
{
var bytestotal = stage.loaderInfo.bytesTotal;
var bytesloaded = stage.loaderInfo.bytesLoaded;
var percentage = Math.round(bytesloaded*100/bytestotal);
preloader1.scaleX = percentage;
preloader_txt.text = "Now Loading... " + percentage + "%";
if (bytesloaded >= bytestotal)
{
nextFrame();
removeEventListener(Event.ENTER_FRAME, loading);
}
}
So instead of googling another preloader.... i decided to ask the forum in an attempt to figure out what the problem is with my project... and what is it with most people AS3 preloaders that still leaves the white screen...
Thank you in Advance
Preloader Woes
Man, I'm getting the 'hard' stuff but what was once easy is just eluding me!
I have tried three different approaches to making a preloader. Initially, the first code block below worked fine. Now, however, the problem is that the preloader is now counting the bytes of the preloader itself! So, upon entering the url, there is nothing but black until about 95% is loaded and the preloader pops onto the screen with the progress bar about 95% done and then the enter button comes up.
All I have in the preloader is a png graphic, an empty movie clip which loads a jpeg into it and the actual little loader bar. Were this a web page, the whole thing comes up in about 2 seconds.
I've tried placing the actionscript on a frame after the inital frame which loads the jpeg and the background, but I'm still preloading the preloader!
Here's the first block I had:
---------1st frame has:----------:
loadMovie("promo.jpg", promo);
With two other layers. One contains the png background the other the empty movie clip named 'promo.'
---------2nd frame has:----------
LOADED = Math.round(_root.getFramesLoaded());
TOTAL = Math.round(_root.getFramesTotal());
PERCENT = LOADED/TOTAL;
BAR._width = PERCENT*248.9;
if (LOADED == TOTAL) {
gotoAndPlay("HoldImage");
}
Where the '248.9' above is the width of the preloader bar.
---------3rd frame has:----------
gotoAndPlay(2);
---------4th frame has:----------
stop();
also has a button that appears in place of the bar and a label "HoldImage"
My problem is that the preloader seems to be preloading everything, including the preloader. The main movie is only about 15 frames long.
I've also tried substituting getFramesLoaded in place of the bytes.
Thanks for any insights.
Preloader Woes
I have building a flash video player app and have pretty much completed it and wanted to add a preloader. I added a new scene in front of the 'main' one called it 'loader'. I put some code that checks for bytes loaded and and waits for an XML to load with setInterval. The loader works fine *I've stepped through every action* when it gets to my main scene it runs all the init code fine (setting some variables and functions that are on frame 1). BUT any time it gets to a function that is not on frame 1 it just skips it.
ie:
setInterface(); //runs fine properly jumps to the function
sliderBox.slider.loadModules(); // gets skipped does not get executed
before I added the other scene and the loader code the loadModules() function executed fine. I've tried _root.sliderBox.slider.loadModules() and nothing. Whats strange is code that is on objects in the movie but not in functions still run but not the functions them selves. Does something weird happen to variable scope when I add another scene?
Preloader Woes.......
Ok, I've attempted doing preloading but it doesn't seem to be working right or it might be the fact that I'm doing it locally and the 1meg file I'm trying to load isn't enough. Can somebody post a simple fla of an example. I can figure it out from there. Thanks a billion. Oh and for all of you that have been giving me help, here is the partially finished project! http://www.kernlearn.net/Personnel/.
P.S. this is what I would be using the preloader for.
Yes...more Preloader Woes.
Hi guys, i've built a preloader and am trying to get it(bar and text) to fade out once loaded. I've been following this thread but to no avail . I think it's because of the way the preloader is built, as the loader bar progresses the text box containing the % follows it.
Quick glance at the code:
Code:
bytes_loaded = Math.round(getBytesLoaded());
bytes_total = Math.round(getBytesTotal());
percent_total = (bytes_loaded/bytes_total)*100;
_root.loaded_text = Math.round(percent_total);
//sets the text box to follow the loader bar
startpoint = bar._x
text._x = startpoint + (bar._currentframe*2.5);
//fades out the loader once loaded
if (percent_total>=100) {
bar._alpha -= 5;
}
FLA HERE
Preloader Woes
For some reason when I upload my site to the server, my preloader freezes, acts weird, etc. but locally it's fine. Any help would be greatly appreciated.
ActionScript Code:
onClipEvent (load) {
percent = 0;
}
onClipEvent (enterFrame) {
loading = _root.target_mc.getBytesLoaded();
total = _root.target_mc.getBytesTotal();
percent -= (percent-((loading/total)*100))*.25;
per = int(percent);
percentage = per+"%";
_root.bar.bar2._alpha = 100;
_root.bar.bar2._yscale = per;
if (percent>99) {
_root.bar.gotoAndPlay(15);
}
}
Preloader Woes
ok so i'll try and explain this as easy as possible.
i have 2 movie clips in my base movie.
- dropbox ( an empty clip that i'm importing swfs into )
- loadking ( a preloader movie clip that i want the external swfs to access )
so what i'm trying to do is have a preloader clip in my base movie. i want to load external swfs and instead of them having their own loader, i want them to access the " loadking ". i'm using a template for all of the external swfs and there will only ever be one loaded at a time.
right now on the first frame of my external swf i have this :
stop();
_parent.loadking.gotoAndStop("notLoaded");
in the loadking clip, the first frame has a stop and there are two frame labels after that. they are called "notLoaded" and "loaded". on the "notLoaded" frame label is the preloader clip. on the preloader clip, it says this
onClipEvent(load){
bar._xscale = 0;
}
onClipEvent(enterFrame){
bar._xscale = ((_parent.dropbox.getBytesLoaded() / 1024) / (_parent.dropbox.getBytesTotal() / 1024) * 100);
if ((_parent.dropbox.getBytesLoaded() / 1024) >= (_parent.dropbox.getBytesTotal() / 1024) && (_parent.dropbox.getBytesTotal() / 1024) != 0){
_parent.gotoAndPlay ("loaded");
}
}
the frame label "loaded" just has a short tween that fades out the loader that has a stop action at the end and also tells the external swf to go the the next frame ( which is where the image is ).
when i test it online, nothing happens...it doesn't even go to " notLoaded ". and i know the loadMovie command is working cause i tested it before this.
please help
myron.
AS3 - Preloader Woes
I have a preloader that works perfectly on first load, but gets stuck when you come back to the page a second time. Well, it works when I debug it in Flash, but within the browser it appears that everything comes to a halt.
Code:
function loaderTest(eventObject:ProgressEvent):void {
var sizeLoaded:Number = eventObject.bytesLoaded;
var sizeTotal:Number = eventObject.bytesTotal;
var loadPercent:Number = (sizeLoaded / sizeTotal) * 100;
var per:int = int(loadPercent);
var per2:String;
if (per < 10) {
//Adds a 0 in front fo numbers under 10 for even double digits.
per2 = "0" + int(loadPercent);
} else {
per2 = "" + int(loadPercent);
}
if (loadBar is MovieClip) {
loadBar.width = (stage.stageWidth - 40) * (loadPercent/100);
}
mouseLoad.dataBox.textPer.text = per2;
if (loadPercent > 0 && loadPercent == 100) {
//completion function
mouseLoad.dataBox.textPer.text = "";
dataCenter(eventObject);
Tweener.addTween(totalBar, {time:1, width:0, delay:0.5, transition:"easeInOutExpo", onComplete:loadDone});
Tweener.addTween(loadBar, {time:0.5, width:0, delay:0, transition:"easeInOutExpo"});
Tweener.addTween(mouseLoad, {time:0.5, alpha:0, delay:0.5, transition:"easeOutQuad"});
}
}
loaderInfo.addEventListener(ProgressEvent.PROGRESS, loaderTest);
Preloader Woes
Hello all, hoefully some of yoy Flash Gurus can help me. I belive it's a fairly simple questin but my AS skills a pretty limited. Here goes.
I;m trying to create a preloader for my main movie. I have 2 scenes. Scene 2 is the preloader, scene 1 is the main movie. I've used this method once befoe and got it to work, but nothing seems to happen this time. Here's the AS.
total = _root.getBytesTotal();
loaded = _root.getBytesLoaded();
percentage = Math.floor((loaded/total)*100);
percframe = Math.floor(percentage/2);
//trace(total);
//trace(loaded);
//trace(percentage);
if (percentage >= 100) {
gotoAndPlay("scene1",1);
}else {
with(_root.bar) {
_xscale = percentage;
}
}
On the next frame there is a gotoAndPlay()
When I test it my preload bar dosen't even show up. Any help you guys could give me would be greatly appreciated.
Preloader Woes
posting again maybe someone can help!!!!!!
My point is this basically if the preloader is doing its job it shouldnt matter if its a 20 mb file or a 1 mb file it should just let the file play once it is loaded, no? Im sure someone here has had this problem.
my preloader stays "preloading" until the movie is cached (i assume its what it is doing) basically i have the very small logo fading in and out for not even 15 frames and the movie im loading seams to load but i miss like the first transitional fade-ins (20 frames) of the load external swf... any ideas? please save my tookus!!! :)
silver_pound_cans wrote:ok so i have the main swf and i have a stop and all the button code for each button at the top navigation bar.
Code:
ba.onRollOver = function() {
this.gotoAndPlay(2);
};
ba.onRollOut = function() {
this.gotoAndPlay(9);
};
ba.onRelease = function() {
gotoAndPlay("home");
};
b1.onRollOver = function() {
this.gotoAndPlay(2);
};
b1.onRollOut = function() {
this.gotoAndPlay(9);
};
b1.onRelease = function() {
gotoAndPlay("about");
};
b2.onRollOver = function() {
this.gotoAndPlay(2);
};
b2.onRollOut = function() {
this.gotoAndPlay(9);
};
b2.onRelease = function() {
gotoAndPlay("graphic");
};
b3.onRollOver = function() {
this.gotoAndPlay(2);
};
b3.onRollOut = function() {
this.gotoAndPlay(9);
};
b3.onRelease = function() {
gotoAndPlay("motion");
};
b4.onRollOver = function() {
this.gotoAndPlay(2);
};
b4.onRollOut = function() {
this.gotoAndPlay(9);
};
b4.onRelease = function() {
gotoAndPlay("audio");
};
b5.onRollOver = function() {
this.gotoAndPlay(2);
};
b5.onRollOut = function() {
this.gotoAndPlay(9);
};
b5.onRelease = function() {
gotoAndPlay("illustration");
};
also i have the "advanced loader" code and needed elements for it to work ( loader/holder)in the same frame (loader, buttons and stop code is on seperate layers btw)... here is an example. all others are the same (except for loader id and holder id of course) and seems to give me problems with the bigger swfs.
Code:
var mcl:MovieClipLoader = new MovieClipLoader();
var mclL:Object = new Object();
mclL.onLoadProgress = function(target,loaded,total) {
loader3.percent.text = Math.round((loaded/total)*100)+"%";
}
mclL.onLoadInit = function() {
loader3._visible = false;
loader3.percent.text = "";
}
mcl.addListener(mclL);
mcl.loadClip("Graphic_07.swf",holder3);
now you said something about the advanced preloader but can that be used with externally loader swfs? wasnt too clear on that one. Thanks in advance for your help ! this will definately make it or break it "transition-wise". Thanks again and again!!!!!
Preloader Woes :(
my preloader stays "preloading" until the movie is cached (i assume its what it is doing) basically i have the very small logo fading in and out for not even 15 frames and the movie im loading seams to load but i miss like the first transitional fade-ins (20 frames) of the load external swf... any ideas? please save my tookus!!! :)
Flash MX Preloader Woes
Alright, I have been screwing around with flash off and on for about 2 years. I was good with preloaders in Flash 5 but now that I purchased Flash MX it just freezes the movie I tell it to go once it's done loading. It's almost like a gotoAndStop() instead of the gotoAndPlay() I have been telling it to do.
It's getting me pretty upset. When I publish the movie and upload it to my webserver I can visit the page but the sucker freezes on frame one of the main movie. You can actually view the flash movie once it's done loading but you have to 'right click' on the movie and unselect the 'loop' or 'play' that is check marked.
Does anyone know why Flash MX does this? I have never ran into this problem before. I am using the basic preloading actionscript.
IE:
if (_framesloaded>=_totalframes) {
gotoAndPlay("main movie",1);
} else {
gotoAndPlay("preloader",1);
}
Any helpful hints would be appreciated. Thanks!
Clown
Simple Preloader Woes AGAIN :(
Damn it! Exactly the same configuration on another movie and it works fine! Why on earth doesn't it work on this movie?
Just a simple pre-loader that should work!
link
(the actionscript is attached to the bar mc)
any help appreciated ;/
thanks
sgel
External Preloader Woes
Hey all, I created an external preloader that loads any amount of swf URLs from an array. It creates blank movie clips and does a loadmovie on all of the URLs stored in the array into these blank movie clips, until the last element is loaded. While the loadmovie is performed, the movie clips are set to an alpha of 0 so they can't be seen. The preloader works fine with say...4 or 5 files, but any more it lags.
For some reason, I can't set property _visible = false to the movie clips...and using alpha is setting a huge strain on the cpu when many files are loaded, so that the progress bar fails to update due to lack of system resources....
My load progress is tracked using a onEnterFrame=function() and inside the function, a for loop that gives all the movie clips a stop() action, so that the movie clips i loaded will not play every time the frame is loaded. Is there a better way to do this? Or is there any way to stop a movie(swf) on all levels? Because on some clips that i preload, there is an animated movie clip on the first frame that plays regardless if i place a stop action on it.
Any ideas? Thanks
External Swf Preloader Woes.
I thought this would be simple, I have made preloaders before without any problem....
Onto the problem...
I have an external swf with a simple preloader on frame 1, it functions fine when i open the external swf on its own.
Now when I try to load the external.swf with the preloader into my_mc in my MAIN.swf the preloader loads fine then once at 100 percent it stops?
Something seems to be stoping it from jumping onto frame2, when there is a gotoAndPlay(2); in the apporpriate place, and I know this because it works fine when i just open the external.swf on its own.
So this got me asking is it something with my MAIN.swf.
So i created a new empty scene with plain buttons and my_mc to load the external.swf into.
sure enough it does the same, loads untill 100% then suddenly jams.
I started trying all kinds of different preloaders. No Luck. all jamming on 100%
Whats the catch? is there a certain preloader that i have been unable to uncover that I have to use on an external swf?
I am certain its no scritping problems because as i said earlier, it works fine when I only open the external.swf
I am confused!
Can someone fill me in?
Cheers!
Loading Woes (not Preloader Though)
Hi everyone
I want to be able to check that something has loaded before going on to the next frame. In my main timeline I have a keyframe on the actions layer with this script:
Code:
stop();
mtClipLeft_mc.loadMovie("homepageLeft.swf");
homepageLeft.swf has its own preloader but as homepageLeft.swf is quite large it can take a short time to come into affect. Is there some script that follows what I have written above which could check that frame one of homepageLeft.swf has loaded before the main timeline (currently stopped) can continue playing?
Something like ...
on frame load ("homepageLeft.swf", 1) {
play();
...or something?
Thanks
Preloader & First Frame Woes
...so I can't get my preloader to appear before 50% percent, and I gathered from watching the simulate download settings in SWF player that it isn't loading Frame 1 (which contains the preloader) until it's already loaded 50% of the movie. Now I fired up the Frame by Frame graph and I saw that my first frame had over 184kb of data in it! I say this is surprising because at the moment all that was in the first frame of the movie was the preloader (some dynamic text and a single rectangular fill).
Soooo, I deleted those and just assigned a stop(); action to frame one, re-ran SWF player, and the frame size remained the same. What's driving me up the wall is that all that is in frame one (of every layer) are Blank Keyframes!!
All my content is distributed across about 8 layers, and all reside solely in frame 2 of the root movie. I don't know of it makes any difference, but most of my content is generated dynamically through AS, but I've even moved that to frame 2. Once the movie loads, everything works fine, but I can't figure out why frame one is so large when there's nothing in it!!
Can somebody please shed some light on this???
Screenshots of both the Frame by Frame graph and my main timeline:
Frame by Frame Graph
Timeline
Preloader Woes; Firefox V IE7
I'm trying to get a simple preloader to work.
I've got the following code on frame 1 of my movie:
ActionScript Code:
stop();
root.loaderInfo.addEventListener(ProgressEvent.PROGRESS,progressHandler);
root.loaderInfo.addEventListener(Event.COMPLETE,loadingDone);
function progressHandler(e:ProgressEvent):void
{
var myProgress:Number = e.bytesLoaded/e.bytesTotal;
myLoadingBar.scaleX = myProgress;
} // end progressHandler
function loadingDone(e:Event):void
{
play();
} // end loadingDone
When I view the movie in Firefox it works exactly as intended. The progress bar slowly grows to 100% and then the movie starts.
The problem is, when I view it in Internet Explorer it doesn't behave in anything like the right way. Usually I just get a blank screen until everything's loaded, and then the movie starts. Sometimes I see frame 1 (on which the progress bar is fully extended all the time, just like it is in the .fla file) until everything's loaded and then the movie starts.
The only things I have in my library are a set of 6 bitmaps and the progress bar. None of those are exported for Actionscript (if that makes any difference).
I'm guessing this is a common problem? Is there something I need to do in order to get my preloader working properly with IE7?
I'm using Windows XP and the latest version of Flash Player 9.
Thanks in advance for any help anybody can give me.
My Thumbnail Preloader Woes...
Hi im having huge diemmas.
I have a script for loading pcitures into thumbnails which works perfect locally, but over the net it is very chunky and slow. Anyway to cut a long story short ive tried to implement a preloader, which is quiet simply is dynamically created textfield attached to each thumb with download progress displayed. Its almost like I need a preloader for the preloader though, lol. It seems the textfield only gets created at the same time the thumbnail pic appears?
Here's a snippet of my code..
ActionScript Code:
..........................curr_thumb.loadMovie(curr_thumb.variables);preload(curr_thumb);}//_root.scrollpane_cmp.setScrollContent(curr_gallery);};// var count = 0;preload = function (curr_thumb) { var curr_dummy = curr_thumb._parent.createEmptyMovieClip("dummy"+curr_thumb.index+"_mc", curr_thumb.depth+1); curr_dummy.createTextField("label"+curr_thumb.index+"_txt", 0,curr_thumb._x,curr_thumb._y,600,600); curr_dummy["label"+curr_thumb.index+"_txt"].text = curr_thumb.index; //curr_thumb.label.text="hello"; trace("curr_thumb parent: " + curr_thumb._parent); trace("parent's depth: " +depth); trace("preload "+container); curr_dummy.onEnterFrame = function() { var t = curr_thumb.getBytesTotal(), l = curr_thumb.getBytesLoaded(); if (t && !isNaN(t)) { var percent = Math.round(l*100/t); if (l == t) { trace("loading complete"); curr_thumb._width = 174; curr_thumb._height = 112; curr_thumb.onRollOver = curr_thumb.onDragOver=selectThumb; curr_thumb.onRollOut = curr_thumb.onDragOut=deselectThumb; curr_thumb.onRelease = activateThumb; this.removeMovieClip(); } else { trace("loading "+percent+" %"); curr_dummy["label"+curr_thumb.index+"_txt"].text = percent+" %"; } } };
My Thumbnail Preloader Woes...
Hi im having huge diemmas.
I have a script for loading pcitures into thumbnails which works perfect locally, but over the net it is very chunky and slow. Anyway to cut a long story short ive tried to implement a preloader, which is quiet simply is dynamically created textfield attached to each thumb with download progress displayed. Its almost like I need a preloader for the preloader though, lol. It seems the textfield only gets created at the same time the thumbnail pic appears?
Here's a snippet of my code..
ActionScript Code:
..........................curr_thumb.loadMovie(curr_thumb.variables);preload(curr_thumb);}//_root.scrollpane_cmp.setScrollContent(curr_gallery);};// var count = 0;preload = function (curr_thumb) { var curr_dummy = curr_thumb._parent.createEmptyMovieClip("dummy"+curr_thumb.index+"_mc", curr_thumb.depth+1); curr_dummy.createTextField("label"+curr_thumb.index+"_txt", 0,curr_thumb._x,curr_thumb._y,600,600); curr_dummy["label"+curr_thumb.index+"_txt"].text = curr_thumb.index; //curr_thumb.label.text="hello"; trace("curr_thumb parent: " + curr_thumb._parent); trace("parent's depth: " +depth); trace("preload "+container); curr_dummy.onEnterFrame = function() { var t = curr_thumb.getBytesTotal(), l = curr_thumb.getBytesLoaded(); if (t && !isNaN(t)) { var percent = Math.round(l*100/t); if (l == t) { trace("loading complete"); curr_thumb._width = 174; curr_thumb._height = 112; curr_thumb.onRollOver = curr_thumb.onDragOver=selectThumb; curr_thumb.onRollOut = curr_thumb.onDragOut=deselectThumb; curr_thumb.onRelease = activateThumb; this.removeMovieClip(); } else { trace("loading "+percent+" %"); curr_dummy["label"+curr_thumb.index+"_txt"].text = percent+" %"; } } };
MovieClipLoader Preloader Woes: Help Me OB One
I'm getting frustrated. I can't find a complete example of new way of pre-loading in mx 2004.
So... I have mclic i want to pre-load in to my main clip. I want the source path to be a variable so when i click something else it will load the chosen clip and use this one pre-loader for each new clip loaded.
My clips to be loaded have an empty frame with stop(). So when it will finish loading the pre-loader will tell it to got nextFrame.
This is the AC2 i have so far from some tuts but no avail. This code is in the first frame. It will end up being a seperate standalone loading clip.
ActionScript Code:
stop();
var loadthis = "images.swf";
var mcLoader:MovieClipLoader = new MovieClipLoader();
var Listener:Object = new Object();
Listener.onLoadComplete = function(empty_mc) {
this.empty_mc.gotoAndStop(2);
this.nextFrame();
};
mcLoader.addListener(Listener);
mcLoader.loadClip(_root.loadthis, this.empty_mc);
trace(_root.loadthis);
Thanks in advance
Preloader Woes With Music/soundfiles
Hi everyone,
I've made a SWF file which uses sounds that have to export in the first frame.
The only external preloaders I've seen load the movie into a blank clip in the first frame.
This is, I assume, so that you can check the bytes loaded of a clip.
When I do this, however, my movie ceases to function unless
I change all of its code to _level0.CLIPNAME.etc...
so, I grit my teeth and changed all of the _root code to _level0.CLIPNAME code... then, it all worked except none of the sounds would play!!!
so,
is there a way that I can make a preloader function if I load the SWF onto the _root of my preloader? if not, how the heck will I get any of it to function?
Preloader Woes: Stage == Null?
Hi guys,
I'm having two real weird issues goin' on with my Flash game. Well, more specifically the game's pre-loader.
Code:
var _request:URLRequest = new URLRequest("main.swf");
var _loader:Loader = new Loader();
_loader.load(_request);
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaderComplete);
function loaderComplete(e:Event):void
{
stage.addChild(_loader.content);
}
This is the loading code so far. It's rather self-explanitory, I think.
There are two problems arising:
- Firstly, the 'loaderComplete' function never gets called. However, "main.swf" still starts to play? I know this because...
- ...the second problem is:
Code:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at main_fla::MainTimeline/main_fla::frame1()
After debugging it appears that in main.swf, when run through this preloader, 'stage' is null and thus my stage.addChild calls are throwing error #1009.
What am I doing wrong?
Thanks.
Preloader, Library Linkage Woes
I have a preloader swf (preloader.swf) that loads another swf into it (test.swf). test.fla's library has an asset RectangleMC whose linkage is set to lib.RectangleMC and to export on the first frame. test.fla has a Document class (TestClass) wherein RectangleMC is used. When I run preloader.swf I get the following errors:
Quote:
TestClass.as, line 11 - 1046: Type was not found or was not a compile-time constant: RectangleMC.
TestClass.as, line 14 - 1180: Call to a possibly undefined method RectangleMC.
TestClass.as, line 4 - 1172: Definition lib:RectangleMC could not be found.
If I copy the RectangleMC from the library of test.fla and place it in the library of preloader.fla, everything works. This of course is not what is wanted, so how do I make sure that linked MCs stay connected correctly in the appropriate .fla?
So, I've got a temporary workaround:
When exporting stuff from the lib. for AS, Flash is supposed to create a Class for the objects if they don't already exist right?
Quote:
At this point, if Flash can't find an external ActionScript file with a definition for the specified class (for instance, if you didn't need to add additional behavior for the symbol), a warning is displayed:
A definition for this class could not be found in the classpath, so one will be automatically generated in the SWF file upon export.
You can disregard this warning if your library symbol does not require unique functionality beyond the functionality of the MovieClip class.
If you do not provide a class for your symbol, Flash will create a class for your symbol equivalent to this one:
ActionScript Code:
package { import flash.display.MovieClip; public class ExampleMovieClip extends MovieClip { public function ExampleMovieClip() { } }}
Problem is these classes aren't 'actually' created, hence the 'type was not found' errors I was getting.
The workaround is to manually create that dummy class.
ActionScript Code:
package { import flash.display.MovieClip; public class RectangleMC extends MovieClip { public function RectangleMC() { } }}
Voila! No more errors. Problem is - what if I have 100 MCs linked for AS in my lib? I've got to do this 100 times, and that's just dumb.
The problem w/ this is that now, because you have this base class, if you've got things like TextFields, SimpleButtons or other MCs which you reference via . e.g.:
ActionScript Code:
var rect:RectangleMC = new RectangleMC();rect.someTextField.text = "foo";
Now it throws an error saying there's an unexpected property 'someTextField' in class RectangleMC (because you haven't declared that var of course in your linked MC)
This is getting really frustrating.
Preloader, Library Linkage Woes
I have a preloader swf (preloader.swf) that loads another swf into it (test.swf). test.fla's library has an asset RectangleMC whose linkage is set to lib.RectangleMC and to export on the first frame. test.fla has a Document class (TestClass) wherein RectangleMC is used. When I run preloader.swf I get the following errors:
TestClass.as, line 11 - 1046: Type was not found or was not a compile-time constant: RectangleMC.
TestClass.as, line 14 - 1180: Call to a possibly undefined method RectangleMC.
TestClass.as, line 4 - 1172: Definition lib:RectangleMC could not be found.
If I copy the RectangleMC from the library of test.fla and place it in the library of preloader.fla, everything works. This of course is not what is wanted, so how do I make sure that linked MCs stay connected correctly in the appropriate .fla?
Attached Files
More Woes
I have a button inside of a movieclip. My main movie has two scenes. When this button is clicked it should forward to the next scene, but it doesn't...
Code on button:
on (release) {
gotoAndPlay("Scene 2", 1);
}
<img> Tag Woes
i'm having big problems with the <img> tag in an html text field.
i want one photo to be in the corner, and then the text to flow around it. this should be easily possible.
if i use the <img> tag with a jpeg, the image doesn't load straight away, which is understandable. but when it does load, it appears behind the text - the text is not flowing around it. and then inexplicably if i click the textfield or the picture, after half a second or so it rearranges and flows around the picture, how i want it. but this is no good - i can't have it wrong and then suddenly right, it looks terrible.
then i thought, maybe it's something to do with loading remotely, so i'll try using a movieclip - using the linkage feature. when i do this, it works straight away - or sort of. something appears straight away, and the text is where it should be, flowing around the right size box, but the image that appeared is actually only the first 20 or so rows of pixels of the image.
what's going on?
the reason i don't just hard code the text and picture in is that the text must be dynamic - updateable by my client. the picture will remain but i can't flow dynamic text around a picture any other way. or if there is a way i'd love to know it.
thanks a lot
AS Woes.
Okay, here is another problem that I've come upon. This isn't so much a problem as a nuisance. Now what I've got set up is so that the BG of the site is randomly chosen. However, the way it is currently set up, the BG just shows up. I tried adding the first 'while' loop so that it would randomly change BG's before settling on one color.
The problem is that it doesn't rotate, it just modifies the variable l to 10000 and then starts the second 'while' loop. This happens in under 10 seconds. I just want it to rotate between colors that I can see.
Code:
onClipEvent (load) {
//setInterval(tinter, 1000)
//function tinter(){
l=0
while (l <10000) {
blue = random(150);
red = random(150);
green = random(150);
var transformObject:Object = new Object();
//Attach your random values
transformObject.rb = red;
transformObject.gb = green;
transformObject.bb = blue;
//Now we need a color object attached to "this"
var myColor:Color = new Color(this);
//Finally, attach the transform object to the color object
myColor.setTransform(transformObject);
l++
trace(l)
}
mynumber = random(20);
i = 0;
while (i != mynumber) {
i = random(100);
blue = random(150);
red = random(150);
green = random(150);
trace(mynumber+" "+i);
//trace(red+","+green+","+blue);
//Create a transform object
var transformObject:Object = new Object();
//Attach your random values
transformObject.rb = red;
transformObject.gb = green;
transformObject.bb = blue;
//Now we need a color object attached to "this"
var myColor:Color = new Color(this);
//Finally, attach the transform object to the color object
myColor.setTransform(transformObject);
}
}
Now I'm going to try and add new lines of code that start onClipEvent (enterFrame) for the first loop, but we'll see.
Any suggestions?
Thanks,
DaVuLf
Pop Up Woes
Hi. Im kinda got pushed into falsh really quickly. I have a webssite with small images. I created a click to enlarge button so people can see my artwork bigger. i use a beginner script to do it.
on (release) {
getURL("file:///C:/Documents%20and%20Settings/HP_Administrator/My%20Documents/jontest/XLImages/driver1finalXL.html","_blank");
}
For some reason the pop up only works when i view it on my home computer but it will not work on the internet at all. Could anyone tell me why? By the way my site is
www.jellisart.net
Maybe it will help to see what im talkin about.
[F8] XML Woes
Hey,
I'm having some problems and i don't know how to fix them. I'm relativley new to flash.
Here is my actionscript:
Code:
//create a new xml object
urlXML = new XML();
//when the xml data has loaded, we want the XML Object to run the convertXML function
urlXML.onLoad = convertXML;
//Write to your text area that the data is loading.
content_feed_display = "Loading data...";
//now load up the url.
urlXML.load("song.xml");
function convertXML() {
if(this.loaded) {
content_feed_display = "Data loaded.";
}
mainTag = new XML;
elementTag = new XML;
articleList = new Array;
elementList = new Array;
mainTag = this.firstChild.nextSibling;
if(mainTag.nodeName.toLowerCase() == "moreovernews") {
articleList = mainTag.childNodes;
content_feed_display = "";
for(i=0;i<=articleList.length;i++){
//initialize a couple of variables to hold xml data we want displayed
document_url = "";
headline_text = "";
if(articleList[i].nodeName.toLowerCase() == "article") {
//we get the child node array beneath the articles, aka the meat and potatoes we are after
elementList = articleList[i].childNodes;
//and loop through that looking for the data we need
for(j=0;j<=elementList.length;j++) {
elementTag = elementList[j];
elementType = elementTag.nodeName.toLowerCase();
if(elementType == "headline_text"){
headline_text = elementTag.firstChild.nodeValue;
} else {
if(elementType == "url"){
url = elementTag.firstChild.nodeValue;
}
}
}
content_feed_display += "<p><font size="+2"><a href="" + url + "" target="_new">"+ headline_text +"</a></font></p>";
}
}
}
}
I'm getting this error when i test the movie:
Quote:
WARNING: This movie uses features that are not supported in the Flash 5 player
Scene=Scene 1, layer=Layer 2, frame=1:Flash MX Text Field Instance Name
What do i need to change, get rid of, or do differently?
Thanks!
FLV Woes...
Hi,
I have this program I have been asked to "update". They had the videos for it redone about a year ago (the company who did the vids is no longer around) the FLVs they have are compressed for flash player 8 or higher... here is the issue... the program they need to go into has to be published as 7 for they older code to work with the older LMS/script.
So the flv's will not play when published as 7. Is there anything I can do to the flvs to re-compress them with the player 7 compatible codec????
I only have access to the flvs and not to the original whatever they were filmed in files.
Any suggestions at this point would be helpful.
Thank you!
|