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




Need To Preload Image Directory



I want to be able to have the preloader check the folder contents before loading, not just image by image. I was hoping that someone could help by editing my source file :)Source files download ZIP



Adobe > ActionScript 1 and 2
Posted on: 05/14/2007 10:04:35 AM


View Complete Forum Thread with Replies

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

Image Directory Help
Ok, what am I doing wrong??

could someone take a look at this code?

numberOfImages = 4;
// total number of images required
num = 0;
imgDelay = 3;
// no of seconds to wait
alphaSpeed = 4;
// speed that images fade in
var waitCount = 0;
imageDirectory = TransitionPics; // right here, when I test my movie, it tells me there is an error opening the file and I am going nuts trying to figure out how to load my folder properly... how do I do it?? help please!! I am about to pull my hair out.... "TransitionPics" is the name of my folder where my pics are stored and I can't seem to have the path right, any easy way to fix that? or where should I put the folder at?
this.createEmptyMovieClip("imgHolder", 1);
// creates a blank mc
imgHolder._x = 0;
// change the x position to where you want on the stage
imgHolder._y = 0;
// ditto the y position
function loadImage() {
num++;
if (num>numberOfImages) {
num = 1;
}
imgHolder._alpha = 0;
imgHolder.loadMovie(imageDirectory+num+".jpg");
checkInt = setInterval(checkImgLoaded, 500);
}
function checkImgLoaded() {
imgBytesLoaded = imgHolder.getBytesLoaded();
imgTotalBytes = imgHolder.getBytesTotal();
if (imgBytesLoaded == imgTotalBytes) {
clearInterval(checkInt);
fadeInt = setInterval(fadeIn, 100);
}
}
function fadeIn() {
imgHolder._alpha += alphaSpeed;
if (imgHolder._alpha>99) {
imgHolder._alpha = 100;
clearInterval(fadeInt);
waitCount = 0;
waitInt = setInterval(imgWait, 1000);
}
}
function imgWait() {
waitCount++;
if (waitCount == imgDelay) {
clearInterval(waitInt);
fadeInt = setInterval(fadeOut, 100);
}
}
function fadeOut() {
imgHolder._alpha -= alphaSpeed;
if (imgHolder._alpha<=alphaSpeed) {
clearInterval(fadeInt);
loadImage();
}
}
loadImage();
stop();

Random Image From Directory...
Hi, how could i go about making a movie pic and display a random image from a directory? the images would be named like:
1.jpg(or if png works better)
2.jpg
3.jpg
blah blah etc etc

I have seen it before but havent found any tuts or templates for such a thing. thank you.

-mud

Download Image Directory?
Hey All,

Is there anyway to script a flash piece to load all images from a directory at the same root? Has anyone ever used loadmovie maybe on duplicate off the stage to begin loading/preloading images for slide like presentation?

Any ideas/work arounds/techniques here would be great.

cheers
-jub-

Browse Image From Directory
Hi everybody,

I guess this question has been asked before but I couldn't find a thread in this forum, which helped me with my problem.
Here my question: I wanna get an image out of a folder on my phone, which I took early with the camera and load it into the stand alone application, which is running at the moment. Is it possible to search with flash through the
the folders of my mobile and load the image in the flash application.

Thanks for the help. I hope I explained it well enough to understand.

Cheerio
Skyflyer

Image Fading In And Out From External Directory
Hi everyone, and thank you for reading my tread.

I am trying to create a canvas which will display 5 images ( one in each corner and one in the middle) now the trick is that the loader should be able to load any jpgs uploaded into that directory and display them in a random order in one of the 5 spots, and also the images should fade in and out.

Any help is greatly appricated..

Image Fading In And Out From External Directory
Hi everyone, and thank you for reading my tread.

I am trying to create a canvas which will display 5 images ( one in each corner and one in the middle) now the trick is that the loader should be able to load any jpgs uploaded into that directory and display them in a random order in one of the 5 spots, and also the images should fade in and out.

Any help is greatly appricated..

Using Outside Variable To Get Image From Unprotected Directory
hello guys,

have a new question for ya. I have a variable that i finally got from my php.
so i need some help. I have a movie clip in my fla called prods. I need to be able to get the variable which is placed in a text box called item_id and use it along with a URL to get an image.

example.

item_id = 12345
baseUrl = 'http://www.mysite.com/images/' + item_id.text + '.jpg';

this was my attempt at getting it to show up

Code:
prods.addEventListener(Event.INIT, _changeImg);
function _changeImg(evt:Event):void{
var idStr:String = item_id.text;
var BaseUrl = 'http://www.mysite.com/images/' + item_id.text + '.jpg' ;
if(item_id.text != null){
prods.addChild(BaseUrl);
}
}
this is where i am confused... would i have to put an event listener on the movie clip where i want the image to be placed? or would i put it on the text box which gets this variable? further more what kind of Event Listener would i need to accomplish this?

any code snippets would be greatly appreciated as i am totally confused on this...

XML Gallery: Preload On Current Image/cross-fade Image
Hello,
I am new to action script but I am learning quickly.

I took the following tutorials and made a hybrid:
Photo Gallery Using XML and Flash
Photo Slideshow Using XML and Flash


I redesigned the interface and created this:
http://www.onarresdesign.com/greg/work2.html

Everything works great, but now I want to take it further than the tutorial.
I am trying to make the images cross-fade. I am open to any suggestions and I have tried many techniques with little success.

Here is the closest solution steps I have come up with:

Code:
1) First image preloads (grey background showing)
2) First image loaded into top level MC 1
3) First image fades in
4) First image in top level MC 1 remains visible
5) First image gets loaded into bottom level MC 2 behind current movie clip.
6) Top level MC 1 clears because its preloading next image
Bottom level MC 2 remains visible
7) Preloader shows on top of bottom level MC 2
8) Next image is loaded into top level MC 1
9) Next image fades in (cross-fade effect achieved because previous image is behind it)
10) Next image gets loaded into bottom level MC 2
Repeat process
I can't get the action script to do what I want. I have off set the moveclips to show that the images are loading into both movieclips. I currently have the 'nextImage()' function controlling this so it is understandable the both images are cleared because the function is loading new images into the movie clips at the same time. How do I get one movie clip to remain constant while the other is loading? It seems to be a matter of where the function is placed. Or so I think.

