Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Preloading Dynamic Images?



Hi there, does anyone know how to preload images into Flash that are external from the SWF file. I am using non progressive jpegs and they are loading in OK, but I need them preloaded! The usual preload commands that preload frames in the SWF file do not work, as it only preloads the SWF file and not the external jpeg file.

Can this be done?



Ultrashock Forums > Flash > ActionScript
Posted on: 2002-10-15


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Preloading The Dynamic Images.
I m loading the images dynamically using flash mx. Is there any way that i can preload those images.

Also want to know how can I preload multiple swfs.

cheers
Rits

Preloading Dynamic Images
im doing my best to keep the site im working on dynamic. i have sections of content that have thumbnails that are loading dynamically based on the rollover code. they aren't that big in terms of file size but there is a little delay while they load. given that these images are 8 or 12 k each, could i just preload them somewhere and if that is a smart thing to do how would i do it?

Preloading Dynamic Images.. Serious Need Of Help Here
I got a mass amount of images that need to be preloaded dynamically.

Lets say I have 20 pictures that are all on a server.. the SWF creates a new movieClip for each one depending on how many are in the XML file..



It organizes them horizontally just fine, but some of them don't space evenly because the thumbnails haven't all downloaded, so it can't read their width and it makes them overlap..

However when I reload it, since all the thumbnails are downloaded from teh previous load, they space just fine.


So i need to find a way to preload all of these thumbnails before hand.



I tried loading them all individually into one clip then creating the line of clips after.. but they load all randomly.. it'll load like 1, 1, 1, 3, 6, 3, 8, 9, 31, 1, 3, 5, 3, 8, 9, 6, 4, .. it repeats a lot of them..

So I'm not sure where to go from here!





Code:

function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
thumbnails = [];
total = xmlNode.childNodes.length;



