Preload External Jpgs
What is the easiest way to preload external jpgs? The client wants to update these frequently so they should be external, but I want them to show up instantly like the rest of the site once the preloading is done.Any advice? I had thought about loading them into the preloader (at 0% alpha), so that they'd be loaded into the cache during preload, so that when the home page comes up, they'd be all ready to go? But if it's a different instance of the movieclip, will it reload the jpg? Or any time i use that external jpg in the flash file will it already be in the cache?Thanks. I've heard a few different things and would love your advice.Jeremy
Adobe > ActionScript 1 and 2
Posted on: 08/23/2007 12:37:37 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Preload External JPGs
Hi all,
How to make a preloader to preload external JPGs (say 5 JPG files)?
Once all the JPGs have been loaded into the system cache then the movie
starts playing. Any help would be greatly appreciated. thanks.
Can't Figure Out How To Preload External Jpgs
ok..i made a post about this in the "actionscript" area...but im not sure if its a newbie thing..or an advanced thing.
i was able to get a bunch of external images to load up when i move the mouse over the buttons....everything was fine. I uploaded it to my server...and i have to roll over and leave the mouse there until its done downloadin the image.
is there any way i can preload these images in a seperate folder within this flash movie?
Im new to flash..so please..go easy
Thanks for everyones help so far!
Preload External JPGs Into ARRAY Or MC?
I need to preload 50 external images to be used as
separate MCs. Does anyone have any recommendations
for data structure to store them.
Right now, I'm trying to store them into an array, but
am having difficulty and thought I'd seek advice before
changing over to adding them to a master MC.
Any comments appreciated.
Thanks,
- bullfro9
_____
function buildArray () {
var myArray = new Array();
curDepth = 100;
for (i=1; i <= 50; i++) {
tmp=_root.createEmptyMovieClip(i,curDepth++);
myArray.push(tmp);
}
return matrixArray;
_____
Preload External Jpgs As A Group
I'm useless at AS (incase my last 10 posts didn't make that clear!)can someone tell me what code to use if i want to preload a bunch of dynamically loaded jpgs
there are 4 child swfs with 9 thumbnails each -
would love to know how i can preload 9 images at a time
say when a user selects the 1st thumbnail of a group
they are all saved in one images folder
Preload External Jpgs Individually
Let me be the first to say that I am far from being an expert at actionscript... I have spent hours upon hours trying to work this out and I am sure it is not that hard!
What I am trying to achieve is to implement a feature where the user clicks on a thumbnail to view a larger image. I want the larger image to load with a preloader, then once the user closes the larger image to then be able to view another larger image...
I have attached a FLA file to show what I am trying to do. All the tutorials I have come accross load the images with next/previous buttons - but I don't want this as I want the user to be able to select whichever thumbnail they wish to view.
Can anyone help me out?
Preload External Jpgs As A Group
I'm useless at AS (incase my last 10 posts didn't make that clear!)can someone tell me what code to use if i want to preload a bunch of dynamically loaded jpgs
there are 4 child swfs with 9 thumbnails each -
would love to know how i can preload 9 images at a time
say when a user selects the 1st thumbnail of a group
they are all saved in one images folder
Preload External JPGs In Container MovieClip
I have a main movie timeline which has a container movie loaded into it with various external SWFs. These external SWFs have external JPGs associated with them which are loaded in using loadMovie. What I'd like to do is to load all the JPGs while loading the external SWF so that ALL preloading can take place at the same time. At the moment the external SWF is fully loaded and then the JPGs must be loaded afterwards.
Could anyone suggest the best way of going about this? Thanks!
Preload Jpgs For Use In Another Swf
I have a demo CD that I am working on and the images are all dynamic.
The problem is that the mainmovie loads other swf files that call on the load of jpg into another movieclip. So I tried to pre load the jpgs in the main movie so I can use them later but that did not help.
My CD demo starts to get very slow and skips the transitions from one swf to the next towards the end of the presentation.
Anyone have any thoughts??
Please help
Preload 10 Jpgs
Hi guys,
I need help. I have 10 MC named "preloadMov1" to "preloadMov10" on the root of my swf. I have to preload 10 jpgs in those MCs. Any idea on how to do this?
Please help!
biggie
The Man of Tomorrow is forged by his battles today.
Preload JPGs In Dynamic MCs
Been avoiding trying to get this to work all day, but it can't be quite as difficult as it appears.
I can preload my images fine, by placing this code on the holder:
code: onClipEvent (enterFrame)
{
if (this._url != _root._url && !this._url.loaded){
if (this.getBytesLoaded() >0 && this.getBytesLoaded() >= this.getBytesTotal()){
/* Get mc name of currently selected thumb. */
nImage = new String (_level0.variables.currentImage);
/* Remove first 30 characters from nImage, and assign result to _level0.n. */
_level0.n = Number (nImage.slice(28, nImage.length));
/* Write loaded value to image var. */
_root["image" + _level0.n + ".text"] = "loaded";
/* Perform loaded action only once. */
if (p <= 0){
trace(this._url add " = loaded");
if (_level0.variables.imageLoader != inactive){
_level0.imageLoader.play();
}
if (_level0.variables.imageLoader == active){
_level0.imageLoader.gotoAndStop(1);
} else if (_level0.variables.imageLoader == inactive){
_level0.imageLoader.gotoAndStop(1);
}
}
p = p+1;
trace(p);
delete this.onEnterFrame;
_level0.loadmessage = "Done.";
} else {
if (this.getBytesLoaded() >0){
var kilobytes = Math.ceil(this.getBytesTotal() / 1000);
var percentLoaded = Math.ceil(this.getBytesLoaded() / this.getBytesTotal() * 100);
_level0.message.html = true;
_level0.loadmessage = "Loading ... " + percentLoaded + "%";
}
}
}
}
However, I cannot get a preloader working for my thumbnails holder. I must admit, I'm unsure WHAT EXACTLY, I need to load exactly, as when I trace it using 'this', I get the swf path.
Is there a way to determine the percentage progress of all the dynamic jps thumbs, that are loaded into _root.thumbnails?
Thumbnails creation script:
code: for (i=0; i<imagesTotal; i++) {
/* Assign a mc name to each of the childNodes for future reference. */
picHolder = this.firstChild.childNodes[i];
/* Create a movie clip for each thumbnail, and assign a temporary thumbholder for them. */
thumbHolder = thumbnails.createEmptyMovieClip("thumbnail"+i, i);
thumbHolder._y = i*spacing;
/* Set the values for each newly created movieclip. */
thumbHolder.title = picHolder.attributes.title;
thumbHolder.image = picHolder.attributes.image;
/* Create new movie and then load the thumbnails into it. */
thumbLoader = thumbHolder.createEmptyMovieClip("thumbnail_image" +i, i);
thumbLoader.loadMovie(picHolder.attributes.thumb);
/* Create textfield for each image. */
_root.createTextField("image"+i, 0, 0, 0, 0, 0);
/* Create textfield for each thumb. */
_root.createTextField("thumb"+i, 0, 0, 0, 0, 0);
/* Execute thumbnails preload function. */
thumbnails.onEnterFrame = function(){
// Trace each thumbnail
trace(thumbnails["thumbnail"+i]);
preloadThumbs();
}
trace(thumbnails["thumbnail"+i]);
/* Determine how many thumbnail preload backgrounds to display (maximum of 10 at a time). */
for(j=1;j<=10;j++){
if (imagesTotal >= j){
_level0["thumb_loader"+j].gotoAndPlay(2);
}
}
if (imagesTotal >= 11){
_root.upanddown.gotoAndPlay(2);
}
/* Create press function for thumbnails. */
thumbHolder.onPress = function() {
_root.selection.gotoAndStop(2);
/* Determine the thumb alignment. */
if (thumbAlign == "horizontal"){
_root.selection._x = this._x + Number (215);
}
if (thumbAlign == "vertical"){
_root.selection._y = this._y + Number (21);
}
}
/* Create release function for thumbnails. */
thumbHolder.onRelease = function() {
/* Load image into container. */
image_mc.loadMovie(this.image);
_level0.title_txt.text = this.title;
/* Get mc name of currently selected thumb. */
_level0.variables.currentImage = this;
vImage = new String (_level0.variables.currentImage);
/* Remove first 30 characters from vImage, and assign result to ImgStr. */
_level0.ImgStr = Number (vImage.slice(28, vImage.length));
/* Set variable with number of currently selected thumbnail. */
_level0.variables.ImgStr = _level0.ImgStr +1;
//_level0.variables.ImgStr = ImgStr;
/* Set loading message. */
_level0.loadmessage = "Loading ...";
};
}
I'd like to do this in Flash 6 compliant script, unless someone can persuade me into using ActionScript 2/Flash 7 script (lol, Jbum).
[FMX] Preload Multiple Jpgs
Hi there,
I'm currently making a xml driven photo gallery. The first stage is loading in the thumbnails, each thumbnail will preload individually. I pretty close to acheiving this except my current script only loads in the first jpeg. I have tried everything and I jsut can't find a problem. Anyway my code is below if anyone gets a chance to look. Sorry its a bit hefty. I think the problem is with the ThumbLoadingEnterFrame and LoadNextThumb functions.
Any help much appreciated
Cheers
PHP Code:
count = 0;
var thumbImage = new Array();
var thumbClip = new Array();
var jpegImage = new Array();
function ThumbLoadingEnterFrame() {
var lod = this.loader_mc.getBytesLoaded();
var tot = this.loader_mc.getBytesTotal();
if (lod && tot) {
var percent_loaded = lod/tot;
this.progress_mc._xscale = 100*percent_loaded;
if (percent_loaded == 1) {
LoadNextThumb();
delete this.onEnterFrame;
}
}
}
function LoadNextThumb() {
//trace(thumbImage.length);
if (count<thumbImage.length) {
var imgURL = thumbImage[count];
thumbClip[count].loader_mc.loadMovie(imgURL);
thumbClip[count].onEnterFrame = ThumbLoadingEnterFrame();
count++;
}
}
var gallery_xml = new XML();
gallery_xml.ignoreWhite = true;
gallery_xml.onLoad = function(success) {
if (success) {
var mySection = gallery_xml.firstChild.childNodes[0];
var picCount = mySection.childNodes.length;
for (var i = 0; i<picCount; i++) {
//Populate Arrays
count++;
thumbImage.push(mySection.childNodes[i].attributes.thumbURL);
jpegImage.push(mySection.childNodes[i].attributes.jpegURL);
tnHolder = _root.attachMovie("thumb_container", "tc"+count+"_mc", count);
thumbClip.push(tnHolder);
tnHolder.progress_mc._xscale = 0;
tnHolder._y = i*100;
}
count = 0;
LoadNextThumb();
} else {
trace("Error loading XML file");
}
};
gallery_xml.load("gallery.xml");
Trying To Preload A Doc With Multiple Jpgs
Hi everyone. I'm trying to create a flash document that just does a slideshow through the images, but the image paths are all in an external xml file (this is because we are going to randomize that xml file on the fly with server scripting) and I want a preloader that loads the swf and all 5 of the external images that are in the document. The way I was able to get it to work is to use this script to load the XML doc and the images:
function loadXML(loaded) {
if (loaded) {
//pulls all data from the xml file
xmlNode = this.firstChild;
path = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
path[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
}
changeImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("flashbanners/homebanner.xml");
function changeImage() {
container1.loadMovie(path[0], 1);
container2.loadMovie(path[1], 1);
container3.loadMovie(path[2], 1);
container4.loadMovie(path[3], 1);
container5.loadMovie(path[4], 1);
}
And then I call that changeImage(); function on each keyframe when a new image container appears. It's the only way I could figure it out to get it to work this way, although I'm sure there is a better one. Here is the preload script I was trying:
preloader._visible = false;
this.onEnterFrame = function() {
//finds out how much of the clip is loaded
filesize = Math.round(getBytesTotal());
loaded = Math.round(getBytesLoaded());
//starts the preloader if everything is not loaded yet
if (loaded != filesize) {
preloader._visible = true;
//preload bar length
preloader.preload_bar._xscale = 100*loaded/filesize;
//percentage number
loaded_bytes = Math.round(getBytesLoaded());
loaded_total = Math.round(getBytesTotal());
total_percent = (loaded_bytes/loaded_total)*100;
preloader.loaded_text = Math.round(total_percent);
} else {
preloader._visible = false;
}
};
So, is it even possible for a preloader to do that? I got one to work that preloaded each image as it came up, but that's not the solution I'd like. I appreciate anyone's input!
Preload All Jpgs With XML Gallery
Hi,
I have a an xml image gallery with at least 5 jpgs loading into the flash movie. These a called via the XML file.
I have the images loaded in ok, but I would like to load the first image in and pan down the Y axis, while the second image loading in the background and then fade and pan in up the Y axis, they will alternate with every consecutive image. And then loop through from the begining again.
I needs either to prelaod all the images into the flash movie and slide the images with a smooth transition or load them individually while one has loaded in the background.
XML file loads in ok, images are pulling through but the preloader bit is not loading correctly.
Code below:
ActionScript Code:
stop();//Call XML script//function loadXML(loaded) { if (loaded) { xmlNode = this.firstChild; image = []; total = xmlNode.childNodes.length; for (i=0; i<total; i++) { image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue; } intervalId = setInterval(this, "executeCallback", duration); } else { content = "file not loaded!"; }}xmlData = new XML();xmlData.ignoreWhite = true;xmlData.onLoad = loadXML;xmlData.load("images.xml");///////////////////////////////////////Call set Interval to fade image in 1 by 1//var intervalId:Number;var duration:Number = 1500;function executeCallback():Void { nextImage(); if (p>total-2) { p = 0; } else { p++; }}intervalId = setInterval(this, "executeCallback", duration);///////////////////////////////////////////////init();function init() { p = 0;}//Preloader//this.onEnterFrame = function() { filesize = _root.picture.getBytesTotal(); loaded = _root.picture.getBytesLoaded(); preloader._visible = true; if (loaded != filesize) { preloader.preload_bar._xscale = 100*loaded/filesize; picture._visible = false; } else if (loaded == filesize) { preloader._visible = false; picture._visible = true; if (picture._alpha<100) { picture._alpha += 10; } }};//load and Jump to next image//function nextImage() { if (loaded == filesize) { picture._alpha = 0; picture.loadMovie(image[p], 1); }}
Please can anyone help out? Or suggestions?
Im
[FMX] Preload Multiple Jpgs
Hi there,
I'm currently making a xml driven photo gallery. The first stage is loading in the thumbnails, each thumbnail will preload individually. I pretty close to acheiving this except my current script only loads in the first jpeg. I have tried everything and I jsut can't find a problem. Anyway my code is below if anyone gets a chance to look. Sorry its a bit hefty. I think the problem is with the ThumbLoadingEnterFrame and LoadNextThumb functions.
Any help much appreciated
Cheers
PHP Code:
count = 0;
var thumbImage = new Array();
var thumbClip = new Array();
var jpegImage = new Array();
function ThumbLoadingEnterFrame() {
var lod = this.loader_mc.getBytesLoaded();
var tot = this.loader_mc.getBytesTotal();
if (lod && tot) {
var percent_loaded = lod/tot;
this.progress_mc._xscale = 100*percent_loaded;
if (percent_loaded == 1) {
LoadNextThumb();
delete this.onEnterFrame;
}
}
}
function LoadNextThumb() {
//trace(thumbImage.length);
if (count<thumbImage.length) {
var imgURL = thumbImage[count];
thumbClip[count].loader_mc.loadMovie(imgURL);
thumbClip[count].onEnterFrame = ThumbLoadingEnterFrame();
count++;
}
}
var gallery_xml = new XML();
gallery_xml.ignoreWhite = true;
gallery_xml.onLoad = function(success) {
if (success) {
var mySection = gallery_xml.firstChild.childNodes[0];
var picCount = mySection.childNodes.length;
for (var i = 0; i<picCount; i++) {
//Populate Arrays
count++;
thumbImage.push(mySection.childNodes[i].attributes.thumbURL);
jpegImage.push(mySection.childNodes[i].attributes.jpegURL);
tnHolder = _root.attachMovie("thumb_container", "tc"+count+"_mc", count);
thumbClip.push(tnHolder);
tnHolder.progress_mc._xscale = 0;
tnHolder._y = i*100;
}
count = 0;
LoadNextThumb();
} else {
trace("Error loading XML file");
}
};
gallery_xml.load("gallery.xml");
Is There A Way To Preload Dynamic Jpgs?
Has anyone come up with a way to preload jpgs that will be pulled into movie clips dynamically? i would like to avoid having to create separate swf's for each image, but don't want to lose the ability to have a percentage loader while the image is loading. some of the images are fairly large, and it would be unfair to slow modem if they saw no indication that the image was loading...
any ideas?
thanks
Tracing Preload For Dyn Jpgs Still A Problem
Hi,
once thought I had solved the problem but I guess I was wrong. I can preload now several jpgs using a loop and MC on the stage (createnewMC I tried by the way and I only get the last pic loaded) but I still have the problem to trace it and to follow the loading process. It aleays shows loaded even it is isn't. I followed suggestions from several threads but none of them worked so far. Also there was either no trace, one trace or as in the script below continous tracing of "loaded". Please have a look or may be someone already got this working.
Code:
stop();
//function to preload slides
function loadAll(firstSlide,lastSlide,slideName,introSlide) {
i = firstSlide;
while (i <= lastSlide) {
_root["slideHolder_" +i].loadMovie(slideName + i +".jpg");
this.onLoad = false;
loadedBytes = this.getBytesLoaded();
this.onEnterFrame = function () {
if (loadedBytes > 0) {
this.onLoad != false;
totalBytes = this.getBytesTotal();
percentOutput = Math.floor(loadedBytes/totalBytes)*100;
if (percentOutput < 100) {
_root.loadText.gotoAndPlay("play");
trace("loading");
}else if (percentOutput == 100) {
_root.loadText.gotoAndStop("stop");
trace("loaded");
}
}
}
i++;
_root.slideHolder.loadMovie(introSlide);
}
}
Loading Jpgs Using Loadmovie Can I Preload?
Loading jpgs using loadmovie can I preload?
I have the following code thanks to a_modified_dog
lv = new LoadVars();
lv.onload = function() {
large1.loadMovie(lv.location1);
large2.loadMovie(lv.location2);
large3.loadMovie(lv.location3);
spot1.loadMovie(lv.location1);
spot2.loadMovie(lv.location2);
spot3.loadMovie(lv.location3);
};
lv.load("standardsofa.txt");
The Text file is as follows:
&name1=ABC+SOFA&location1=abc.jpg&pdf1=flexform/Flexform+1-1+ABC+layout.pdf&name2=BOB+SOFA&location2=bob.jpg& pdf2=flexform/Flexform+1-5+BOB+layout.pdf&textloaded=OK
But now I need to figure out how to preload the information so it does not come up one image as a time.
Not to mention I will be loading possibly 70 jpgs at once and would like them to preload.
Any ideas??
ESE51
Loading Jpgs From A Txt File I Need Them To Preload
I have tried all normal methods in Flash MX to preload a jpg that I loaded dynamically from a text file. All the preloader does is load the small weight of the file with out the pictures. The way the pictures end up on the screen is as if it was a html page one at a time. Is there a way someone knows to preload this? I used loadmovie to load the variables which have the jpg path information in them.
the web site is http://www.vegahome.com/tesstfla2.html
I pray someone understands what I am saying and thanks in advance!
ESE51
Preload Multiple Jpgs Individually
Hello, I'm building gallery which loads dynamic jpgs from an xml into a movieclip which is scrolled. By now the script works fine but I want to add a preload bar to each of the jpgs while loading, and here is where I don't know what's wrong with the code.
Here it is:
Code:
separation = 2;
archive = new XML();
archive.ignoreWhite = 1;
parse = function (success) {
if (success) {
_root.createEmptyMovieClip("gallerymenu", 20);
_root.gallerymenu._x = 50;
_root.gallerymenu._y = 70;
_root.gallerymenu._visible = 0;
for (i=0; i<this.firstChild.childNodes.length; i++) {
var button = _root.gallerymenu.attachMovie("btgallery", "button"+i, i);
button.textobt.text = this.firstChild.childNodes[i].attributes.name;
button._x = i*(_root.gallerymenu["button"+i]._width+separation);
button.targetgal = this.firstChild.childNodes[i].childNodes.length;
button.targetimages = this.firstChild.childNodes[i];
button.onRelease = function() {
clipArray = new Array();
sizeArray = new Array();
// create arrays from the xml nodes
for (var j = 0; j<this.targetgal; j++) {
clipArray.push(this.targetimages.childNodes[j].attributes.urls);
sizeArray.push(this.targetimages.childNodes[j].attributes.image_w);
}
//trace(clipArray);
//trace(sizeArray);
var imagewidth:Number= 0;
for (var k = 0; k<clipArray.length; ++k) {
// // loops through array and dynamically creates containers for each url and attaches preloader instances
var clip:MovieClip = _root.holder.createEmptyMovieClip("clip"+k, k);
_root.holder.holderload.attachMovie("preloader", "preloader"+k, k);
_root.holder.holderload["preloader"+k]._x = imagewidth;
targetpreloader = _root.holder.holderload["preloader"+k];
// //preloading function
my_mc = new MovieClipLoader();
preload = new Object();
my_mc.addListener(preload);
preload.onLoadStart = function(targetMC) {
trace("started loading "+targetMC);
};
preload.onLoadProgress = function(targetMC, lBytes, tBytes) {
targetpreloader.bar._width = (lBytes/tBytes)*100;
targetpreloader.pText.text = "Loading image"+Math.round((lBytes/tBytes)*100)+"%";
};
preload.onLoadComplete = function(targetMC) {
//targetpreloader.removeMovieClip ();
trace(targetMC+" finished");
};
// //end of preloading function
my_mc.loadClip(clipArray[k], clip);
// spacing
clip._y = 25;
clip._x = imagewidth;
var incremento:Number = Number(sizeArray[k]);
var imagewidth:Number = imagewidth + (incremento +10);
//trace (imagewidth);
//
}
}
button.onRollOver = function() {
this.bullet.gotoAndPlay(2);
};
button.onRollOut = function() {
this.bullet.gotoAndPlay(1);
};
}
_root.gallerymenu._visible = 1;
}
};
archive.onLoad = parse;
archive.load("galleries.xml");
stop();
Also I want to know if the jpgs can be loaded sequentially, I know I have to use the onLoadInit but don't really know how.
Any help will be very appreciated.
Thank you.
By the way the xml I'm using to load the pictures is this:
Code:
<photo1>
<gallery name="fashion1">
<image urls="fashion1/01.jpg" image_w= "519"/>
<image urls="fashion1/02.jpg" image_w= "501"/>
<image urls="fashion1/03.jpg" image_w= "596"/>
<image urls="fashion1/04.jpg" image_w= "500"/>
</gallery>
<gallery name="fashion2">
<image urls="fashion2/01.jpg" image_w= "312"/>
<image urls="fashion2/02.jpg" image_w= "322"/>
<image urls="fashion2/03.jpg" image_w= "336"/>
<image urls="fashion2/04.jpg" image_w= "320"/>
</gallery>
<gallery name="travel">
<image urls="travel/01.jpg" image_w= "320"/>
<image urls="travel/02.jpg" image_w= "366"/>
<image urls="travel/03.jpg" image_w= "325"/>
<image urls="travel/04.jpg" image_w= "400"/>
</gallery>
</photo1>
here you can download the .fla and the other files If you wnat to see how it works. It's only 520 kb
http://www.shaktiprod.com/scrollgallery.zip
Also you can see the gallery working here:
http://www.shaktiprod.com/photo1/phototest5(mc).html
Preload Multiple Jpgs Individually
Hello, I'm building gallery which loads dynamic jpgs from an xml into a movieclip which is scrolled. By now the script works fine but I want to add a preload bar to each of the jpgs while loading, and here is where I don't know what's wrong with the code.
Here it is:
ActionScript Code:
separation = 2;archive = new XML();archive.ignoreWhite = 1;parse = function (success) { if (success) { _root.createEmptyMovieClip("gallerymenu", 20); _root.gallerymenu._x = 50; _root.gallerymenu._y = 70; _root.gallerymenu._visible = 0; for (i=0; i<this.firstChild.childNodes.length; i++) { var button = _root.gallerymenu.attachMovie("btgallery", "button"+i, i); button.textobt.text = this.firstChild.childNodes[i].attributes.name; button._x = i*(_root.gallerymenu["button"+i]._width+separation); button.targetgal = this.firstChild.childNodes[i].childNodes.length; button.targetimages = this.firstChild.childNodes[i]; button.onRelease = function() { clipArray = new Array(); sizeArray = new Array(); // create arrays from the xml nodes for (var j = 0; j<this.targetgal; j++) { clipArray.push(this.targetimages.childNodes[j].attributes.urls); sizeArray.push(this.targetimages.childNodes[j].attributes.image_w); } //trace(clipArray); //trace(sizeArray); var imagewidth:Number= 0; for (var k = 0; k<clipArray.length; ++k) { // // loops through array and dynamically creates containers for each url and attaches preloader instances var clip:MovieClip = _root.holder.createEmptyMovieClip("clip"+k, k); _root.holder.holderload.attachMovie("preloader", "preloader"+k, k); _root.holder.holderload["preloader"+k]._x = imagewidth; targetpreloader = _root.holder.holderload["preloader"+k]; // //preloading function my_mc = new MovieClipLoader(); preload = new Object(); my_mc.addListener(preload); preload.onLoadStart = function(targetMC) { trace("started loading "+targetMC); }; preload.onLoadProgress = function(targetMC, lBytes, tBytes) { targetpreloader.bar._width = (lBytes/tBytes)*100; targetpreloader.pText.text = "Loading image"+Math.round((lBytes/tBytes)*100)+"%"; }; preload.onLoadComplete = function(targetMC) { //targetpreloader.removeMovieClip (); trace(targetMC+" finished"); }; // //end of preloading function my_mc.loadClip(clipArray[k], clip); // spacing clip._y = 25; clip._x = imagewidth; var incremento:Number = Number(sizeArray[k]); var imagewidth:Number = imagewidth + (incremento +10); //trace (imagewidth); // } } button.onRollOver = function() { this.bullet.gotoAndPlay(2); }; button.onRollOut = function() { this.bullet.gotoAndPlay(1); }; } _root.gallerymenu._visible = 1; }};archive.onLoad = parse;archive.load("galleries.xml");stop();
Also I want to know if the jpgs can be loaded sequentially, I know I have to use the onLoadInit but don't really know how.
Any help will be very appreciated.
Thank you.
By the way the xml I'm using to load the pictures is this:
Code:
<photo1>
<gallery name="fashion1">
<image urls="fashion1/01.jpg" image_w= "519"/>
<image urls="fashion1/02.jpg" image_w= "501"/>
<image urls="fashion1/03.jpg" image_w= "596"/>
<image urls="fashion1/04.jpg" image_w= "500"/>
</gallery>
<gallery name="fashion2">
<image urls="fashion2/01.jpg" image_w= "312"/>
<image urls="fashion2/02.jpg" image_w= "322"/>
<image urls="fashion2/03.jpg" image_w= "336"/>
<image urls="fashion2/04.jpg" image_w= "320"/>
</gallery>
<gallery name="travel">
<image urls="travel/01.jpg" image_w= "320"/>
<image urls="travel/02.jpg" image_w= "366"/>
<image urls="travel/03.jpg" image_w= "325"/>
<image urls="travel/04.jpg" image_w= "400"/>
</gallery>
</photo1>
here you can download the .fla and the other files If you wnat to see how it works. It's only 520 kb
http://www.shaktiprod.com/scrollgallery.zip
Also you can see the gallery here:
http://www.shaktiprod.com/photo1/phototest5(mc).html
MovieClipLoader Class To Preload JPGS
Hey all,
I'm having a problem that I can't quite figure out. I'm attempting to create the "shop" section of a client's website, which involves displaying the photos of the jewelry, and then loading the appropriate information when each of them are clicked on. The movie clip duplicates just fine, but the images are not showing up. The image URLS are loaded from an external XML file, as you can see in the code.
I have one instance of the movie clip on the stage with instance name "picContainer". It contains a dynamic text field with instance name "loadPercent". I'm trying to resize the JPGs to 100x100, despite the fact that they are much larger than that.
Thank you very much for your time!
Here's the code:
Code:
import mx.transitions.Tween;
import mx.transitions.easing.*;
var jxml:XML = new XML();
jxml.ignoreWhite = true;
var photos:Array = new Array();
jxml.onLoad = loadRocks;
var picX = picContainer._x;
var picY = picContainer._y;
var numOfImgs:Number;
function loadRocks() {
var jewels:Array = this.firstChild.childNodes;
for(i=0;i<jewels.length;i++) {
photos.push(jewels[i].attributes.photo1);
trace(jewels[i].attributes.photo1.toString());
}
trace("start LOADROCKS");
trace(photos.length);
trace("loadRocks");
for (var i=0; i<photos.length; i++) {
currContainer = "picContainer"+i;
var containerDup = picContainer.duplicateMovieClip(currContainer,i,{_x:picX,_y:picY,_alpha:0});
var empty = containerDup.createEmptyMovieClip("jpg_container",i*50);
empty._x = empty._y = 0;
empty._width = 100;
empty._height = 100;
containerDup.ID = i;
var picTween:Tween = new Tween(containerDup,"_alpha",Strong.easeIn,0,100,1,true);
//PRELOAD JPG-----------------
var loader:MovieClipLoader = new MovieClipLoader();
var preload:Object = new Object();
preload.onLoadProgress = function (targetMC,lBytes,tBytes) {
containerDup.loadPercent.text = Math.round((lBytes/tBytes)*100)+"%";
}
preload.onLoadInit = function () {
containerDup.loadPercent = "";
trace("loadCOMPLETE");
}
preload.onLoadError = function () {
trace("AN ERROR OCCURRED!");
}
loader.addListener(preload);
loader.loadClip(jewels[i].attributes.photo1,containerDup.jpg_container);
//-------------------------------------
picX += 102;
numOfImgs++;
if (picX > 500) {
picX = 20;
picY += 102;
}
containerDup.onRelease = function () {
getURL("http://www.catharsiswd.com/sandbox/telemundo/"+this.ID,"_blank");
}
}
}
jxml.load("http://www.mar-artandstone.com/products.php");
External Jpgs
hi
how can i call all images from particular folder i know how to call one jpg but i want to show all images in a folder at one call/at a time
thanks in advance
External Jpgs
Hi there!
I wanted to know if there's any way to knok the width and the height of an external image (jpg).
Thank's!
Can't Load External Jpgs
Afternoon All
I have created a website using Flash MX, I have uploaded the site and finally tested it to make sure everything works which it seems to with the exception of one thing. http://www.golfinger.co.uk
I'm trying to load some external jpg images into my Flash website and have them displayed on the screen as and when the user requests them.
I basically used the Load_images.fla that was supplied by Macromedia with Flash in the samples, the images load okay when they are on my PC however once they are loaded onto my web space they seem to not load up. I have installed the latest Flash Active X component but that hasn't help either.
The Action Script I'm using is. It's the "LoadMovie" command near the bottom that should display my images.
// initialize variables and properties
square._alpha = 0;
whichPic = 1;
// initiate change to new image when buttons are clicked
next.onPress = function() {
if (whichPic<21 && !fadeIn && !fadeOut) {
fadeOut = true;
whichpic++;
input = whichPic;
}
};
back.onPress = function() {
if (whichPic>1 && !fadeIn && !fadeOut) {
fadeOut = true;
whichpic--;
input = whichPic;
}
};
_root.onEnterFrame = function() {
// when a new Photo is selected, fade out, load new image, and fade in
if (square._alpha>10 && fadeOut) {
square._alpha -= 10;
}
if (square._alpha<10) {
loadMovie("../html/Images/My Golf/IMAGE"+whichPic+".jpg", "square");
fadeOut = false;
fadeIn = true;
}
if (square._alpha<100 && fadeIn && !fadeOut) {
square._alpha += 10;
} else {
fadeIn = false;
}
};
Can anyone see anything wrong here that might be causing this problem? Or has anyone else come across any similar kind of problem and found a cure for it?
If anyone can help that would be much appreciated.
Loading External Jpgs
im trying to load a bunch of external images, and this is the script that im using to do it:
rndNumber = (picsArray.length);
while (rndNumber>0) {
rndPos = random(rndNumber);
item = picsArray[rndPos];
picsArray.splice(rndPos, 1);
picsArrayRnd.push(item);
loadMovie(item+".jpg", "_root."+_root.version+"thumb"+rndNumber+".pichold er");
loadMovie(item+"b.jpg", "_root."+_root.version+"thumb"+rndNumber+".pichold erb");
set(_root+".picture"+rndNumber, (item));
rndNumber = rndNumber-1;
}
so, that loads all the pictures the way i want it to, but how would i go about having it wait for all of them to be loaded before it proceeds? i know that i should be able to figure it out, but its just one of those things i cant get to work. thanks
Loading External Jpgs
I'm trying to make an image viewer that loads external jpgs via xml. Can this be saved as a flash 5 player file? I keep getting output error messages saying not in flash 5, but I'm not sure if it's the script that I'm doing wrong or the very fact it's xml. I'm sure most viewers won't have flash 6 player, including the client.
Preloader For External Jpgs
I've looked and looked on the board and I can't find something that works for my situation. I have this movie clip that makes a little frame around a thumbnail image. Inside that frame is an empty clip that holds a thumbnail image loaded from an external folder. Several instances of the framing clip are placed on the stage and they are named sequentially with a for loop (so the first frame is named "01", the next "02" and so on).
When you click a thumbnail, the larger version of the image is loaded into an empty clip called big_holder on the main timeline. The path I've created evaluates the name of the clip that frames the thumbnail so that path looks like this:
loadMovie("images/big_versions/" + _parent._parent._name + "big.jpg", "_root.big_holder");
So, if I had clicked on the clip named "01", the path actually evaluates as: images/big_versions/01.jpg
The problem I have is that I keep trying to do a getBytesLoaded on _root.big_holder and have that displayed in a text field, but it never returns the value for the .jpgs loaded into it. Do I have to tell flash to getBytesLoaded with a precise path for the exact JPG that sits in _root.big_holder? Can someone tell me why running a getBytesLoaded on just the holder wouldn't return new values each time something new gets loaded in there?
Preloading External Jpgs
i'm loading external .jpgs into an empty MC called holder. however, i've searched high and low and i can't find the proper way to set up a preloader to measure the percent of the jpg that is loaded in the empty movieclip. if anyone has a way to get this done i'd be greatly appreciative.
many thanks,
_greg
Loading External Jpgs.
Hi
Im quite new to Actionscript and im having a little trouble. (MX04 - would like to publish as v6)
i want to open a text file to get a variable telling flash how many images to load, then loop through duplicating movieclips and loading the images (images are called 1.jpg, 2.jpg etc)
loadNum = new LoadVars ();
loadNum.onLoad = function (ok)
{
if (ok) {
_root.numPics = _root.loadNum.numb;
//## start duplicating movie clip holder for images
for (i = 1; i <= _root.numPics; i++) {
holder_mc.duplicateMovieClip ("holder_"+i+"_mc", i);
_root["holder_"+i+"_mc"]._x = 150 *i;
_root["holder_"+i+"_mc"].loadMovie ("assets/images_flash/"+i+".jpg" );
}
}
};
loadNum.load ("numpics.txt");
the movie clips are being created , positioned and named as expected, but the images are not showing.
any input would be much appreciated.
thanks
ben
Scroll External Jpgs
Need help with scrolling external jpgs. I want the left edge of the image to start where the left edge of the scrollbar starts. Also, when a new image loads it is in the same place the last one was in, is there a way to have the new image start with the left edge inline with the scrollbar?
Thanks.
.swf:
http://www.christinedesign.com/scroll_test.swf
.fla:
http://www.christinedesign.com/scroll_test.fla
External Jpgs In Netscape
I have this wierd problem
I tested the site i made www.garrettthomasband.com in netscape and the media/pictures page should load pictures into the gallery component with a xml file, but it doesn't
The jpgs load fine in Internet Explore though, Why won't netscape load them.
thanks,
mark
Loading External Jpgs
I am trying to create a movie dynamically, size it, place it in a particular place on a page and then load in a jpg.
I am using the following code on frame 1 to create the movie:
createEmptyMovieClip("PhotoHolder_mc",0);
with (PhotoHolder_mc) {
_width = 550;
_height = 399;
}
PhotoHolder_mc._x=150;
PhotoHolder_mc._y=0;
Farther down in the same frame, I am attempting to load the jpg using the following code:
loadMovie("Blank.jpg", "this.level0.PhotoHolder_mc");
Unfortunately, nothing happens when I play the movie. Anybody have any ideas regading how I can fix this to work? BTW, Blank.jpg is in the same folder as the SWF>
Any help is greatly appreciated.
Sincerely,
Richard
Loading External Jpgs
trying to load 640X480 frame grabs stored as jpgs on a third party site, resize them to 320X240 and incorporate them into a slide show for a web site. trying to create something similar to the large flash movie in the upper left hand corner of the http://www.mtv.com/ site (with Uma Thhurman). Also is there somewhere to find the navigation buttons like that? Sorry about the jumbled question. Any help greatly welcomed
Help With Importing External JPGs
Help.
I am trying to import an external, non-progressive JPG into a banner. I am using the "loadmovie" function, but I am not able to determine the position (x,y) of where my JPG appears. I tried creating a symbol and putting the "loadmovie" action inside the symbol, but it doesnt work. I also tried loading it into a button, and it does appear, but only after the roll over action. How can I make it work and place the JPG in the exact location where I need it inside my flash file?
Thanks a lot!!!
Iliana
Loading External JPGs
Hi
Guys I’m trying to change my website portfolio section from having the jpgs embedded in the swf file, to one that will load the jpgs from an external folder but this is becoming a little bit to complicate it for my actionscript knowledge.
My dilemma now is that the external folder has 23 pictures right now but when moving the mouse up and down over the menu, it jumps from jpg 23 to 16 and back.
http://www.alexcreative.com/qbaMenu/index.html
I want to have an script that could show me all the images when I scroll up and down on mouse over, So not matter the amount of jpgs I drop in the future on the external path “images humbnails” folder it will always scroll all the jpgs if I choose to.
This is the script that is controlling the menu right now:
Code:
// ::::: MovieClip Events
private function onEnterFrame():Void {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
this.$itemsContainer._y = 40-(this._ymouse)-1100;
}
}
}
If some one wants to take a look at the code to help me out to figure out what is wrong, here are copies of the files:
(The actionscript are not embeded on the main ".fla". They are ".as" files at this path: classes/com/alexcreative/Menu.as)
ftp://visitor:visitor@69.195.79.28
I hope some one can help me out to figured out how to change the script so when I scroll up and down on mouse over, it will let me scroll through every jpg if I choose too, (not matter the amount of jpgs I have in the external thumbnail folder)
Thanks
Alex
Loading External Jpgs
hey,
im loading some jpgs on my site n i have this code:
onClipEvent (enterFrame) {
// Fill in your stage width/height
stage_width = 614;
// this stage, not the main stage, the box above, dufus. )
stage_height = 490;
// If this imageholder contains an image , center it
if (this.getBytesLoaded()>=this.getBytesTotal() && this.getBytesTotal()>500) {
centerw = stage_width/2;
centerh = stage_height/2;
this._x = centerw-(this._width/2);
this._y = centerh-(this._height/2);
}
} i want my jpgs to load on the bottom right corner of my mc-- (not in the center) what code do i write instead?
thx u guys!!!! ALOT!
Loading External Jpgs
hey,
im loading some jpgs on my site n i have this code:
onClipEvent (enterFrame) {
// Fill in your stage width/height
stage_width = 614;
// this stage, not the main stage, the box above
stage_height = 490;
// If this imageholder contains an image , center it
if (this.getBytesLoaded()>=this.getBytesTotal() && this.getBytesTotal()>500) {
centerw = stage_width/2;
centerh = stage_height/2;
this._x = centerw-(this._width/2);
this._y = centerh-(this._height/2);
}
} i want my jpgs to load on the bottom right corner of my mc-- (not in the center) what code do i write instead?
thx u guys!!!!
Loading External Jpgs
Hi There,
Just wondering if anyone could shed some light on how to preload an existing jpg for my image previewer.
What i have based very closely to this : tutorial
However i'm wanting to select one of my pictures to load automatically instead of just appearing blank & waiting for someone to press a button.
The main script from that tutorial is here ;
imgbtn1.onRelease = function() {
infoField._visible = true;
startLoading("picture1.jpg");
};
imgbtn2.onRelease = function() {
infoField._visible = true;
startLoading("picture2.jpg");
};
imgbtn3.onRelease = function() {
infoField._visible = true;
startLoading("picture3.jpg");
};
function startLoading(whichImage) {
loadMovie(whichImage, "imageLoader");
_root.onEnterFrame = function() {
infoLoaded = imageLoader.getBytesLoaded();
infoTotal = imageLoader.getBytesTotal();
percentage = Math.floor(infoLoaded/infoTotal*100);
infoField.text = percentage+"%";
if (percentage>=100) {
delete this.onEnterFrame;
infoField._visible = false;
}
};
}
if some could help me with this, it would be appreciated.
cheers
Loading External Jpgs
Hello,
Does anyone know if you load an external jpg into a movie clip, is the image automatically centered onto the clip?
Thanks,
WARD
External Jpgs Not Loading
Hi,
I'm having trouble with code i wrote to create mc's and get external jpgs. I'm not getting any errors, and the script is pulling the jpgs, but the jpgs aren't showing in the swf. I've looked at it for awhile. Another pair of eyes would be GREATLY appreciated.
The project:
http://www.nicolerae.com/kslphoto/home.html
(It's a 20-30 second load time on a cable modem, which is why i've opted to create mc's and get external jpgs on the fly).
I wrote code to createEmptyMovieClip and loadMovie (jpgs), as well as get widths of the jpgs and adjust _x values of the mc's (to create a string of photos that work like the Barney's relative scroller). The code exists in a mc called TheMovieClip.
PHP Code:
_root.onLoad = function() {
for(x=1;x<=32;x++) {
i = x - 1;
if(i <= 9) {
item_i = "0"+i;
}
else {
item_i = i;
}
if(x <= 9) {
item_x = "0"+x;
}
else {
item_x = x;
}
_root.TheMovieClip.createEmptyMovieClip("photo"+item_x, x);
this_holder = "_root.TheMovieClip.photo"+item_x;
trace(this_holder);
this_holder.loadMovie("photos/"+item_x+".jpg");
if(x == 1) {
this_holder._x = 0;
}
else {
prev_holder = "_root.TheMovieClip.photo"+item_i;
new_left = prev_holder._x + prev_holder._width;
this_holder._x = new_left;
}
}
}
Loading External Jpgs
Hi,
I have a flash movie that loads in external Jpgs.
It works completely fine in Movie Preview but when I view the movie in a browser - none of the images load.
Does anyone know what Im missing?
Thanks,
Pete
Preloading External Jpgs
I have a main swf file that has 2 frames. On frame one I have the following code on an Mc
ActionScript Code:
onClipEvent (load) {
if (_parent.getBytesTotal() == _parent.getBytesLoaded()) {
quickPlay = true;
} else {
preLoad = (_parent.getBytesTotal() * 0.75); //percent to preload
}
_parent.stop();
}
onClipEvent (enterFrame) {
gotoAndStop(loadedIndicatorFrame());
if (quickPlay == true) { //quickly play the anim
if (_currentframe == _totalframes) {
_parent.play();
}
} else { //wait for the preload
if (_parent.getBytesLoaded() >= preLoad) {
_parent.play();
}
}
}
On the second frame is just my images.
This is working fine except for the fact that I want to load jpgs from an external file now instead of from inside my swf so the preloader is only preloading my internal files not the stuff from the outside. How would I modify this code?
As3 Loaded External Jpgs
developing a ui in flash for photo gallery which I am loading into dreamweaver.
using as3 in flash to load external photo files so not all having to download on opening.
have had no problem in dreamweaver with swfs with embedded jpgs.
ui comes up in dreamweaver but not external files. even though when I open swf movie or the flash created html of same file, on its own, no prob.
anyone run across this problem, jpgs are in same file as flash media, also dropped them into image file just in case that might work---no go
any ideas ?
Loading External JPGs
I'm building a generic slideshow. The slideshow displays NINE buttons. Each button, when clicked, will load a corresponding external JPG. For example, if I click BUTTON THREE then JPG THREE is loaded. BUTTON TWO loads JPG TWO, etc.. I'm looking for a way to "recognize" if there are FEWER available JPGs than the NINE BUTTONS in my slideshow. For example, if I have just FIVE JPGs available and I click on button number SEVEN, I want nothing to happen. At the moment I get an error message that JPG SEVEN does not exist.
Need To Load External Jpgs At Once
I am using loadMovie to load all my external jpgs at once. On start I have thumbnails which animates, and using loadMovie load jpgs into that thumbnails. Offline it works fine, but online it only loads few jpgs first with animation and rest loads without animation just blink and loads. can you help me out for this.
this is my sample page link:
http://suewong.yourdemowebsite.com/editorial.htm
Edited: 10/07/2007 at 11:52:55 PM by bhavesh_int
Loading External Jpgs
how can you load external Jpgs into a swf instead of loading them and compiling the swf. so that they appear in the cache. Whats the function to do this, or is there a tut?
|