I would appreciate any help I can get on this. If would also appreciate any suggestions for making the code for the control buttons cleaner.

Thank you,
</asla>

Saving Image From Internet To Specific Comp. Directory
Like the title states: Does actionscript have the ability to download a JPG to a specific directory on my computer? This project is for a game where I use fs command to lauch the game in the first clip then in the second I want an image downloaded to a specific file so the game can reference it. Thanks for anyhelp.

Remote Shared Object Directory Under Application Directory.
I need to have my FMS 2 server application code (.asc files) and shared object folders on separate drives, is this possible?

My situation is this.
I have a secure drive where all of my application code needs to reside. This drive stores all static data and applications and is restored from a golden image upon startup.

Any dynamic data, such as shared objects, must be stored on a separate data drive.

Can FMS2 be configured to store the shared object directories and files in a location other than under the application directory?

Thanks for any help,

-Randy

Help Me About Image Preload
I make a flash movie that loads external JPG's. And I put some preload, and it works.. but does not preload the external JPG's.. could somebody give me a script that preloads the entire movie as well as the external JPG's?

Can't Preload Image
Hello,
Right now I'm tryin to preload an image in a scene with a place holder movieclip. I can't get it to preload for the life of me. Does anyone know what I'm doing wrong? anytime I test it, it doesnt work. I have searched the forum and tried all the different examples but can't get it to work. Any help in the matter would be greatly appreciated.

It always skips the preloader, and then is blank until the image actually finishes loading.

frame 1


Code:
placeholder.loadMovie("ext/images/entrees.jpg");

bytes_loaded = Math.round(placeholder.getBytesLoaded());
bytes_total = Math.round(placeholder.getBytesTotal());
getPercent = bytes_loaded/bytes_total;
loadPercent = Math.round(getPercent*100);
loadPercent = loadPercent + "%";


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

frame 2

gotoAndPlay(1);
edit: when I try and test the variable "bytes_total" I do not get any bytes for it, I'm assuming it's how I am referencing the file.

Preload Xml Image
Hi,

In order to decrease the delay between pictures in my xml slideshow, I would like to preload the next image in the background so that when the use clicks the next button there is now delay. I am not sure exactly how to go about doing this. Here is my flash action script so far:


you could see the slide show at http://jasonkb.com/book-6.html and click on portrait flash

Thanks,
Jason







Attach Code

var x:XML = new XML();
x.ignoreWhite = true;

var urls:Array = new Array();
var captions:Array = new Array();
var whoIsOn:Number;

x.onLoad = function(success) {
var photos:Array = this.firstChild.childNodes;
for(i=0;i<photos.length;i++) {
urls.push(photos[i].attributes.url);
captions.push(photos[i].attributes.caption);
}
holder.loadMovie(urls[0]);
caption.text = captions[0];
whoIsOn = 0;
}

x.load("portrait.xml");

previous.onRelease = function() {
if(whoIsOn > 0) {
whoIsOn--;
holder.loadMovie(urls[whoIsOn]);
caption.text = captions[whoIsOn];
}
}

next.onRelease = function() {
if(whoIsOn < urls.length-1) {
whoIsOn++;
holder.loadMovie(urls[whoIsOn]);
caption.text = captions[whoIsOn];
}
}

Preload Image, Use It Later
Hi all,

I'm new to these forums, but I registered because I didn't find any answers on other forums that I visit more often.

Let me explain what my problem is first:

I'm creating a full screen flash website and everything works fine so far, I have a preloader on the first frame which does the trick and all the assets are resized and put in to place on the second frame.

The only thing I bother with, is the size of the background image. It's about 3,9 Mb on my computer and right now it's embedded into the movie. What I would like to do is remove it from the movie and put it in another directory 'images' and then preload it from there.

I thought maybe I could use the first frame to preload the movie, when done move to the second, and preload the image there and when done, move the the third frame.

The only problem I've had with the preloading thingy is that the image is placed on the frame it is loaded, and not on the third frame.

Is it possible to store it somewhere, so I can call for it when the movie is on the third frame?

If I'm taking the wrong steps to do this preloading thing, then please correct me, I'm new to AS 3.0 and I'm experimenting a lot right now.

Thanks

Preload An Image?
go to http://www.condiffphotography.com in the weddings section and in the 'nelson/bricker' section. that is what im working with. after i click a thumbnail and before the picture comes up i want a preloader to load the picture. and if possible i want a preloader to load all 10 thumbnail images at once so they all can appear at once right after i enter the gallery. but i have THIS preloader that ive made and i would like to use it if possible.

thanks alot!
austin

Why Won't This Code Preload An Image?
i've got a image loading fucntion that's called by a button and then scales the mc. The image loads fine, but i want the image to be fully loaded before the mc scales up. So here is my code, but the preload doesn't seem to work (i don't need any text to show what the preloader is doing, i just need the image loaded first before proceeding with the function):


Code:
function pressHolder(picName) {
this.createEmptyMovieClip("picHolder", 1);
this.picHolder.loadMovie(picName);
this.picHolder._xscale = 1;
this.picHolder._yscale = 1;
this.picHolder._x = 8;
this.picHolder._y = -145.5;
trace("is running");
this.createEmptyMovieClip("loader", 3);
this.loader.onEnterFrame = function() {
var kLoaded = Math.round(this.picHolder.getBytesLoaded()/1024);
var kTotal = Math.round(this.picHolder.getBytesTotal()/1024);
if (kLoaded == kTotal) {
this._parent.picHolder.scaleTo(101, .5);
this.removeMovieClip();
trace("is not running");
}
};
}
anybody know what i'm doing wrong?

XML Image Slideshow Preload?
Hey All,

I have built an image slide show [insert lame joke here] very similar to that found at.....

http://www.slideshowpro.net/

How do you all figure this application loads the images?

I have 90+ images fed by an xml reference but on the first load they all take sometime. I have one movieclip holder the images are loaded into. Is this the approach?