for (i=0; i<total; i++) {
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
thumbnails[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;

//thumbnails_fn(i); // this WOULD load them all in a line. but its not necessary yet because they aren't preloaded!!

thumbnail_mc.loadMovie(thumbnails[i]); //load each clip based on I statement

thumbnail_mc.onEnterFrame = function() {
var totalv = thumbnail_mc.getBytesTotal();
var loaded = thumbnail_mc.getBytesLoaded();

percent = Math.round((loaded/totalv*100)/image.length);
if (loaded == totalv && totalv > 4) {
trace(loaded);

delete this.onEnterFrame;
}

};





thumbnail_mc._alpha=0;
}
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images2.xml");

p = 0;
this.onEnterFrame = function() {
if (thumbnail_mc._alpha <100){
thumbnail_mc._alpha +=2;}

};

If you need it, here is the script to get them line up right!




Code:
function thumbnails_fn(k) {
b = k;
thumbnail_mc.createEmptyMovieClip("t"+k,k);
tlistener = new Object();
tlistener.onLoadInit = function(target_mc) {
//target_mc._x = hit_left._x+(eval("thumbnail_mc.t"+k)._width) * k;
if ((eval("thumbnail_mc.t"+k))._width > 10){
trace(eval("thumbnail_mc.t"+k)._width);
if (k == 0)
{

target_mc._x = hit_left._x; //Offset from the border of hit_left
}
else
{
target_mc._x = hit_left._x; //Offset from the border of hit_left
for (i = 0; i < k; i++)
{

target_mc._x = target_mc._x + eval("thumbnail_mc.t"+i)._width + 5;
// trace("i = " + i + " Distance = " + target_mc._x); //Debugging information

}
}}

//
target_mc.pictureValue = k;
target_mc.onRelease = function() {
p = this.pictureValue-1;
nextImage();
};
target_mc.onRollOver = function() {
this._alpha = 50;
thumbNailScroller();
};
target_mc.onRollOut = function() {
this._alpha = 100;
};
};
image_mcl = new MovieClipLoader();
image_mcl.addListener(tlistener);
image_mcl.loadClip(thumbnails[b], eval("thumbnail_mc.t"+b));

}


This has been driving me nuts for the past 2 days! I really need some help!!

Thanks!

Preloading Dynamic Images
Currently my movie loads dynamic images from another website whose location is retrieved from a (dynamic) XML file. Right now the images are not preloaded, and are loaded only when a user specifically clicks a button to generate them.

The button initiates a for loop that continues until it attaches a separate movieclip of all the images that were included in the XML file. The moveclip instance loads the movie in the first frame of its timeline is simply a placeholder for the image. There can be up to 60 images loaded at one time.

Now it would only make sense to preload these images, but I wasn't sure what would be the most efficient way of doing it and what would be the least demanding on a users system resources - if it even makes a difference.

My first hunch was to just run the for loop at the beginning of the movie and just hide each separate image until they are called in. But I wondered if it would be more efficient to attach and preload just 1 movie clip that includes all 60 of the images and just hide that.

In summary: Is it more efficient to attach and load a movieclip instance onto the main stage for each separate image or to attach and load 1 big moveclip instance that contains all 60 images.... or does it even make a difference? (Mainly in terms of system resources)

Or maybe there’s an even better way to do it?

Preloading Dynamic Images
Hello,
I am building an application and I am using xml to dynamically load in images. Is it possible to preload each image as it is called? I am a bit of newbie to flash so any help or advice is much appreciated

Cheers

Preloading Dynamic Images
I have a sweet little problem. In my animation, i am dynamically loading images, one per frame into a blank movie with instance name loadimage.
The problem is that each of these images is around 90-100k and it takes hell of a time to load.
I was wondering if there is a way to preload all the images before the movie is starts? Or better still preload lets say first 5 images and then continue preloading the rest of the images while the movie runs?

Preloading Dynamic Images
Morning Lads,

Having a bit of an issue here. I'm building a webcam script / component for flash but I can't get my preloader to recognize a dunamic image. I've got the timer script working and the images load on the first run. But each consecctive recycle displays the same image, it does not refresh. As well as the preloader for the images does not register an image referanced by a URL as a number of bytes to be loaded.

URL
http://www.plexusstudio.net/temp/webcam2.swf

nned some help

Preloading Dynamic Images
Hi guys,

I'm trying to preload some images through xml but I can't seem to get it right.

this is my function which I then use in a loop


Code:

function startLoading (whichImage, holder) {
loadMovie (whichImage,holder);
_root.onEnterFrame = function () {
infoLoaded = holder.getBytesLoaded ();
infoTotal = holder.getBytesTotal ();
trace(infoTotal);
percentage = Math.floor (infoLoaded / infoTotal * 100);
if (percentage >= 100) {
delete this.onEnterFrame;
trace("done");
}
};
}



Usage would be smt like startLoading (image[i], imgHoldr[i]);

For some reason I can't get the actual filesize of the image. It always gives me 4kb as image size. IE.. if I trace getBytesTotal it outputs = 4.

Why is this?

Thx

Preloading Dynamic Images For Rollovers Please Help
ok im using dynamic images in my flash movie, i want to know if anyone can tell me how to preload my images.

thanks
atf

Preloading Dynamic Images As A Group
All the dynamic image preloader scripts I've found just pause the movie clip until the loading is complete and then play it, which is fine if you want to have a preloading pause every time you click next image, but I'd rather have everything preload at once in the beginning. I want to load a series of images for a gallery in a preloader so that I can display them seemlessly at some later point in the movie (probably in a different scene).

I know how to load external images into movie clips and check the progress of the individual clips loading so I know how to do the preloading part, but my problem is being able to reference those clips later in the movie. Since actionscript created an instance of a movieclip on the stage to put the image in like:

this.createEmptyMovieClip('holder', 1);
holder.loadMovie("myimage.jpg");

Ok, great so now I have a movie clip called 'holder' on the stage, but say I move to a new scene. How do I get that back?

createEmptyMovieClip returns a MovieClip object. Maybe I could make an array of MovieClip objects so that the objects themselves and the image inside of them persist across scenes? But then how do I place these objects back onto a blank scene?

Preloading External Swf With Dynamic Images...
Hi i am hoping someone can help me with this problem. It is to do with preloading external swfs. I have some script which puts a preloader on external swfs that load into my main movie (which works). This is as follows...


Code:
bar._visible = false;
border._visible = false;
my_mc = new MovieClipLoader();
preload = new Object();
my_mc.addListener(preload);
preload.onLoadStart = function(targetMC) {
trace("started preloader loading "+targetMC);
loader_mc._visible = false;//an empty mc already on the main stage
bar._visible = true;
border._visible = true;
pText._visible = true;
};
preload.onLoadProgress = function(targetMC, lBytes, tBytes) {
bar._width = (lBytes/tBytes)*100;
pText.text = "Loading..."+Math.round((lBytes/tBytes)*100)+"%";
};
preload.onLoadComplete = function(targetMC) {
loader_mc._visible = true;
border._visible = false;
bar._visible = false;
pText._visible = false;
trace(targetMC+" finished preloading");
};
//default image
my_mc.loadClip("about.swf", loader_mc);
//buttons
currentStock_btn.onPress = function() {
my_mc.loadClip("scrollContent.swf",loader_mc);
};
This works but one of the swfs that is loaded in, has dynamically loaded jpegs in it. The preloader works but the loader_mc is unhidden before the dynamic jpegs have been loaded into the external swf. Ideally I would like it if I could get the preloader to keep running until the jpegs are fully loaded.

Any suggestions would be great

Preloading For Dynamic Text And Images
Hi people

My flash MC has a lot of elements which are dynamically loaded using the loadMovie command. The problem is that the preloader(which shows you a percentage increasing until the movie is ready to be played) doesn't seem to take these images into account and as a result loads pretty quickly. But the images are only load up later so they kinda pop up the way HTML pages do. Anyone know a way to address this?

Fanx

Syllogism

Preloading Dynamic Images With LoadBitmapSmoothed
Hi all.

I have been working on my online portfolio lately and ran into a problem which I initially thought I had solved.
I had been loading dynamic images from an XML file into an empty MC using the 'loadMovie' function. No problems. I even had them preloading nicely using a preloader and a bit of script.
However, I wanted to be able to rotate these images, and when I did, they lost their quality. I found this was actually an issue with Flash and that it does not by default smooth externally loaded images.
To solve this, I found the below workaround script online:

Code:
import flash.display.*;

function loadBitmapSmoothed(url:String, target:MovieClip) {
// Create a movie clip which will contain our
// unsmoothed bitmap
var bmc:MovieClip = target.createEmptyMovieClip(
"bmc",
target.getNextHighestDepth());

// Create a listener which will notify us when
// the bitmap loaded successfully
var listener:Object = new Object();

// Track the target
listener.tmc = target;

// If the bitmap loaded successfully we redraw the
// movie into a BitmapData object and then attach
// that BitmapData to the target movie clip with
// the smoothing flag turned on.
listener.onLoadInit = function(mc:MovieClip) {
mc._visible = false;

var bitmap:BitmapData = new BitmapData(
mc._width,
mc._height,
true);

this.tmc.attachBitmap(
bitmap,
this.tmc.getNextHighestDepth(),
"auto",
true);

bitmap.draw(mc);
};

// Do it, load the bitmap now
var loader:MovieClipLoader = new MovieClipLoader();
loader.addListener(listener);
loader.loadClip(url, bmc);
}
This code works well, when used in place of the 'loadMovie()' function. I can rotate my dynamically loaded images and they retain their quality/smoothness.
However, the issue I have run into now is that my preloader no longer works with this new code.
Here's the AS for my preloader, where 'imageLoader_mc' is my MC and
'preloader_mc' is my preloader:

Code:
this.onEnterFrame = function() {
filesize = Math.floor(imageLoader_mc.getBytesTotal());
loaded = Math.floor(imageLoader_mc.getBytesLoaded());
if (loaded != filesize) {
preloader_mc._alpha = 100;
preloader_mc._rotation += 10;
imageLoader_mc._alpha = 0;
} else {
preloader_mc._alpha = 0;
if (imageLoader_mc._alpha<=100) {
imageLoader_mc._alpha += 20;
}
}
};
I think the issue is that the 'getBytesTotal()' and 'getBytesLoaded()' functions do not work with the 'loadBitmapSmoothed()' function.
Problem is, I don't know how to edit the code to allow the preloader to work.
I was wondering if anyone may be able to help me out with this?
Thanks so much,

Enforcer73

Preloading Dynamic Images In A Projector File
Hi All ---

I am creating a projector file to be run on a CD. The projector file loads an external swf. This external swf loads about 50 jpegs dynamically (to be displayed in the scroll component) at run time - no images actually in the external swf prior to run time. When playing the projector file on my pc it runs smooth. However, when I burn it to CD and the external swf is loaded into the projector file there is about a 10 second delay because it is loading all the images at once.

I have tried to create a preloader for this external swf in the projector file without any luck. How else can I do this? I thought about loading the swf earlier in the projector file, but it only ends up displaying the swf earlier than I want it to be displayed!

Any help is greatly appreciated.

Thanks for any and all replies.

Cheers!

Preloading And Center Points For Dynamic Images
I've got a simple dynamic image gallery, using input text fields, a blank mc, and some code on buttons.. here's the code:

on( press )
{
_root.mcGallery.mcImage.loadMovie( txtImageURL.text);
}

the images are being stored in a directory named "pictures" ...

here's my problem - i have 3 different sized images. when they are loaded in, they load in at x and y 0,0. i need them to load in based on a center point.

in order to do that, i need to write some code that figures out when the image is loaded, then positions it. so i need a preloader - and some code to center the image. i'm not much of a coder - more of a hack. can anybody help me?

Error Preloading External Dynamic Images
I try to load into a movie an external dinamic image like dinimage.php?source=myimage.php&width=300;

When i try this, I can note that te getbytestotal, returns me negative values like (-1) while the picture is loading.

this causes that I can't make works preloaders movies for this external movies.

I have this problem locally and remotely

Any idea ??

Preloading Images?
I have a number of buttons that on mouse over an image is loaded.

On my machine it is like s#^t off a shovel but when its on the web you have to keep the mouse hovering for a good couple of seconds.

In Javascript you can preload images, can you do it in flash and how?

Preloading Images?
I have a Flash movie that comprises 13 images saved in .jpg files. What I want to do is create a preloader that preloads all these images, including the Flash movie. I was able to preload the movie, but not the images. What do I have to do in order to preload everything (including the images)?

Preloading Images
I have been trying to get an answer on this subject for some time now. People have posted things like links to other posts about this topic or msg me and I'll help ya out. I have tried to be patient and get some help on this subject.

I have searched and read and read and searched, nothing I saw helped me, most of it just scared me. I dont wanna have to be scripting a lot. Here is my problem i have a lot of thumbnails and a lot of pictures and i want to make preloaders for them cuz they are all externally linked. So what i would like to do is make a preloader that i can just somehow apply to all of them. I dont wanna have to make 60 different preloaders for my 60 images. If this is possible or of you have any suggestions besides links to other posts, I would be very appreciative. I am a n00b and I'm gonna need this explained in n00b terms. Thanks everyone for bearing with me.

Preloading Images
I've been searching online for tutorials and scripts and yes i found some ... but its confusing ... so if anyone is nice enough to tell me how to jus simply preload an image with a percentage. That would make my day...

thnx

Preloading Images/mc-s
hi, i would like to load several images at the same time in my movie, with preloaders to each one.

is there a way to do this without external swf-s? I'd like the whole process to go inside the movie clip, so the main timeframe would not be 'touched'.

i guess the loadmovie function should be used, but don't know how, and how the movie clips get the preloader for themselves.

you can see what i'd like to achieve if you visit http://www.heavytools.info/english.html

(Products menu.. each t-shirt has a preloader.)

thx for any help

Preloading Images
Hey
i can preload normal graphics and things in flash but my problem this time is different. I want to preload images before they are displayed on a html page. Is there anyway to have a flash loading screen and preload the images so they are all ready as soon as the html page loads? Is flash the best way to do this? are there any alternative methods or is it even possible?
Thanks for your help

Preloading JPG Images
How do you preload JPG images?

I have some thumbnails that are loaded externally. Is there anyway I can preload them so they just dont pop up randomly after they load individually when I call on them?

Also, how do you create a preloader for a JPG in general?
If I have the script container.loadMovie("bla.jpg"); or watever is there anyway to put a preloader so once again it just doesnt pop up when its done loading. Right now I am calling on some external JPG files and I have it scripted so they fade in. Only problem is they just pop up first time around, but after you load it once it fades fine. That is why I want to preload the images so hopefully the fading problem will be fixed.

Thanks to you who help.

Preloading Images
Ok I have read a bunch of the forums and got realy confused Im new to this action script thing but im trying.

So with that said I need to be able to preload images. I can load them fine but preloading (with a visual representaion eg progresion bar) is tuff. I have 12 images but may have more that need to load at the same time. Can you guys help ?

to see what I have got go here http://www.shmooze.ca/newnight/test2.htm

Is there a fla out there or a EASY to follow tutorial ?

Any help would be great.

Help Preloading Images
Hi. I'm very new to Flash. I'm designing a very large photography site with over two hundred images and corresponding thumbnails. That being said, you can probably guess why I might be running into problems as far as file sizes go.

Here's what I want to do:

When the user enters the site, I would like the entire movie to load. I would like to keep the photos, however, from loading until the user requests them by clicking on the corresponding thumbnail. Then, it will say, "loading, please wait" where the image will show up. After the image loads, probably a few seconds, it will appear.

I can't seem to find a tutorial that has exactly what I need. If anybody can direct me to one, that would be extremely helpful.

Also, if anyone has any better ideas on how I can solve this problem, it would be much appreciated.

Thanks for taking the time to read this, and thanks for any helpful advice that you may have!

[F8] Preloading Images From Xml
I am trying to make a flay program that will automaticly create gif like animation for you, you simply specify the list of consecutive pictures you like in an xml file and it loads them using loadMovie at a certain rate determined by a setInterval. This all works except i get a flash of a white screen between each picture because it is loading the image again. Is there any way i can preload all of these pics into the flash doc?

Preloading Images From XML
Hi All.

I been creating an XML SlideShow and works all ok. However, I wanted to preload the images before playing the slideshow to avoid jump offs (currently having). I found some scripts but only for AS2 - tried loading the AS2 and works ok (all preloaded) BUT, the XML should be a variable. I tried almost everything - flashVars (conflicts/do not work), swfBridge (no good), localConnections (no luck).

The only solution I wish for now is if its possible to do it in AS2 preloading images, I think somebody already had this solution before.

I a bit new to AS3 so I hope someone has already encountered this issue and found a good solution.

Kind regards
frg10

Preloading All XML Images
Hi all,

I have an xml photogallery. I am trying to find some help preloading all of the images before any of them appear. Does anyone have any idea how to do this?

Preloading Of Several Images.
I am working on a flash with actionscript 3.0 that connects with mysql database.
I have a php file that generates jpg images based on an ID, and want to preload these images into flash.

The url; pages/showImage.php?id=X , generates an image out of the id X.

The following code is what I've made working, but doesnt preload, but load the image and draws it sequencialy:

Code:
function drawCard( cardID:int, posX:int, posY:int ):void
{
var url:String = "pages/showCard.php?id=" + cardID;
var request:URLRequest = new URLRequest( url );

loader.load( request );
loader.contentLoaderInfo.addEventListener( Event.COMPLETE, drawIt );
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
}

function drawIt( evt:Event ):void
{
var myBitmap:BitmapData = new BitmapData( loader.width, loader.height, false );
var mySprite:Sprite = new Sprite();

myBitmap.draw( loader, new Matrix() );

var matrix:Matrix = new Matrix();
matrix.translate( 50, 50 );

mySprite.graphics.beginBitmapFill( myBitmap, matrix, true );
mySprite.graphics.drawRect(50, 50, loader.width, loader.height);
mySprite.graphics.endFill();

addChild(mySprite);
}

function ioErrorHandler( event:IOErrorEvent ):void
{
trace("Unable to load an image.");
}

var loader:Loader = new Loader();
drawCard( 3, 50, 50 );



And I've tried making the preloading work, and it worked a bit at one moment, but now it doesnt even show an image, and I dont know what I did to break it.
Though at the point where it worked, it only showed the last image loaded when trying to call drawCard. I am guessing this was probably because I didnt save the Loaders, which I tried fixing, but as a result nothing works anymore, and I'm not getting any image drawn;

Code:
var CARDS:Array = new Array();
var LOADERS:Array = new Array();

var i:int=1;
while( i < 7 )
{
var url:String = "pages/showCard.php?card_id=2";// + i;
var request:URLRequest = new URLRequest( url );

var loader:Loader = new Loader();
//LOADERS.push( loader );

loader.load( request );
loader.contentLoaderInfo.addEventListener( Event.COMPLETE, function( evt:Event ):void
{
//Store bitmaps
var bitmap:BitmapData = new BitmapData( loader.width, loader.height, false );
bitmap.draw( loader, new Matrix() );

CARDS.push( bitmap );
}
);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);

i++;
}

function ioErrorHandler( event:IOErrorEvent ):void
{
trace("Unable to load an image.");
}

function drawCard( cardID:int, posX:int, posY:int ):void
{
var myBitmap:BitmapData = CARDS[cardID];
var mySprite:Sprite = new Sprite();

var matrix:Matrix = new Matrix();
matrix.translate( posX, posY );

mySprite.graphics.beginBitmapFill( myBitmap, matrix, true );
mySprite.graphics.drawRect( posX, posY, myBitmap.width, myBitmap.height );
mySprite.graphics.endFill();

addChild( mySprite );
}

drawCard( 2, 50,50 );

Preloading Images
hi all,

how do i assign something to my onRelease to make sure the image is preloaded before it proceeds to call the loadMovieNum function? Thanks in advance!

Preloading Images
Hello all,

im trying to preload all images/swfs in the preloader before going to frame 3. there is a "gotoAndPlay(1)" on frame 2. below is the code in frame 1. and there is a MC called "preload" outside of the canvas.

how come its not working? thanks in advance!! its driving me nuts!


Code:
bytes_loaded = Math.round(this.getBytesLoaded());
bytes_total = Math.round(this.getBytesTotal());
getPercent = bytes_loaded/bytes_total;
this.loadBar._width = getPercent*620;
this.loadText = Math.round(getPercent*620)+"%";