I could also see duplicating this clip into levels that would reside under each other so the next image could load while the first is displayed.

Any thoughts here?

As always any help here would be fanfriggintastic!
cheers
-jub-

Image Preload Issue
I've built a flash site for a video company. Due to the design and fact they want high quality videos on the site, the final file is a monstrous 9 megs! I've built a preloader into the site which seems to work fine, except for one issue.

I built a 3D navigation into the site which was imported from Swift 3D as a series of numbered picts. I would assume that the preloader would, well, "preload" the images so once the site is loaded, it would play smoothly, however, this is not the case. The first time the picts run, they are very choppy, but then every subsequent time it's run, it plays smooth and great.

So, here's the obvious question... How can I make it so that the picts run smoothly the FIRST time?

Thanks in advance!

Preload Swf AND Image At The Same Time
Hi all,

I'm making my first fullscreen flash website and as I'm getting used to CS3 I thought I'd finally give AS 3 a try and I just refuse to give up on it so here's my question to you all in full:

I'm trying to make a preloader which loads my .swf (duh), but also an external picture, which is pretty big in size and which has to be used on the second frame as a background image.

I've got it all working right now, with the picture embedded, but it makes my .swf pretty big and it's a real pain to upload that whole thing every now and then to see how it all looks in fullscreen.

When the image is preloaded, how can I acces it and does that require any external .as files? If so, which code do they have to have on them?

I hope someone has the time to write everything out, or maybe more than one person. Not every line of code has to be explained, I can alwxays look it up, but it would certainly be appreciated

Florian

Preload Image Sequence ..
Hi there guys ..
Now, this may be a stupid question, but what I am after is a image sequence preload routine ..
I have 10 images equalling approx 200k(swf), each image is about 20k ..
So what I need is for the first image to load and show and while that is happening I need the other images loading in the background ..

Im gonna have a search around, but I thought it'd be sensible to post here first ..

I am sure that I have done this in the past although I havent used flash for quite a while and am just getting back to grips with the thing .. I think from memory I loaded each frame at a time ..

Am I making any sense ..?

Cheers
L

Preload Dynamic Image
I have an image that is loaded dynamically when a button is pushed.

How do I add a preloader to this. So that the user isn't waiting and just sees the image all of a sudden when loaded.


ActionScript Code:
button_mc.onRelease = function() {
    mc_clip.loadMovie("myimage.jpg");
}

Preload Image OnLoad
Hey everyone,

I have asked this over at .kirupaforum.com but nothing. I have modified hga77's gallery and made some changes with the style. I am still having some problems and need three things sorted out. Well, two aren't essential but the first one is.

1. Most importantly, On Load I need the first image in the XML file to load in and have a border.
2. Get the percentage preloader working.
3. Load in the thumbnails left to right http://www.poetandcompany.com/frameset.html .

Please help me out.

Cheers,
Brian

Image Preload Issue
I've built a flash site for a video company. Due to the design and fact they want high quality videos on the site, the final file is a monstrous 9 megs! I've built a preloader into the site which seems to work fine, except for one issue.

I built a 3D navigation into the site which was imported from Swift 3D as a series of numbered picts. I would assume that the preloader would, well, "preload" the images so once the site is loaded, it would play smoothly, however, this is not the case. The first time the picts run, they are very choppy, but then every subsequent time it's run, it plays smooth and great.

So, here's the obvious question... How can I make it so that the picts run smoothly the FIRST time?

Thanks in advance!

Preload An Image Thats Called With XML
is there a simple way to do this ...

all my research on "xml preloaders"
always refers to preloading the xml --- obviously
but not the content the xml is calling...

im dealing with some high qualityu photos - and need something to kill the white space while they load.

any help is greatly appreciated.

best,
anton

Preload Image Within Class
Hello

This is my first post here and I already have a problem.

I have a class called Gallery and within this class I want to generate thumbnails.
I want to load the thumbnails with only one line of code to make it easy:

PHP Code:



this._mclContent.loadClip("mypicture.jpeg", "this.thumbs.myMC"); 





PHP Code:



var _mclContent:MovieClipLoader;
var _oListener:Object;

function Gallery() {
      this._mclContent = new MovieClipLoader(); 
      this._oListener = new Object();
         this._oListener.onLoadStart = function(target_mc){
                trace(target_mc+"loading has started!");
        };
        
        this._oListener.onLoadProgress = function(target_mc, loadedBytes, totalBytes) {
        };
        
        this._oListener.onLoadInit = function(target_mc){
                trace(target_mc+" has finished loading");
        };
        
       this._oListener.onLoadComplete = function(target_mc){
                
        };
        
        this._oListener.onLoadError = function(target_mc, errorCode){
                trace(target_mc+" did not properly load: "+errorCode);
        };
        
        this._mclContent.addListener(this._oListener);
        this.createThumbnailObjects();
}