preload.loadMovie("default.swf"); // my files to be preloaded

if (bytes_loaded == bytes_total) {
this.gotoAndPlay(3);
}

Preloading Images
Ok. i've got a web were some images are loaded randomly,
every 5 seconds a new image is loaded and goes from blur to clear image.

But I've got a problem. The first time someone opens my web, I can't see the progress when they are supposed to go from blur to clear instead of that they appear suddenly. I think it's because the first time they must be loaded.

Once a image has apperared the second time the image is choosed randomly I can see the progress

I'd like to preload the images.

is a good idea?

how can I do it.?

Preloading Images
Hi,

For my new games I want to have a preloader that shows a progress bar. I've been looking at a few preloaders. All require you to drag your images from the library onto the scene in frame 5 (or whatever frame) so that Flash knows that it should load the images. My question: Is there a way to tell Flash to load the images without putting them on the scene, such as calling a command that uses them?

Thanks

Preloading Images
hey all was wonderin if someone could gimme a hand.

I made an image gallery where you frag the thumbnail into the image viewing area where it then enlarges to fill the area and you drag a new one into the area and the old images thumbnail returns back to its spot and the new thumbnails larger version replaces the old one.

All of that is working fine, but i want to add a preloader for each of the images because sometimes when its online it seems it takes a second to load the larger image which can reduce usability for viewers, especially those with slower internet connections. Could someone suggest some code to preload each of the images, so when they are dragged in a progress bar will show while they are loading if it is going slow, so users do not think it is broken if it does not show up instantly?

Thanks

Preloading Images...Once And For All
Hi,

I seem to be having a lot of problems with preloading images. I want external jpgs to load offstage and then use them as I need them.
I have built a preloader, but it seems to not work.

Can someone point me to a tutorial about a) loading images or clips offstage for later use and b) a preloader

Another question: how does a preloader work when the empty movie clip that eventually will hold all of the external jpgs does not have an accurate bytes_total number?

Preloading All Images From Xml
Well, i've been at this for quite a while now.
I made a small photoalbum and i want all the images to be preloaded before the movie begins. I've been struggling with this for almost 2days.
The images load from an xml. How can I preload all the images and then start the movie?

Thanks a lot.

This is the code for the xml:








Attach Code

xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");

function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image[i] = xmlNode.childNodes[i].firstChild.firstChild;
}

holder_mc.loadMovie('img/'+image[0])
holder2_mc.loadMovie('img/'+image[1]);
holder3_mc.loadMovie('img/'+image[2]);
holder4_mc.loadMovie('img/'+image[3]);
}
}

Preloading Images
Hi,

I am making students photo id card for a School. Suppose in the given space I can display 4 students card in a proper format, of which they will take a print out and can use it.

Lets say there are total 50 students then there will be pagination (50/4=13 pages)
with next and back button for navigation. I am reading all the data from XML File.