function createThumbnailObjects(){
       trace("start");
       this._mclContent.loadClip("mypicture.jpeg", "this.thumbs.myMC"); 





The problem is, that the code only traces "start" and not loads the clip.

Preload Next Image Problem
hi,

I am having trouble with adding some functionality to senoculars preloadnextimage.fla

The file basically loads a gallery image then preloads the next image to be displayed,after a preset delay(2 seconds in this case) the main image is replaced by the preloaded image.

my problem is that if the next image is not completely preloaded when the delay is up the functions starts again and try to preload the same file again....
(the small images used load very quickly so I use the bandwidth profiler on 56k to simulate my problem)

I could fix this by simply making the delay time longer but this is no good for how I plan to use this.

Hope I explained this correctly

Anyway here is the fla, hope its not too confusing - my actionscript skills are limited

hope someone can help
thanks,

Preload All Thumbs And First Image XML HELP
i can't find anything on how to preload all the thumbnails and the first picture from an XML.

i searched the forums and other sites for hours and nothing came up.

i figure it would be something like this
place all thumbnails into a holder(thumbnail_mc) and getBytesTotal() and getBytesLoaded()
then getBytesTotal() and getBytesLoaded() of the first picture which is in it's own holder(image_mc)
add the getBytesTotal() together
add the getBytesLoaded() together
then create preloader from these

hope this doesn't sound confusing

Gallery With Preload Iin Every Image
Hello,
I am populating a gallery with photos whose path is defined in a xml file.
Then I would like to show a preload bar for every loading photo. The code I'm using doesn't show the bars simultaneously (sometimes I'm  not even sure that the bar is shown),  how can I do?

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

            icona[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
            image[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;

        }
        displayIcon();
        //firstImage();
    } else {
        content = "file not loaded!";
    }
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");
function displayIcon() {for (index=0; index<total; index++) {
        attachMovie("image","picture"+index,index,{_x:index*(160), _y:53});
        _root["picture"+index].createEmptyMovieClip("dentro",0);
        _root["picture"+index].dentro.loadMovie(icona[index],1);
        _root["picture"+index].immagine = image[index];
        _root["picture"+index].onPress = function() {
            _level0.foto = this.immagine;
            loadMovieNum("screen.swf", 4);
        };



    }*/
}

inside the image movieclip I write:

this.onEnterFrame = function() {
    filesize = dentro.getBytesTotal();
    loaded = dentro.getBytesLoaded();

    preloader._visible = true;
    if (loaded != filesize) {
        preloader.preload_bar._xscale = 100*loaded/filesize;
    } else {
        preloader._visible = false;
        if (this._alpha<100) {
        this._alpha += 10;
        }
    }
};


How Do You Preload An Image From An Xml File ?
I have made a site navigation system in an xml file, and got that working perfect. Now, I want to load a different background image every time I select a different menu item.

How would I set this up. I need to get the logical part straight before I can start coding it. I would need a preloader for that, I guess just attachMovie from the library would work. I will appreciate any guidance. Thank you!!!

Preload Image : Flash Doesn't See It?
Hello all. I've not had this problem before when preloading - it appears that even after doing my standard preloading, Flash doesn "see" the MC that I load the image into.

After loading, I need to re-position and resize the holding MC, but it just doesn't seem to happen:
fulmar site
(Click through to "A Private Life of a Masterpeice")


Any Ideas?

chopsticks

Preload Thumbs - Then Main Image
i've spent 2 days squinting at every preloader example on this site and haven't really found what i'm looking for.

i'm not sure i really understand the relationship between the timeline , the preloader actionscript and the actionscript in the main movie.

i've got a photogallery (gasp!! shock!!) that i'm populating with external .jpgs from an XML file (gasp again! how rare!)

i simply want a preload bar to visible as the thumbnails load. then, once loaded - a preload bar should appear when i click on the thumbnail that loads the main image.

my .fla file is currently only 1 frame so if the solution is multi frame - please let me know what i should put where etc.. i'm a pretty quick study i'm just having trouble relating all these preloaders to my project.

here's my code so far:


PHP Code:




myPhoto = new XML();
myPhoto.ignoreWhite = true;
myPhoto.load("tot_lot.xml");
myPhoto.onLoad = function(success) {
    this.firstChild;
    numimages = this.firstChild.childNodes.length;
    spacing = 100;
    _global.thumbs_width = numimages * spacing;
    for (i=0; i<numimages; i++) {
            picHolder = this.firstChild.childNodes[i];
            thumbHolder = thumbnails.createEmptyMovieClip("thumbnail"+i, i);
            thumbHolder._x = i*spacing;
            thumbLoader = thumbholder.createEmptyMovieClip("thumbnail_image"+i, 0);
        setProperty(thumbHolder,_alpha, 70);
        thumbLoader.loadMovie(picHolder.attributes.thmb);
        thumbHolder.title = picHolder.attributes.title;
        thumbHolder.main = picHolder.attributes.main;
            //setting rollover state for thumbs
        thumbHolder.onRollover = function() {
            this._alpha=100;
            };
        thumbHolder.onRollOut = function() {
            this._alpha=70;
            };
        //end rollover
                //set click on thumb action
        thumbHolder.onRelease = function() {
            loader.loadMovie(this.main);
            title_txt.text = this.title;
            };
    }
};







there maybe some extraneous code in there that doesn't actually do antything from my previous attempts at various things. i'll clean it up later!

i've also got some code that handles the scrolling navigation of the thumbnail bar but i left that out because it's not really relevant to the current situation.

i would be most grateful if someone could take the time to walk me through the basic steps (and most importantly - concepts!) to getting these 2 preloaders integrated into this project.

thank you thank you thank you.

dijon

[F8] - Horizontal XML Image Scroller Preload
Hi all,
I've created an XML-driven thumbnail scroller, which works by creating a movieclip for each image in the XML file and loading images into them etc, using examples from many forum searches.

The movement is fine and XML is all working correctly. However, I have a problem with loading of the dynamic images into the movieclips.

The first image movieclip appears white (blank) on most occasions, and all others appear fine. I was wondering if anyone had any preload suggestions for this, as i do really need to display the first image each time (and not have it blank), or if i've made a cockup somewhere that is causing this issue?

>> Actionscript


PHP Code:




var img_xml = new XML()
img_xml.ignoreWhite = true;
img_xml.load("xmlphoto.xml");

var pics_array = new Array();

img_xml.onLoad = function()
{
numimages = this.firstChild.childNodes.length;

for (i=0; i<numimages; i++) {
    pics_array[i] = img_xml.firstChild.childNodes[i].attributes.thmb;
    trace(pics_array[i]);
}

var nGap = -1;
var nWidth = 222;
var nSpeed = 1;


for (var i = 0; i < pics_array.length; i++) {
    
    // create empty clip to house the pic
    var pic_mc = thumbnails.createEmptyMovieClip("mcPic" + i, i);
    
    // reference to the previous clip (if it exists)
    var prev_mc = thumbnails["mcPic" + (i - 1)];
    
    // draw the square and position it
    with (pic_mc) {
        loadMovie(pics_array[i], pic_mc);
        beginFill(0xFF0000, 0);
        lineTo(nWidth, 0);
        lineTo(0, nWidth);
        lineTo(0, 0);

        // position the current square with relative
        // to the previous square position and width
        _x = prev_mc._x + prev_mc._width + nGap;
    }
    
    // overwrite the name of the image in the pics_array with
    // the path to the movie clip that will contain the image
    // This will make it easy for us to reference all the movie
    // clips that are created
    pics_array[i] = pic_mc;
    
    // set boundaries
    var xMin = 0;
    var xMax = pic_mc._x + nGap;
    
}
// function that moves the squares
function fnMove() {
    
    // for loop runs through all the images clips we set in the pics_array
    for (var i = 0; i < pics_array.length; i++) {
        
        // set up reference to each image
        var my_mc = pics_array[i];
        
        // if image goes past our boundary
        if (my_mc._x + my_mc._width < 0) {
            
            // set position to xMax
            my_mc._x = xMax;
            
        }
        // decrement position by nSpeed
        my_mc._x -= nSpeed;
        
    }
    
}

// initialize the movement
thumbnails.onEnterFrame = fnMove;
}







>> XML: Google images is a wonderful thing for finding a random test image


PHP Code:




<gallery>
<image title="example" thmb="thumbnails/megazord.jpg"/>
<image title="example" thmb="thumbnails/megazord.jpg"/>
<image title="example" thmb="thumbnails/megazord.jpg"/>
<image title="example" thmb="thumbnails/megazord.jpg"/>
<image title="example" thmb="thumbnails/megazord.jpg"/>
<image title="example" thmb="thumbnails/megazord.jpg"/>
<image title="example" thmb="thumbnails/megazord.jpg"/>
<image title="example" thmb="thumbnails/megazord.jpg"/>
<image title="example" thmb="thumbnails/megazord.jpg"/>
<image title="example" thmb="thumbnails/megazord.jpg"/>
</gallery>







Example: http://andyram2k.com/photoslider/sccmscrollerlatest.swf

Zip with files etc is also attached. Many thanks in advance!

Help With Senocular's Preload Next Image Gallery
This is from senoculars website (thanks a bunch for the great turtorials and help!) From my somewhat limited understanding of the AS, the next image is preloaded and waits until the button is clicked, and then swaps depths with the first image... I am trying to use this gallery, but have the image on top (one) fade out, so it would reveal the image below. But would it be easier to keep the swap the same, but alpha fade the second image from 0 to 100? I tried (and will keep trying this) but if someone could give me a hand, it would be great! Thanks.



Code:
// baseurl to use to locate images based on SWF url not HTML url
var baseurl = _url.substr(0,_url.lastIndexOf("/")+1);

// create and position empty clips for images
// one for visible image, one which will be
// used for preloading the next image
this.createEmptyMovieClip("one",2); // on top
this.createEmptyMovieClip("two",1);
one._x = two._x = 0;
one._y = two._y = 0;

// clips represents the clips with images
clips = [
one,
two
];

timeline = this; // allows reference to timeline from other clips
// images is an array of the names of the images being used
// this is for file referencing as well as status display
images = [
"lodge",
"ballet",
"chess",
"spinners",
"tennis",
"tribe"
];
// GetFileFor returns the file path for an image
// given its name
function GetFileFor(name){
return baseurl+"preloadnextimage/"+name+".jpg";
}

// Preload checks to see if a clip has been loaded
function Preload(clip){
var lod = clip.getBytesLoaded();
var tot = clip.getBytesTotal();
if (lod && tot){
var percent_loaded = lod/tot;
progress_mc._xscale = 100* percent_loaded;
if (lod == tot){
status_txt.text = "Preloading complete for "+images[0];
return true; // is complete
}
}
return false; // is not complete
}

// PreloadNext is used as an onEnterFrame event
// to check the loading of the current image and
// reorders the arrays so that the first element
// now represents the next image/clip
function PreloadNext(){
var is_complete = Preload(clips[0]);
if (is_complete){
clips.push(clips.shift()); // shift order of arrays
images.push(images.shift());
delete this.onEnterFrame;
}
}
// FirstLoad is like PreloadNext but loads the first image
// adding in a status message otherwise handled by the next button
// and starting the second image to load when complete.
function FirstLoad(){
var is_complete = Preload(clips[0]);
if (is_complete){
clips.push(clips.shift());
images.push(images.shift());
clips[0].loadMovie(GetFileFor(images[0]));
status_txt.text = "Preloading "+images[0];
this.onEnterFrame = PreloadNext;
}
}

// next_btn.onPress shows the next image if preloaded and starts
// preloading the next one using PreloadNext as an onEnterFrame event
next_btn.onRelease = function(){
if (this.onEnterFrame){
status_txt.text = "Please wait for "+images[0]+" to complete";
return false;
}
clips[0].swapDepths(clips[1]); // move preloaded image to top
clips[0].loadMovie(GetFileFor(images[0]));
status_txt.text = "Preloading "+images[0];
timeline.onEnterFrame = PreloadNext;
}
// initiate loading of first image
clips[0].loadMovie(GetFileFor(images[0]));
status_txt.text = "Preloading "+images[0];
this.onEnterFrame = FirstLoad;

Preload Won't Work When Image Is Inserted
Hi,

I've made this preloader, but as soon as i put the image in a new layer in the first frame and test the flash file, it refuse to display the preload sequence. When i tried to put the image in frame 2 it would display 4 percent loading, but it stops there. It stills loads flash file though... Why does this happen?!

Preload External Image To Library?
Is there any way to preload external image to library or any place other then current stage? Because I want to preload it first and then display it on some other stage. Does this makes sense?

Flash Loads Image Again After Preload
I'm making a flv movie with dynamically loaded cuepoints (from xml).

On every cuepoint there should fade in an image (jpg) . The path to this image is sent with the cuepoints

To be sure an image is loaded before the cuepoint is passed, i've created a preloader that preloads 4 image from the xml before even starting the video.

After the video is started the preloader preloads the remaining images in the background.

All works well expect for 1 thing:

Flash does not seem to cache my preloaded images. In the bandwidthprofiler i can see that when a cuepoint passes, flash loads the preloaded images again.

My question is : why does flash reload the image while it is already preloaded ?

Thanks in advance!

myscript for preloading (works)


Code:
this.createEmptyMovieClip("plcontainer", "900");
plcontainer._visible = false;

plPic = String(myCuePic_arr.shift()); // example: "media/pictures/pic3.jpg"
plMovie = "preload_"+plCount;
myDepth = plcontainer.getNextHighestDepth();
plcontainer.createEmptyMovieClip(plMovie, myDepth);
my_mc.loadClip(plPic, ("plcontainer."+plMovie));
my_mc.loadMovie(plPic, ("plcontainer."+plMovie));
myScript for putting the image in place (works but loads the preloaded image again)


Code:
// get the path from the cuepoint info
var picPath = String(eventObject.info.cuePath); // example: "media/pictures/pic3.jpg"
loadMovie(picPath, "container");

Senocular Preload Image Tutorial
Hi

I just tried to add a previous image button in this tutorial. But that attempt failed.

This is the url

http://www.senocular.com/flash/source.php?id=0.132


This is the code


Code:
// baseurl to use to locate images based on SWF url not HTML url
var baseurl = _url.substr(0,_url.lastIndexOf("/")+1);
// create and position empty clips for images
// one for visible image, one which will be
// used for preloading the next image
this.createEmptyMovieClip("one",2); // on top
this.createEmptyMovieClip("two",1);
one._x = two._x = 20;
one._y = two._y = 20;
// clips represents the clips with images
clips = [
one,
two
];
timeline = this; // allows reference to timeline from other clips
// images is an array of the names of the images being used
// this is for file referencing as well as status display
images = [
"lodge",
"ballet",
"chess",
"spinners",
"tennis",
"tribe"
];
// GetFileFor returns the file path for an image
// given its name
function GetFileFor(name){
return baseurl+"preloadnextimage/"+name+".jpg";
}
// Preload checks to see if a clip has been loaded
function Preload(clip){
var lod = clip.getBytesLoaded();
var tot = clip.getBytesTotal();
if (lod && tot){
var percent_loaded = lod/tot;
progress_mc._xscale = 100* percent_loaded;
if (lod == tot){
status_txt.text = "Preloading complete for "+images[0];
return true; // is complete
}
}
return false; // is not complete
}
// PreloadNext is used as an onEnterFrame event
// to check the loading of the current image and
// reorders the arrays so that the first element
// now represents the next image/clip
function PreloadNext(){
var is_complete = Preload(clips[0]);
if (is_complete){
clips.push(clips.shift()); // shift order of arrays
images.push(images.shift());
delete this.onEnterFrame;
}
}
// FirstLoad is like PreloadNext but loads the first image
// adding in a status message otherwise handled by the next button
// and starting the second image to load when complete.
function FirstLoad(){
var is_complete = Preload(clips[0]);
if (is_complete){
clips.push(clips.shift());
images.push(images.shift());
clips[0].loadMovie(GetFileFor(images[0]));
status_txt.text = "Preloading "+images[0];
this.onEnterFrame = PreloadNext;
}
}
// next_btn.onPress shows the next image if preloaded and starts
// preloading the next one using PreloadNext as an onEnterFrame event
next_btn.onPress = function(){
if (this.onEnterFrame){
status_txt.text = "Please wait for "+images[0]+" to complete";
return false;
}
clips[0].swapDepths(clips[1]); // move preloaded image to top
clips[0].loadMovie(GetFileFor(images[0]));
status_txt.text = "Preloading "+images[0];
timeline.onEnterFrame = PreloadNext;
}
// initiate loading of first image
clips[0].loadMovie(GetFileFor(images[0]));
status_txt.text = "Preloading "+images[0];
this.onEnterFrame = FirstLoad;
Any help will greatly appreciated

AS 2 Preload Every Image In Xml Slide Show
Hello Friends,
i have made a slide show based on action script+xml. I want to show preload when every image load. But my my doesn't work. Please help me. Any idea would appriciate.

Thanks in advance


here is my code:


var xml:XML = new XML();
xml.ignoreWhite = true;

var urls:Array = new Array();
var captions:Array = new Array();
var whoIsOn:Number;
var loaded:Number = xml.getBytesLoaded();
var total:Number = xml.getBytesTotal();

xml.onLoad = function(success) {
if(success) {
trace((loaded/total)*100);
var photos:Array = this.firstChild.childNodes;
for (i=0; i<photos.length; i++) {
urls.push(photos[i].attributes.url);
captions.push(photos[i].attributes.caption);
}
}

holder.loadMovie(urls[0]);
caption.text = captions[0];
whoIsOn = 0;

};
xml.load("images.xml");

_root.previous.onRelease = function() {
if (whoIsOn>0) {
whoIsOn--;
holder.loadMovie(urls[whoIsOn]);
caption.text = captions[whoIsOn];
}
};

_root.next.onRelease = function() {
if (whoIsOn<urls.length-1) {
whoIsOn++;
holder.loadMovie(urls[whoIsOn]);
caption.text = captions[whoIsOn];
}
};

Audio / Image Dynamic Preload
i am creating an admin tool that allows my clients to create custom slide shows, the problem i'm facing is when audio is attached. both the audio and images need to be pulled in dynamically.

i need to make sure the audio and images are always sync'd and that the audio is always preloaded with enough buffer that it will coincide with the images. they'll also need the ability to move the audio track and have it move to the specific image.

http://www.nytimes.com/packages/html/business/20050717_DENVER_AUDIOSS/blocker.html]the best example i can give is this:
http://www.nytimes.com/packages/html...S/blocker.html[/url]

anyone have good resources? importing the images and audio through XML , i can do easily...it's the sync'ing and playback i'm stumped on.

Preload Image Technique... Would This Work?
I'm basically trying to pre-load a bunch of images that I will load dynamically later in the movie. If I do the below will flash first fully load "image1.jpg" and then fully load "image2.jpg" ?

[PHPNET]
preloadLayer._alpha = 0;
preloadLayer.loadMovie("images/image1.jpg");
preloadLayer.loadMovie("images/image2.jpg");
[/PHPNET]

also whle the loadMovie funciton is working on the upload will this effect another "loadMovie" call that could be made at the same time on a different layer?

Reusable Preloader Working After First Preload Image
I am using the tutorial on the reusable preloader which works great on the first image. But, I recently noticed that it only preloads the first image time it is called, and I never see the preloader again. I am fairly comfortable with AS and I am not a newbie. But, I cant help but feel a little ticked off because I know it is something small that I am just overlooking. I have been searching for an answer for a couple of days nows....

Anyway, here is the link for the preview file.

http://boundless-vision.com/temp/v4_sample.html

Click on portfolio and choose a section and then a gallery piece. NOTE the preloader on the first gallery piece load... but you never see it again...

Which leads me to believe it is something that has to do with my coding - for putting a dynamic path to preload.. I have a loop which spits out the buttons and all of the corresponding data.

Anyway, here is what I believe is the affected code
this is in between my chGallery Function - that handles all of my load / parse / display functions.. Formatting might have it break, I apologize for that...


ActionScript Code:
<font size="2">for (var i = 0; i<chGalleryMC_path.GalleryItem.length; i++) {        // loop through the gallery item var I declared earlier        // this variable is a house for all of the gallery item         // nodes that are located within the chosen gallery xml file        chGalleryMC_Item_path.createEmptyMovieClip("container", i);        //        var myItemTitle = chGalleryMC_path.GalleryItem[i].firstChild.firstChild.nodeValue;        // declare a local variable to hold temporary name data for text input        chGalleryMC_path.gItem.duplicateMovieClip("gItem"+i, StartDepth+i);        // duplicate the attatched movie clip in order to loop        // through all of the required gallery items that were        // loaded from the xml file        //        gItem_Temp_MCPATH_Array.push(chGalleryMC_path["gItem"+i]);        trace(chGalleryMC_path["gItem"+i]);        //        //        //        chGalleryMC_path["gItem"+i]._y = startY+(MenuSpace*i)+200;        // increment each gallery item down the page        chGalleryMC_path["gItem"+i]._x = startX;        // set the horizontal space        chGalleryMC_path["gItem"+i].id = chGalleryMC_path.GalleryItem[i].attributes.id;        // set.id for the item from the xml node id attribute        chGalleryMC_path["gItem"+i].itemName.text = myItemTitle;        // display item Title        //chGalleryMC_Item_path.createEmptyMovieClip(myItemTitle, i);        //        chGalleryMC_path["gItem"+i].itemName_btn.num = i;        //        chGalleryMC_path["gItem"+i].itemName_btn.path = chGalleryMC_path.GalleryItem[i].attributes.path;        // set the button.path the same as the xml loaded gallery item path        // easy load in the release function below        //        chGalleryMC_path["gItem"+i].itemName_btn.onRollOver = function() {            if (this.num != GalleryItem_Selected) {                this._parent.itemName.setTextFormat(formatText_Bold);            }        };        //        chGalleryMC_path["gItem"+i].itemName_btn.onRollOut = function() {            if (this.num != GalleryItem_Selected) {                this._parent.itemName.setTextFormat(formatText_NOBold);            }        };        //        //        chGalleryMC_path["gItem"+i].itemName_btn.onRelease = function() {            // loop generated on release, to load the path of this button             // which is parsed from the xml doc            if (this.num != GalleryItem_Selected) {                // if you already clicked on it, it wont happen again                //                //                gItem_Old = gItem_New;                gItem_New = this.num;                gItemOLDpath = chGalleryMC_path["gItem"+gItem_Old];                //                //                MenuTitle_SET(gItem_Old, this.num, gItemOLDpath);                //                <font color="Red">gItemMCLoader.loadClip(chGalleryMC_path.GbasePath+this.path, chGalleryMC_Item_path.container);</font>                //loadMovie(chGalleryMC_path.GbasePath+this.path, gIContainer);                trace(chGalleryMC_Item_path[myItemTitle]);                // loads the image located at the chosen gallery path + xml loaded                 // gallery base path into the 'MYWINDOW' titled window                GalleryItem_Selected = this.num;                // set item selection the the parent id                trace("New: "+gMenuSelection_New);                trace("Old: "+gMenuSelection_Old);                trace("This.num: "+this.num);                trace("This.path: "+this.path);            }        };    }//////////////gItemMCLoader = new MovieClipLoader();gItemPreload = new Object();gItemMCLoader.addListener(gItemPreload);gItemPreload.onLoadStart = function(targetMC) {    gIContainer._alpha = 0;    bar._visible = true;    border._visible = true;    bgDS._visible = true;    gItemPreloaderMC.gItemFadeIn();};gItemPreload.onLoadProgress = function(targetMC, lBytes, tBytes) {    bar._width = (lBytes/tBytes)*100;};gItemPreload.onLoadComplete = function(targetMC) {    gIContainer.gItemFadeIn();    //gItemPreloaderMC.gItemFadeOut();    border.gItemFadeOut();    bar.gItemFadeOut();    bgDS.gItemFadeOut();};</font>


The preload call is made in the dynamically generated onRelease handler for the gallery item button. which loads the image / sets text / etc.. etc..

There are four _Shells that i use to load my portfolio images into , each for the sections of my gallery, I dont really want to break this method, only becuase once the image is loaded, it is loaded and there is no real reason for it to have it's own mc just yet. However, if you could come up with a solution for that also, It would be much appreciated.

Thank you for any responses in advance.

Preload Images In Background As Viewer Looks At First Image
Hi everyone, thank you ahead of time...

I have a swf file calling an xml file w/ several images. I want the first image to load in the swf, then the additional images in the xml file to load invisibly in the cache while the viewer looks at the first image.

the point is to create a seamless flow through a gallery, rather than having each iamge preload.

please please help, I just cant find a good script for this

Thank you!!

Can You Preload An Embedded Swf In To A Html Webpage As You Would An Image?
I am creating a site for a client, www.idsvehicles.co.uk

I want to preload the embedded swf's as you would images using javascript or css. I have so far been unsuccessful. I am trying to avoid having the great big white patches in the site while the menu or stocklist(on the stocklist page) load, and id prefer not to have a loading bar while it does. If possible id like to have all images and swf's loaded and cached before the page is displayed so it appears seemingly instantly. Is this possible?

I first attempted to do this with a standard image preloading javascript and failed. Is it at all possible to preload swf's with javascript, if not what are my options?

Thanks in advance.

P.S. I am fairly new to the site, i only discovered it a few days ago. Its an absolutely fantastic resource and has already helped me out massively, so thank you to all, especially those involved with the tutorials. Superb!

"Directory" Image Gallery
ok heres the deal, i need to create an image gallery that the user can upload their pictures and then view them in a flash movie. i already have it so that they can upload their pictures to a directory. now i need to get the images from that directory into my flash movie in pages of 2 rows and 4 columns, 8 pix on a page.

i need it so that it loads 8 pix at a time per page and when the flip to page to it loads the next 8. i will not know the file names of course because the user will be uploading the pix. but i do know the directory name so if anybody can give me a little help that would be great!

you can see what i have so far at http://www.koathletics.com/familywebsite.htm
in the 'photos' section

thanx alot!
austin

How To Preload Movie With Html Image In Dynamic Text Box
hey!
ok what i'm trying to do, in case anyone can think of a better way, is to load into my flash site one of those facebook buttons that facebook make and give you the code for pasting into html.
soooo what i am doing is making a swf which contains a dynamic text box, into which i have pasted the html for the button. works fine. BUT i don't seem to be able to preload it. when i put a preloader in i get nothing, the preloader doesn't show up, because the swf is so tiny it loads right away. what's taking the time (like 3 seconds) to come in is the image it's dragging in off facebook's site. can anyone tell me if there is a way to preload this?
thanks!
emma.

Preload Image OnLoad (hga77's Dynamic Gallery)
Hey Gurus,

I have modified hga77's gallery and made some changes with the style. I am still having some problems and need three things sorted out. Well, two aren't essential but the first one is.

1. Most importantly, On Load I need the first image in the XML file to load in and have a border.
2. Get the percentage preloader working.
3. Load in the thumbnails left to right http://www.poetandcompany.com/frameset.html .

Please help me out.

Cheers

Preload Opening Image (Problem Center/border)
Been a while,

I have some thumbnails, when clicked on, the larger image loads which fades in and is centered. My problem lies with the first image which I want to automatically load when the swf is called. At the moment, it loads the image from the top left corner of the MovieClip, it fades it but no border and I can't get it to center. I want to call the function which fades in and centers the opening image onLoad. I have attached the fla which has been edited so it only includes the problem. I hope someone can help using the same or a similar function to mine as it will be applied to each thumbnail.

This appears at the top of my AS code:


Code:
onLoad = function() {
//onload, load the first image into the MC
ImageContainer._alpha = 0;
ImageContainer.loadMovie("images/image0.jpg");
//This function centers, borders and fades the image in
preload();

}
This is the preload function(s), please remember this same function works fine when a thumbnail is clicked on it!


Code:
function preload() {

this.onEnterFrame = function() {

var l = ImageContainer.getBytesLoaded();
var t = ImageContainer.getBytesTotal();
var percent = Math.round((l/t)*100);
percent -= (percent-((l/t)*100))*.25;
per = int(percent);

if (l<t){

percentage = per+" percent";
bytes = "loading ("+l+"/"+t+")";
}

if (t>0 && l>=t) {

percentage = "";
bytes = "";

ImageContainer._x -= ImageContainer._width/2;
ImageContainer._y -= ImageContainer._height/2;
ImageContainer.createEmptyMovieClip("border",7453);
ImageContainer.border.lineStyle(0,0x000000,100);
ImageContainer.border.lineTo(ImageContainer._width,0);
ImageContainer.border.lineTo(ImageContainer._width,ImageContainer._height);
ImageContainer.border.lineTo(0,ImageContainer._height);
ImageContainer.border.lineTo(0,0);
ImageContainer.bordered = true;
//calls fadeIn program
this.onEnterFrame = FadeImage;


}
}
};

function FadeImage() {
if (ImageContainer._alpha<100) {
trace("fade");
//changing digit will change speed
ImageContainer._alpha += 10;
} else {
this.onEnterFrame = null;
}

};
Thanks!

Using A Preloader To Preload Images, However I Get NaN Errors While Loading The Image
MovieClip.prototype.preLoad = function(depth, target_text, target_mc)
{
createEmptyMovieClip("preload_mc", depth);
preload_mc.attachMovie("counter", "counter", _root.getNextHighestDepth());

preload_mc.onEnterFrame = function()
{
var lb = target_mc.getBytesLoaded();
var tb = target_mc.getBytesTotal();
var percent = Math.floor((lb/tb)*100)

// Center
preload_mc.counter._visible=true
preload_mc.counter._y=292
preload_mc.counter._x=360
preload_mc.counter.text.text = percent + "%";
bgkiller.customFade(75, 20, false);
filler._visible=true

if (tb>0 && lb == tb)
{
//center
target_mc._y = (Stage.height / 2) - (target_mc._height / 2);
target_mc._x = (Stage.width / 2) - (target_mc._width / 2);
// Create fade
target_mc.customFade(200, 20, false);
preload_mc.counter._visible=false
kill._visible=true;
target_text.text = "";
delete this.onEnterFrame;
}
}
}
//load jpg prototype
MovieClip.prototype.photoLoad = function(target, target_mc, depth){
//this._alpha= 0;
this.loadMovie(target, this.getNextHighestDepth());
target_mc.preLoad(depth, target_text, target_mc);
}

Whenever im preloading images, i get a NaN Error everytime. Sometimes all i see is a NaN error, not even load numbers like 89% or so. I got the swf online at http://www.duskydesigns.nl/duskydesigns.nl.

If you go to any section in the designs menu (3d design, 2d design or webdesign) and click a image you get the script that gives the NaN.

I only get NaN in Firefox, Internet Explorer just gives 0. But either way i would like to see percentages rather than 0 or NaN.

Thanks for helping,

Kenneth vd Werf

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