Now my question is can it be possible for me load all the 50 images somewhere in backgorund (or MC) at the begining only so that while navigating pages images in that particular page (photo of a student) shouldnt take time to load.

I hope I have clarified my problem. Can someone give me some input on this.

It will be really appreciated. Thanks in advance ;-)

-----------
aShIsH

Preloading Images
Hi,

I just configured the handy Photo Gallery script (http://www.kirupa.com/developer/mx/photogallery.htm) from here, but I am wondering if I can add a "pre-load next picture" feature. Basically I want the next picture to be loading while the visitor is viewing the current image. Is that possible?

thanks!
John

Preloading Images
hi, i am working on a website where i want certain images to load whenever a user clicks on a thumbnail. I want a preloader to appear before the image is displayed. I created this so far:

mcLoader = new MovieClipLoader();
loadListener = new Object();
mcLoader.addListener(loadListener);
mcLoader.loadClip("foto.jpeg", placeholder_mc);
loadListener.onLoadProgress = function(placeholder_mc, loadedBytes, totalBytes) {
preloaded = Math.floor(loadedBytes/totalBytes*100);
loaderText_txt.text = preloaded+"%";
bar_mc._xscale = preloaded;
};
loadListener.onLoadComplete = function() {
loaderText_txt._visible = false;
bar_mc._visible = false;
};

This should work, right? When I preview this of course I see my image, but I want to know if the preloader works. So I hit ctrl+enter again and... nothing. The progress bar (bar_mc) blinks once and then blank... a white screen... Why is this??

Besides, I want this code to be executed when a user clicks a thumbnail, how can I implement this on a button, while at the same time, the first thumbnail should load automatically, so there's no exmpty page when the user first opens the website?

Can someone please help me out here? Thanks!!

Preloading XML Images
Hello all I need a little help preloading images from my xml file. I have dynamic text and dynamic images being loaded into movie clips on the stage

when I preload my xml file everything goes fine except my images hang for a while before they get loaded into there respected movieclips even when my preloader reaches 100% they are still hanging trying to load and eventually they will load.

I am able to preload my xml file by using my_xml.getBytesTotal() and my_xml.getBytesLoaded but I noticed that only includes what data is in the xml file "mainly text" and not the image paths to the actual image files. How would I go about preloading everything?

any help greatly appreaciated

Preloading Over 100 Images...
Hey all. So I have a question. I've got a flash page that essentially is a large image made up of 25 pieces of that image. There are a few images total. So essentially over 100 smaller images which make up a few larger images.

I don't want to have any delay in those images once the swf is loaded, so I want to preload those smaller images. To be utilized, they get loaded into their corresponding mc's on the stage. 25 mc's each with its own image (Well, several images). So I first tried just leaving copies of the images on teh stage but way off to the side thinking that they would just be loaded from the cache, but that's not appearing to be the case. The images slowly load up instead of appearing instantly as when tested locally.

This whole swf gets called from another swf if that makes a difference. I don't think I could handle typing in ALL those link identifiers... There are a few pages like this, so in essence, by the end it would be several hundred small images!

Currently they're all loaded using loadMovie and for() loops.

I also want to be careful since I'm loading this swf into another swf, the main preloader is in the parent swf, and I'd like to keep it there if possible, so I can't just create a preloader in the child swf... Although, if there's no other choice...

Anyone have any ideas?

Xml+ Preloading Images Help.
Basically I'm loading images from a xml file. For each image adds it into a movieclip and tries to attach a preloader.

The images load just fine, but when adding the preloader, it adds one to each movieclip, but only 1 of them actually show the preloader working.

Here is the code for that section below.


Any suggestions on what to try?


for(var i:uint = 0; i < myXml.children().length(); i++) {

var imageRequest:URLRequest = new URLRequest(myXml.image[i]);
var imageLoader:Loader = new Loader();
imageLoader.load(imageRequest);

addChild(this['photo'+i]);
this['photo'+i].containerClip_mc.addChild(imageLoader);
this['photo'+i].containerClip_mc.addChildAt(preloader_mc,1);

imageLoader.contentLoaderInfo.addEventListener(Pro gressEvent.PROGRESS, progressHandler);

function progressHandler(eventrogressEvent):void {

var loadProgress:Number = event.target.bytesLoaded / event.target.bytesTotal;
preloader_mc.barClip_mc.scaleX = loadProgress;
preloader_mc.loadTextField_txt.text = Math.round(loadProgress * 100) + "%";

}

Preloading Images
While it's possible to change which frame movieclips are exported in, I've yet to find a way to change what frame imported images are exported in -- it always seems to be the first frame, regardless of where the image appears in the timeline.

Anyone know how to fix this?

Preloading All Images Before Swf
I am creating a slide show with about 12 images.

The images will be external to the swf and info pulled in via xml.

Is there a way that I can get all the images to preloaded before the slide show starts. I don't really want to ahve a "Loading bar" between frames,

Thanks

Edward

Preloading Images
Hi,

I am making students photo id card for a School. Suppose in the given space I can display 4 students card in a proper format, of which they will take a print out and can use it.

Lets say there are total 50 students then there will be pagination (50/4=13 pages)
with next and back button for navigation. I am reading all the data from XML File.

Now my question is can it be possible for me load all the 50 images somewhere in backgorund (or MC) at the begining only so that while navigating pages images in that particular page (photo of a student) shouldnt take time to load.

I hope I have clarified my problem. Can someone give me some input on this.

It will be really appreciated. Thanks in advance ;-)

-----------
aShIsH

Preloading Images
Hi,

I just configured the handy Photo Gallery script (http://www.kirupa.com/developer/mx/photogallery.htm) from here, but I am wondering if I can add a "pre-load next picture" feature. Basically I want the next picture to be loading while the visitor is viewing the current image. Is that possible?

thanks!
John

Preloading Images
hi, i am working on a website where i want certain images to load whenever a user clicks on a thumbnail. I want a preloader to appear before the image is displayed. I created this so far:

mcLoader = new MovieClipLoader();
loadListener = new Object();
mcLoader.addListener(loadListener);
mcLoader.loadClip("foto.jpeg", placeholder_mc);
loadListener.onLoadProgress = function(placeholder_mc, loadedBytes, totalBytes) {
preloaded = Math.floor(loadedBytes/totalBytes*100);
loaderText_txt.text = preloaded+"%";
bar_mc._xscale = preloaded;
};
loadListener.onLoadComplete = function() {
loaderText_txt._visible = false;
bar_mc._visible = false;
};

This should work, right? When I preview this of course I see my image, but I want to know if the preloader works. So I hit ctrl+enter again and... nothing. The progress bar (bar_mc) blinks once and then blank... a white screen... Why is this??

Besides, I want this code to be executed when a user clicks a thumbnail, how can I implement this on a button, while at the same time, the first thumbnail should load automatically, so there's no exmpty page when the user first opens the website?

Can someone please help me out here? Thanks!!

Preloading Images With XML
I know this question has been answered a few times in this forum, but I can't seem to get it to work in my case, so I thought I'd post the code I've got... Here's the deal: I'm loading images through an XML file but want to preload the images. I have everything working except for the preloading which is needed in addressing two problems...

Problem #1: I first have to load five images from an xml file. These need a preloader. The code I'm using is as follows:


ActionScript Code:
//Show the first slide and intialize variables
function startSlideShow(success):Void {
    if (success == true) {
            rootNode = slides_xml.firstChild;
            firstSlideNode = rootNode.childNodes[(myImage-1)].firstChild;
            currentSlideNode = firstSlideNode;
       
        /*
        * Initially, load the images...
        */
 
        for(i=1;i<=5;i++){
            var theImageHolder:String = "targetClip" + i + "a";
            firstSlideNode = rootNode.childNodes[(i-1)].firstChild;
            imagePath = firstSlideNode.attributes.jpegURL;
            loadMovie(imagePath, theImageHolder);
            nextClip[i-1] = 1;
            slideNodeIndex[i-1] = 1;    //Set the intial value so that
                                        //the first image has already been loaded.
       
        } //end for
 
    } //end if
   
} //end function
 



Problem #2: After those have loaded, I'm using the same XML file to read in subsequent JPGs that will fade in over each of the five previously preloaded images. For this, I'm using setInterval to call a function that updates the slides. Example:


ActionScript Code:
function updateSlide(newSlideNode, whichImage):Void {
   
   
    clipNum = changeOrder[(whichChangeOrder-1)]; //Determine which clip to change
    whichClip = whichImage;
   
   
    var tempArrayRef:Number = clipNum - 1;
    var imageHolderA:MovieClip = this["targetClip" + whichClip + "a"]; //ex:targetClip1a
    var imageHolderB:MovieClip = this["targetClip" + whichClip + "b"]; //ex:targetClip1b
 
    imagePath = newSlideNode.attributes.jpegURL; //WHICH IMAGE TO LOAD
   
    if (nextClip[tempArrayRef] == 2) {
        loadMovie(imagePath, imageHolderA); // WHERE TO LOAD THE IMAGE
        fadeIn(imageHolderA); // FADE IN THAT MOVIE CLIP
        fadeOut(imageHolderB);
        nextClip[tempArrayRef] = 1;
    } else if (nextClip[tempArrayRef] == 1) {
        loadMovie(imagePath, imageHolderB); // WHERE TO LOAD THE IMAGE
        fadeIn(imageHolderB); // FADE IN THAT MOVIE CLIP
        fadeOut(imageHolderA);
        nextClip[tempArrayRef] = 2;
    }
 
}
 
function nextSlide():Void {
   
        myImage = changeOrder[(whichChangeOrder-1)];
        firstSlideNode = rootNode.childNodes[(myImage-1)].firstChild;
        arrayValue = slideNodeIndex[(myImage-1)];
        nextSlideNode = rootNode.childNodes[(myImage-1)].childNodes[arrayValue];
       
       
        if (nextSlideNode == null) {
            //break; //if you want it to stop
            slideNodeIndex[(myImage-1)] = 1;
            updateSlide(firstSlideNode, myImage);
            currentSlideNode = firstSlideNode;
        } else {
            slideNodeIndex[(myImage-1)]++;
            updateSlide(nextSlideNode, myImage);
            currentSlideNode = nextSlideNode;
        }
 
if (whichChangeOrder < 5) {
    whichChangeOrder++;
    } else  {
        whichChangeOrder = 1;
    }
 
};
 
// DEFINE HOW LONG YOU WANT EACH IMAGE TO LAST
//slideChangerID = setInterval(nextSlide, 1300);
 


Question for this: How do I implement preloading for this? Can I simply preload it at the very beginning? The problem with the xml is that it is structured like so:

<slide>
<section>
<slideNode jpegURL="img01a.jpg"></slideNode>
<slideNode jpegURL="img01b.jpg"></slideNode>
</section>
<section>
<slideNode jpegURL="img02a.jpg"></slideNode>
<slideNode jpegURL="img02b.jpg"></slideNode>
<slideNode jpegURL="img02c.jpg"></slideNode>
</section>
</slide>

etc....

So I can't do a simply read into an array and batch preload the images.


Any help with either of these problems would be great. Thanks in advance...

AS2 - Preloading All XML Images
Hello,

I have a dynamic xml photogallery. Everything is fine and working great until it is online. The gallery is set up so the thumbs act as buttons to load the large image. The current image slides up as the new image slides in from the bottom.

The problem is that the larger images are taking too long to load, so you don't see the sliding effect, only a blank spot until the image loads, then it suddenly pops up.

I obviously need to preload them, but I have never done this with XML. Anyone know how to do this?

I'd appreciate any tips!!

Copyright © 2005-08 www.BigResource.com, All rights reserved