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




Get Images Randomly In Flash Through A XML File



Hello All,I want to get some images randomly through a XML file for this type of work i have a folder called "images" in which i store some images and i create a xml file and the code is :<gallery><image main="images/pic2_1.jpg" /><image main="images/pic2_2.jpg" /><image main="images/pic2_3.jpg" /><image main="images/pic2_4.jpg" /><image main="images/pic2_5.jpg" /><image main="images/pic2_6.jpg" /><image main="images/pic2_7.jpg" /><image main="images/pic2_8.jpg" /><image main="images/pic2_9.jpg" /><image main="images/pic2_10.jpg" /></gallery>I want to get these images in my flash file randomly from my "images" folder so that the client can add and remove photos as they require only by change the name of images in XML file .Now i want the action script code for this type of work.Is this possible? Any help on this issue would be greatly appreciated.



KirupaForum > Flash > Flash 8 (and earlier)
Posted on: 06-20-2007, 09:51 AM


View Complete Forum Thread with Replies

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

Loading External Images Randomly, Getting The Amount Of Images Out A *.txt
hello there!


i've made an a script that loads images externaly from a specific map
randomly. there's only one thing:


how can flash learn to know how many images are loaded?


it's for a client so he can only upload the images and that's it.
can he somehow fill in a *.txt-file that flash can use further???


this is my sourcecode for the external-stuff:

code:

_root.importImage = "background_netomzet"+random(*)+".jpg";



(the * has to be a value that needs to be generated by how many pics
there are in the image map")


thanks a million people!


g

Loading A Flash File Randomly
how can I code flash files to randomly load each time the webpage is accessed?

Generate Images Randomly
hi,

i have a set of images(around 5) which need to movein randomly in a limited area (specific width and height).and this random generation can be for almost 30 secs with a gradual speed increase.how can i do this?

Randomly Cycling Of Images....
May I noe if there is any flash example or anyone noe how to make images cycling very fast, then one of the images will zoom out for a while, then continue the procedure again but now display out another image.... Something like random letter cycling.... Thanx in advance....

PS. I'm using flash mx....

Calling Images Randomly
I'm not sure how many posts are like this (the search isn't working for me, sorry), but I need specific actionscript. I'm making a game and I need it so if you buy someone an item (such as a hat), and then later you buy them another, they randomly switch between them each time you run into them. It would be for clothing and everything else, too. I hope someone can help me on this, I use Flash MX btw. I'm not too bad at actionscript, but I never understood the "random" actionscript, if someone has a tutorial for it as well, that would help

Thanks,
-Tobunshi
(www.harshstudios.com)

[F8] Randomly Loaded Images
Hello there, I was originally going to post this in the Actionscript area, but after reading some of the posts my question appears to be much too simple to warrant it's inclusion among such complicated scenarios, I suspect the solution to mine is much simpler. So here goes..

I want to have some movie clips that will randomly load images from a specified image folder, every time the is brought to this specific frame, they would encounter a new series of images. I'm familiar with using a move clip loader, and I know there are ways to make things random within Flash.

What I'm not sure about, however, is how to integrate the two, where if perhaps I had a folder of image001.jpg, image002.jpg, etc. that I could use something which would select these images randomly - this is still in it's conceptual stages at the moment, but any input would be appreciated greatly. Much thanks.

Load Images Randomly
I got this XML slideshow.

My xml looks like this:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>

<images>
<pic>
<image1>billeder/1.jpg</image1>
<image2>billeder/2.jpg</image2>
<image3>billeder/3.jpg</image3>
<image4>billeder/4.jpg</image4>
</pic>
<pic>
<image1>billeder/5.jpg</image1>
<image2>billeder/6.jpg</image2>
<image3>billeder/7.jpg</image3>
<image4>billeder/8.jpg</image4>
</pic>
<pic>
<image1>billeder/1.jpg</image1>
<image2>billeder/2.jpg</image2>
<image3>billeder/3.jpg</image3>
<image4>billeder/4.jpg</image4>
</pic>
</images>


Right nok my script gets the four images that are in <pic> and fade's them ind at the same time....

And after x seconds it does it all over again.

What i would like it to do is after the four images are faded in, then it only should change one image at a time, which should be randomly...

My script at the MainTimeline in AS layer:

_root.p = 0;

function loadXML(loaded) {
//If XML is loaded
if (loaded) {
var xmlNode = this.firstChild;
image1 = [];
image2 = [];
image3 = [];
image4 = [];
_root.total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image1[i] += xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
image2[i] += xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
image3[i] += xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
image4[i] += xmlNode.childNodes[i].childNodes[3].firstChild.nodeValue;
}
upDatePic();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;

//xmlData.load("/site/utils/toppics.asp?doc_id="+doc_id);
xmlData.load("images.xml");

//Preload
this.onEnterFrame = function() {
filesize = picture1.getBytesTotal();
loaded = picture1.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {

preloader._visible = false;
//If pictures alpha is smaller then 100, then fade i up
if (picture1._alpha < 100) {
picture1._alpha += 3; //Hastighed, jo størrere, jo hurtige vil billedet bliver vist
}
if (picture2._alpha < 100) {
picture2._alpha += 3; //Hastighed, jo størrere, jo hurtige vil billedet bliver vist
}
if (picture3._alpha < 100) {
picture3._alpha += 3; //Hastighed, jo størrere, jo hurtige vil billedet bliver vist
}
if (picture4._alpha < 100) {
picture4._alpha += 3; //Hastighed, jo størrere, jo hurtige vil billedet bliver vist
}
}
}

//Updates picture
function upDatePic (){

if (loaded == filesize) {
picture1._alpha = 0;
picture1.loadMovie(image1[p],1);

picture2._alpha = 0;
picture2.loadMovie(image2[p],2);

picture3._alpha = 0;
picture3.loadMovie(image3[p],3);

picture4._alpha = 0;
picture4.loadMovie(image4[p],4);

picture_num();

}
}

function picture_num() {
current_pos = p+1;
pos_txt = current_pos+" / "+total;
}

-------------------------------------------
MovieClip Timer (AS Layer)

if (_root.p < (_root.total-1)) {
_root.p = _root.p += 1;
} else {
_root.p = 0;
}
_root.upDatePic();



Hope you can help, if you dont quite understand the question, the script can be downloaded at : www.playart.dk/toppics.rar

Loading Images Randomly
Hello! I need some help. I'm making a game for my class and I'm REALLY not to sharp on the action script stuff. I'm completely lost when it comes to it. If you can help me i'd very much appreciate it! I don't even know where to start.

My game is like photo hunt/spot the diff. If you never heard of it or played its a game where you have one picture and an other picture right next to it and is the same thing only with things missing and changed.

what i need help in is how do make sure that the original picture loads randomly with the modified pictures also randomly(because i'll have 5 modified images with different things changed in them) It also has to be timed and keep score. Im mostly worried about getting the pictures to load. I thought of using arrays.. or load pictures in empty movie clips but I can't seem to get it out in action script

if anyone can help a girl out please let me know..reply or message me. Thanks

Randomly Cycling Of Images....
May I noe if there is any flash example or anyone noe how to make images cycling very fast, then one of the images will zoom out for a while, then continue the procedure again but now display out another image.... Something like random letter cycling.... Thanx in advance....

Load Images Randomly
I got this XML slideshow.

My xml looks like this:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>

<images>
<pic>
<image1>billeder/1.jpg</image1>
<image2>billeder/2.jpg</image2>
<image3>billeder/3.jpg</image3>
<image4>billeder/4.jpg</image4>
</pic>
<pic>
<image1>billeder/5.jpg</image1>
<image2>billeder/6.jpg</image2>
<image3>billeder/7.jpg</image3>
<image4>billeder/8.jpg</image4>
</pic>
<pic>
<image1>billeder/1.jpg</image1>
<image2>billeder/2.jpg</image2>
<image3>billeder/3.jpg</image3>
<image4>billeder/4.jpg</image4>
</pic>
</images>


Right nok my script gets the four images that are in <pic> and fade's them ind at the same time....

And after x seconds it does it all over again.

What i would like it to do is after the four images are faded in, then it only should change one image at a time, which should be randomly...

My script at the MainTimeline in AS layer:

_root.p = 0;

function loadXML(loaded) {
//If XML is loaded
if (loaded) {
var xmlNode = this.firstChild;
image1 = [];
image2 = [];
image3 = [];
image4 = [];
_root.total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image1[i] += xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
image2[i] += xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
image3[i] += xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
image4[i] += xmlNode.childNodes[i].childNodes[3].firstChild.nodeValue;
}
upDatePic();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;

//xmlData.load("/site/utils/toppics.asp?doc_id="+doc_id);
xmlData.load("images.xml");

//Preload
this.onEnterFrame = function() {
filesize = picture1.getBytesTotal();
loaded = picture1.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {

preloader._visible = false;
//If pictures alpha is smaller then 100, then fade i up
if (picture1._alpha < 100) {
picture1._alpha += 3; //Hastighed, jo størrere, jo hurtige vil billedet bliver vist
}
if (picture2._alpha < 100) {
picture2._alpha += 3; //Hastighed, jo størrere, jo hurtige vil billedet bliver vist
}
if (picture3._alpha < 100) {
picture3._alpha += 3; //Hastighed, jo størrere, jo hurtige vil billedet bliver vist
}
if (picture4._alpha < 100) {
picture4._alpha += 3; //Hastighed, jo størrere, jo hurtige vil billedet bliver vist
}
}
}

//Updates picture
function upDatePic (){

if (loaded == filesize) {
picture1._alpha = 0;
picture1.loadMovie(image1[p],1);

picture2._alpha = 0;
picture2.loadMovie(image2[p],2);

picture3._alpha = 0;
picture3.loadMovie(image3[p],3);

picture4._alpha = 0;
picture4.loadMovie(image4[p],4);

picture_num();

}
}

function picture_num() {
current_pos = p+1;
pos_txt = current_pos+" / "+total;
}

-------------------------------------------
MovieClip Timer (AS Layer)

if (_root.p < (_root.total-1)) {
_root.p = _root.p += 1;
} else {
_root.p = 0;
}
_root.upDatePic();



Hope you can help, if you dont quite understand the question, the script can be downloaded

Randomly Cycling Of Images....
May I noe if there is any flash example or anyone noe how to make images cycling very fast, then one of the images will zoom out for a while, then continue the procedure again but now display out another image.... Something like random letter cycling.... Thanx in advance....

Images Randomly/Pause
I got this XML slideshow.

My xml looks like this:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>

<images>
<pic>
<image1>billeder/1.jpg</image1>
<image2>billeder/2.jpg</image2>
<image3>billeder/3.jpg</image3>
<image4>billeder/4.jpg</image4>
</pic>
<pic>
<image1>billeder/5.jpg</image1>
<image2>billeder/6.jpg</image2>
<image3>billeder/7.jpg</image3>
<image4>billeder/8.jpg</image4>
</pic>
<pic>
<image1>billeder/1.jpg</image1>
<image2>billeder/2.jpg</image2>
<image3>billeder/3.jpg</image3>
<image4>billeder/4.jpg</image4>
</pic>
</images>


Right nok my script gets the four images that are in <pic> and fade's them ind at the same time....

And after x seconds it does it all over again.

What i would like it to do is after the four images are faded in, then it only should change one image at a time, which should be randomly...

My script at the MainTimeline in AS layer:

_root.p = 0;

function loadXML(loaded) {
//If XML is loaded
if (loaded) {
var xmlNode = this.firstChild;
image1 = [];
image2 = [];
image3 = [];
image4 = [];
_root.total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image1[i] += xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
image2[i] += xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
image3[i] += xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
image4[i] += xmlNode.childNodes[i].childNodes[3].firstChild.nodeValue;
}
upDatePic();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;

//xmlData.load("/site/utils/toppics.asp?doc_id="+doc_id);
xmlData.load("images.xml");

//Preload
this.onEnterFrame = function() {
filesize = picture1.getBytesTotal();
loaded = picture1.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {

preloader._visible = false;
//If pictures alpha is smaller then 100, then fade i up
if (picture1._alpha < 100) {
picture1._alpha += 3; //Hastighed, jo størrere, jo hurtige vil billedet bliver vist
}
if (picture2._alpha < 100) {
picture2._alpha += 3; //Hastighed, jo størrere, jo hurtige vil billedet bliver vist
}
if (picture3._alpha < 100) {
picture3._alpha += 3; //Hastighed, jo størrere, jo hurtige vil billedet bliver vist
}
if (picture4._alpha < 100) {
picture4._alpha += 3; //Hastighed, jo størrere, jo hurtige vil billedet bliver vist
}
}
}

//Updates picture
function upDatePic (){

if (loaded == filesize) {
picture1._alpha = 0;
picture1.loadMovie(image1[p],1);

picture2._alpha = 0;
picture2.loadMovie(image2[p],2);

picture3._alpha = 0;
picture3.loadMovie(image3[p],3);

picture4._alpha = 0;
picture4.loadMovie(image4[p],4);

picture_num();

}
}

function picture_num() {
current_pos = p+1;
pos_txt = current_pos+" / "+total;
}

-------------------------------------------
MovieClip Timer (AS Layer)

if (_root.p < (_root.total-1)) {
_root.p = _root.p += 1;
} else {
_root.p = 0;
}
_root.upDatePic();


----------------------------------------------

I've tried to pause some of the movieclips, so that i could get a delay at some of the images, but without any luck !


Hope you can help, if you dont quite understand the question, the script can be downloaded: www.playart.dk/toppics.rar

Randomly Appearing Images
New to flash and the learning curve is high, but loving it!

I'd like to learn how my opening page can ramdonly load an image from a selection.

So that every time the "first" pages loads, a new image appears.

I'd like to learn for myself but don't know where to look.

Cheers.

Randomly Changing Images
Last edited by pimp : 2005-05-18 at 01:42.
























I am wanting to create a flash movie that will take randomly selected images from a folder and place them into the swf


This screenshot shows the idea im trying to do:
http://www.alistairchisholm.co.uk/banner1.jpg

I am trying to create this with the images on the left and right fading from 1 randomly selcted image to the next.

Ideally, i would be able to add/remove images into this folder and it would still work.

I'm still developing my flash skills and have a fair idea that this is possible, but i wouldn't know how to implement it completely

any advice?

Loading Images Randomly
hi all,
I have just been trying to fic this bit of code so that it will load a random image in the holder on the timeline then wait 5 seconds then load a new one.

Here is the code
Code:

stop();

import mx.transitions.Tween;
import mx.transitions.easing.*;

//HeaderClip Code
var randNum:Number = Math.floor(Math.random() * 9);

var li = setInterval(startLoadNewImage,0);   

function startLoadNewImage()
{
   var holdTween:Tween = new Tween(headerImage,"_alpha",Strong.easeOut,headerImage._alpha,0,1,true);
   Holder.imageLoader.unloadMovie();
   Holder.imageLoader.loadMovie("/images/header/image[randNum].png");
   var holdTween:Tween = new Tween(headerImage,"_alpha",Strong.easeOut,headerImage._alpha,100,1,true);
   var ni = setInterval(loadNewImage,5);
}

function loadNewImage()
{
   var holdTween:Tween = new Tween(headerImage,"_alpha",Strong.easeOut,headerImage._alpha,0,1,true);
   Holder.imageLoader.unloadMovie();
   Holder.imageLoader.loadMovie("/images/header/image[randNum].png");
   var holdTween:Tween = new Tween(headerImage,"_alpha",Strong.easeOut,headerImage._alpha,100,1,true);
   var ni = setInterval(startLoadNewImage,5);
}

Any help would be very much appreciated.

Randomly Load External Images
hi,

on my stage are several empty clips (content1, content2....), now I I want to load in them small jpegs (external or internal??) which are changing in a regular period but randomly into the various content clips?

Any Idea?

thanks...

Loading Images Externally And Randomly (?)
I'm having some difficulties here. I have two swf's, one controls the other---not the problem. On the one swf there are buttons and the other are images, you rollover a btn a different image pops up...you get the point. Now, on the swf with the images--I am trying to have the images load exteranlly, but also randomly. Is this possible?

Any suggestions would be greatly appreciated.
thanks,
hutch

Randomly Load Images From An External Source
Hi
I am making a movie in which I want to randomly load pictures in an MC. The pictures have to be loaded from an external source (from different URLs). The pictures should change every 60 seconds or so. The mc is about_scenes. The actions have been placed in the 3rd layer from bottom (named actions) on frame 30. However, there is some error in scripting as the pictures are not getting loaded. I will be grateful for any help in this regard.
Thanks!
anbis
PS I have deleted all the jpg images as the file was becoming too big.

Smart Way To Handle 450 Images Loading Randomly..
I have an interesting problem to solve. I need to create a Flash based slideshow that randomly displays about 450 full screen images. Simple "next" control is sufficient for nav. Problem is all images HAVE to be embedded in Flash(cannot pull from external folder). Essentially, I can only have one large swf file. Any ideas about how to make this as dynamic as posible with the above constraints?

thanks a bunch

Randomly Load External Images (or Swf) Into A Master SWF?
hey all...so i read the tutorial on randomly loading backgrounds that kirupa has up, but i just wanted to see if anyone knew a better way to get a set of say maybe 10 photos or SWFs (just simple jpgs in a flash movie) that are in an external directory to load into one single flash movie...basically if you look at the link below you'll get a better idea...my client doesn't want the sam eimages to load at teh beginning of teh animation so none of the girls get catty about facetime so i need a way to have an image bank and just have the images be called randomly...please take a look and tell me what you think...oh btw i am using mx 2004 and i would like to avoid php if at all possibel haha! thx in advance

http://www.ganymedepress.com/code

Randomly Load External Images (or Swf) Into A Master SWF?
hey all...so i read the tutorial on randomly loading backgrounds that kirupa has up, but i just wanted to see if anyone knew a better way to get a set of say maybe 10 photos or SWFs (just simple jpgs in a flash movie) that are in an external directory to load into one single flash movie...basically if you look at the link below you'll get a better idea...my client doesn't want the sam eimages to load at teh beginning of teh animation so none of the girls get catty about facetime so i need a way to have an image bank and just have the images be called randomly...please take a look and tell me what you think...oh btw i am using mx 2004 and i would like to avoid php if at all possibel haha! thx in advance

http://www.ganymedepress.com/code

Dyanamically Loading Images Randomly From The Movie Clip
hi,
i had developed a flash file of 300*75 dimensions, and i created 7 movie clips of same dimensions 140*75 and are scrolling from right to left and the images will be dynamically loaded from a folder outside.
Here my question is when the images are moving from right to left ie., image 1 to image 7 moving the image 1 should have to become as image 8 and so on from the same folder .
can any body help in this regard.
Thanks and Regards
srinivas balla

Randomly Selected Images (duplicate Posts Merged)
I posted about this problem the other day, but have since modified my code.

I'm making a movie that is a grid of images which fade in and out randomly. Each box movieclip in the grid is named box0 through box29. Each box movieclip contains image movieclips named image0 through image8.

Does my code make sense? Right now, my movie does nothing. But it is running through the code, because the traces come up. I would really really appreciate your help. Thanks!


Here is my code:


function randRange(min:Number, max:Number) :Number{
trace("random number");
var randomNum:Number = Math.floor(Math.random() * (max - min + 1)) + min;
return randomNum;
} //CLOSE randRange

_root.onEnterFrame = function()
{
trace("begin");
for (var i = 0; i < 30; i++)
{
trace("box");
var nm = "box" + i; //go through the thirty boxes
var nm2 = "image" + (randRange(0,8)); //Pick one of the 9 images in the box

trace("image");

for(i in _root)
{
clp = eval(i)
if (clp instanceof MovieClip)
{
clp.onEnterFrame = function()
{
if (this._currentframe == 1)
{
if ((randRange(0, 99)<50))
{
this.play();//Play 50% of the time
}//CLOSE if
} //CLOSE if

else if (this._currentframe == 20)
{
if ((randRange(0, 99)<50))
{
this.play(); //Finish movie clip 50% of the time
} //CLOSE if
} //CLOSE else if
}//close clp.onenterframe
}//close if
}//close for (i in _root)
}//close for (var i = 0; i < 30; i++)
}//close root.onEnterFrame

[fmx04] Loading Images Randomly And Put Them In _x And _y Coordinates Problem
hi,

I have a problem with loading images randomly and putting them in the right _x and _y coordinates.
I have a swf file with in the first frame a button with this code :

on (release) {
filename = ["image-01.jpg", "image-02.jpg", "image-03.jpg"];
path = "images/";
i = filename.length;
k = Math.floor(Math.random()*i);
mctarget.loadMovie(path+filename[k]);
gotoAndPlay("intropreloadit");
}

in frame 10 I have this code for preloading the dynamically loaded image :

// set the movieclip invisible
mctarget._visible = false
// get the loaded and total bytes
total = mctarget.getBytesTotal();
loadedbytes = mctarget.getBytesLoaded();
percentage = Math.floor((loadedbytes/total)*100);
// when dynamically loading, make sure you set getbytesLoaded()>0
if (mctarget.getBytesLoaded()>0) {
// set the progressbar
mcprogressbar._xscale = percentage;
// set the percentage dynamic textfield
mcprogresstxt.perc = percentage+"%";
} else {
mcprogressbar._xscale = 0;
mcprogresstxt.perc = 0+"%";
mcprogresstxt.bytestotal = Math.floor(total/1000) + " KB";
mcprogresstxt.bytesloaded = Math.floor(loadedbytes/1000) + " KB /";
}

in frame 11 :

if (percentage == 100) {
gotoAndStop("introdoneloading");
} else {
gotoAndPlay("intropreloadit");
}

and in frame 12 :

// done loading image so now we can position the image.
// centerpoint of the movieclip "mctarget" to be set as you wish.
x = 640;
y = 230;
// now we get the size of the image
introwidth = mctarget._width;
introheight = mctarget._height;
// finally, set new _x and _y position to center the image to the centerpoint
mctarget._x = x-(introwidth/2);
mctarget._y = y-(introheight/2);
/* ready with loading of the .jpg file --> then set mctarget._visible = false of true */
mctarget._visible = true
stop();

the image gets loaded and placed correctly when played from the harddisk. the problem starts when i upload the swf to the internet, then the image won't be centered but the left upper point of the image is placed at x=640 and y=230

what am I doing wrong?
max.

[fmx04] Loading Images Randomly And Put Them In _x And _y Coordinates Problem
hi,

I have a problem with loading images randomly and putting them in the right _x and _y coordinates.
I have a swf file with in the first frame a button with this code :

on (release) {
filename = ["image-01.jpg", "image-02.jpg", "image-03.jpg"];
path = "images/";
i = filename.length;
k = Math.floor(Math.random()*i);
mctarget.loadMovie(path+filename[k]);
gotoAndPlay("intropreloadit");
}

in frame 10 I have this code for preloading the dynamically loaded image :

// set the movieclip invisible
mctarget._visible = false
// get the loaded and total bytes
total = mctarget.getBytesTotal();
loadedbytes = mctarget.getBytesLoaded();
percentage = Math.floor((loadedbytes/total)*100);
// when dynamically loading, make sure you set getbytesLoaded()>0
if (mctarget.getBytesLoaded()>0) {
// set the progressbar
mcprogressbar._xscale = percentage;
// set the percentage dynamic textfield
mcprogresstxt.perc = percentage+"%";
} else {
mcprogressbar._xscale = 0;
mcprogresstxt.perc = 0+"%";
mcprogresstxt.bytestotal = Math.floor(total/1000) + " KB";
mcprogresstxt.bytesloaded = Math.floor(loadedbytes/1000) + " KB /";
}

in frame 11 :

if (percentage == 100) {
gotoAndStop("introdoneloading");
} else {
gotoAndPlay("intropreloadit");
}

and in frame 12 :

// done loading image so now we can position the image.
// centerpoint of the movieclip "mctarget" to be set as you wish.
x = 640;
y = 230;
// now we get the size of the image
introwidth = mctarget._width;
introheight = mctarget._height;
// finally, set new _x and _y position to center the image to the centerpoint
mctarget._x = x-(introwidth/2);
mctarget._y = y-(introheight/2);
/* ready with loading of the .jpg file --> then set mctarget._visible = false of true */
mctarget._visible = true
stop();

the image gets loaded and placed correctly when played from the harddisk. the problem starts when i upload the swf to the internet, then the image won't be centered but the left upper point of the image is placed at x=640 and y=230

what am I doing wrong?
max.

Randomly Loading Images Into Stage Thro Action Script?
Hi Friends,

I am new to this group. I have a query here. I would like to create a movie clip in flash for my website. In that movie clip, one symbol(which is the series of 5 to 6 image files), will just move across. Whenever the movie runs, it should get 5 different image files and perform the motion tween. i need to know how to get 5 images randomly from a folder into stage using action script. Can anyone give me an idea???

Regards,

Basky

Image Slice Transition With Dynamically Loaded Images And Randomly Sized Masks
Any idea how to get this image slice transition with dynamically loaded images and randomly sized masks?
http://www.dbox.com/index2.html

Here is the previous thread with code that should but does not work.
http://www.actionscript.org/forums/s....php3?t=141219

DuplicateMovieClip, And Randomly Picking A File In A Directory
Hello everyone,
This is my first post, and as I have seen thus far everyone here is quite helpful. I have searched through the forums to find the solution to my problem and haven't found the solution. I'm sure it might be burried, if you can post to the thread, or solve the problem for me, I would appreciate that very much.

My problem is as follows; I am trying to write a slide show like Flash Movie, what it does (or is supposed to do) load a random image(JPG) from a directory using the loadMovie() function to the Movie Clip LoadingMovie. Then I want to copy LoadingMovie to a new Movie Clip (when it's loaded) to DisplayMovie (another Movie Clip). The reason I want to do this, is so that it can be loading the next movie clip while it's fading in, showing, and fading out of the current movie clip. When the next one is loaded, then it will shift over to DisplayMovie, fade in, stay as long as it should, while the next begins to load, and then fade out, this will continue indefinatly.

Currently, I have it so it loads an image (I still need to add code to randomly pick a JPG from a designated directory, so if you can help here please post). This loaded image is then displayed on the screen (It will be hidden later on).

I'm having a problem getting duplicateMovieClip to work. I am new to Flash's Action script. Please review my code and give me input on why it's not displaying on the screen at all. I don't receive any errors, but nothing happens as far as the duplicateMovieClip is concerned.

code:
//------------------------------
//Program Defines
//------------------------------
_global.TimeToFadeIn = 48; //Time it takes to fade in in Frames
_global.TimeToFadeOut = 48;//Time it takes to fade out in frames
_global.TimeToStayStatic = 120; //Time it stays on the screen before displaying new picture
//------------------------------
//Globals
//------------------------------
_global.CurrentFrame = -1; //Keeps Track of the current frame
_global.OnMovie = 1; //Tells which movie it is on
_global.TimeOnMovie = 0;//Tells how long it was on the particular movie
_global.FadingIn = false;//Specifies if it's fading in
_global.FadingOut = false;//Specifies if it's fading out
//------------------------------
//Test To see if Loaded Function
//------------------------------
_global.IsLoaded = function()
{
if(LoadingMovie.getBytesLoaded() == LoadingMovie.getBytesTotal())
{return true; }
else
{return false;}
}
//------------------------------
//Load Movie to the specified movie
//------------------------------
_global.LoadRandomJPG = function()
{
//Going to need to add something that gets the random file
loadMovie("RandomImages/paver.jpg", "LoadingMovie");
}

//---------------------------------
//Where the Animation Script Starts
//---------------------------------
_root.onEnterFrame = function() // _root main movie timeline, when movie starts call function
{
if (CurrentFrame == -1) //This is the init section
{
LoadRandomJPG(); //Load the first image
}
else //Current Frame is not -1 so it's not told to load
{
if (IsLoaded())//If Image is Loaded, then let's copy it over to DisplayMovie, and fade it in
{
//Dupliacate the Movie, Remember to remove it before making next.
duplicateMovieClip (_root.LoadingMovie, "DisplayMovie", 1);
DisplayMovie._visible = true;
DisplayMovie._alpha = 100;
DisplayMovie._width = 128;
DisplayMovie._height = 100;
DisplayMovie._x = 0;
DisplayMovie._y = 0;
}
}


CurrentFrame++;
}

Thanks in Advance!
-Chris

As I said before, I'm new to Action Script, so please correct my method if it's completely wrong.

Problem With Loading The Text File Randomly
Hai Yall,

Loading the text file to display the content in movie and this text file to be updated every 5 min's with hot news and movie displaying the contents perfectly and the latest news. For this i placed code to show the new updated text file by randomly by :

loadVariablesNum("330_hdl.txt?"+Math.random()*999, _target);

its working fine to show the updated content, But i would like to change background color of dynamic text box for important headlines. I'm not able to do that with the above code.

So for changing the background color of dynamic text box through passing variable from text file, I've placed the following code:

myData = new LoadVars();
myData.onLoad = addItems;
myData.load("330_tophdl.txt");
function addItems() {
myText.textColor = myData.myTextColour;
myText.background = true;
myText.backgroundColor = myData.myTextBGColour;
myText.text = myData.content;
}
Now the text box background color is changing. But now what i've problem is that Movie is not displaying the updated color in Internet Explorer But the updated contents are displaying automatically by using the random code. So i would like to change the background color by accessing the textfile by random code or anyway movie should display the updated text file without closing and opening IE.

What u think and solution for this. If u've pls help me, Thx for reading my problem and i hope u'll give solutions.

thx
sathish

How To Randomly Load External File Content?
I want to randomly load the content from an external text file into a text area. Below is the content of textarea_content.txt:
-----------------------------------------------------------
mytext0=This message is from mytext 0
&mytext1=this message is from mytext 1
&mytext2 = this message is from mytext2
-----------------------------------------------------------

"mytextbox" is the name of textarea

Could somebody take a look at the following code and tell me how to attach variable "myNum" to "this.mytext" to make it randomly load the message from mytext0 or mytext1 or mytext2?

*********************************************
var myNum:Number = random(2);

loadtextContent = new LoadVars();
loadtextContent.load("textarea_content.txt");
loadtextContent.onLoad = function(success) {
if (success) {
mytextbox.text = this.mytext;
}
};


********************************************

One Master File To Randomly Load Multiple .swf Files
I am very new to using these forums, I have searched and searched and it seems I can't find any other threads to help me. I am a novice when it comes to anything beyond basic actionscript so I'm hoping for some help. I am creating a website that will have approx. 4 banner ads (.swf files) that need to randomly load every time the page is refreshed. I have a vague idea of what I need to do but I am really not sure about the exact coding. I would love for someone to tell me exactly what code I need and where I need to put it. I know the best idea is to use a master file to load these and probably an array but I just don't know how it should all look. Hoping to getting some feedback!

Loading Text File Randomly To Display The Updated Contents
Hai Yall,

Loading the text file to display the content in movie and this text file to be updated every 5 min's with hot news and movie displaying the contents perfectly and the latest news. For this i placed code to show the new updated text file by randomly by :

loadVariablesNum("330_hdl.txt?"+Math.random()*999, _target);

its working fine to show the updated content, But i would like to change background color of dynamic text box for important headlines. I'm not able to do that with the above code.

So for changing the background color of dynamic text box through passing variable from text file, I've placed the following code:

myData = new LoadVars();
myData.onLoad = addItems;
myData.load("330_tophdl.txt");
function addItems() {
myText.textColor = myData.myTextColour;
myText.background = true;
myText.backgroundColor = myData.myTextBGColour;
myText.text = myData.content;
}
Now the text box background color is changing. But now what i've problem is that Movie is not displaying the updated color in Internet Explorer But the updated contents are displaying automatically by using the random code. So i would like to change the background color by accessing the textfile by random code or anyway movie should display the updated text file without closing and opening IE.

What u think and solution for this. If u've pls help me, Thx for reading my problem and i hope u'll give solutions.

thx
sathish

Help With Images In Flash File
Hi there,

Hoping someone can help.
I am building a flash file for a banner advert. it is very simple, just 5 images o a loop. The problem is, I have been given a strict restrictions of only 50KB.
The images I have imported in the library and using seem to be too bit, however I have tried everything to reduce them. Bitmap files etc.
Changing the bitmaps into vector by tracing the bitmap, but it gets larger.

I have downloaded Inkscape, as I was reading I need to import vector files, but have no idea what extension to have them as.
I don;t use illustrattor - only photoshop.

At the moment the file is still small, approx 200KB, but I still need to get i tiny for the ad specs...

Any help? Willing to pay with paypal if someone can really help me out???

I have alos been asked to supply a gif forma that won't exceed 20KB, and will be used as a back up??? How can I get my file this small!?

Desperate for some guidance...

Saving Images To File From Flash
what is the easiest way to allow a frame to be saved to a file, and how do you specify a format?

Using Variable Images In A Flash File?
Hi, i made this flash file in which the user can switch between three different images on his desktop....only problem is i don't know how to let the user choose his own images instead of using the three i provide...Please help!

Opening Images From CD-ROM Flash File
I created a flash based slideshow for a website. In the slideshow, there is an option to click on a button to open up a new browser window where the slideshow image is shown at a larger size. To do this, i attached a

on (release) {
getURL("images/161603_xbig.jpg", "_blank");
}
to the button. Everything works fine.

Now I want to take the flash slideshow, and put it onto a CD with an auto-launcher. When I open the flash file from my computer (using Flash Player) and click on the button to view the larger image in a browser window, nothing happens. My browser is brought to the front, but nothing opens. Do i need to assign a new action if I am running the slideshow locally? Any suggestions? Thanks!

Flash File Calling Images
I'm trying to make this flash file easier for someone who doesn't know Flash to edit. Look at this Banner. Now is there a way to get the flash file to call images on the FTP and have it positioned and transition like it does right now? That way the person can just upload new pictures with the same name as the old files and it will be updated.

Variable Images Within A Flash .swf File
Hey

just wondering if anyone knows a way of creating a .swf file that contains a image from a specific address ie http://wwwmydomain.com/images/image001.jpg and if i change the image stored on the server the image within flash file will also change.

Im creating it for a banner that displays a scolling list of product images, but the customer needs to be able to change the images and the description without editing the flash file?

Also does anyone know how i would go about solving, being able to change the description, is it possible to include the contents of a html file in flash and have it change as the html file changes?

i know this could be easily be implemented using javasscript and css, but i would prefer to use the presentational advantages of flash

any help would be gr8

thx DB4zz -<(-_-)>-

Loading The Images By XML File In Flash
i have created the image gallery. The source of the images are actually from scrapping the websites. ie. when i give the particular url of the webpage it will give all the images that are in the website. The output is in form of the XML file. What the problem i face now is the images are displayed in the place holder without breaking. i.e., only four images to be display in a row and the next four will display below. if more than 8 images then it will show paging to access the other images too. please help me to achieve this concepts. thank you in advance for who reviewing and giving the solutions.

Importing Images From XML File Into Flash
Hiya Guys,

I have created a flash image gallery that pulls the image files from an XML file. When I test this flash gallery locally it works fine. When I moved the flash to a live server, and tested it by navigating to the swf file in the address bar, it worked fine.

However, when I embedded the flash into an HTML page using SWFObject, the flash loads but the images do not appear. I am assuming the XML is not loading.

Any ideas?

Replacing Images W/o Editing Flash File?
What's the best way of changing images on the main page (say once a month) without messing with the original Flash file? Does it work the same way with replacing text too?
Thanks

Can I Use Config File To Change Images In Flash
New to flash,

Can I use flash with a config text file and then change the images by chaning the link in the text file like
image1=/images/pic1.jpg
image2=/images/pic2.jpg
image3=

thanks

Can I Use Config File To Change Images In Flash
New to flash,

Can I use flash with a config text file and then change the images by chaning the link in the text file like
image1=/images/pic1.jpg
image2=/images/pic2.jpg
image3=

thanks

Pulling Images From Folder/txt File, The Images Loop With Delay?
I would like to have a flash movie where images change from one to the next with maybe a 10second delay, and it will loop over n over.

I want flash to take images from a folder or a .txt file stating where the images are found so adding new photos or removing photos from this looped movie will be a breeze.

Any help would be greatly appreciated, thanks!

Images Pulled From Folder/txt File, Images Loop With Delay?
I would like to have a flash movie where images change from one to the next with maybe a 10second delay, and it will loop over n over.

I want flash to take images from a folder or a .txt file stating where the images are found so adding new photos or removing photos from this looped movie will be a breeze.

Any help would be greatly appreciated, thanks!

Images Pulled From Folder/txt File, Images Loop With Delay?
I would like to have a flash movie where images change from one to the next with maybe a 10second delay, and it will loop over n over.

I want flash to take images from a folder or a .txt file stating where the images are found so adding new photos or removing photos from this looped movie will be a breeze.

Any help would be greatly appreciated, thanks!

Optimize Flash File Size - With Bitmap Images?
I see this fantastic photosites, photographers online portfolio - using flash and large bitmap-photos - but how do you manage to keep the flash file size so low? Any tips on that?

Thanks again ;D

coala

How To Extract Good Jpegs/still Images From Flash File?
Hello,

Does anyone know the best way to extract jpegs or gifs from a flash file? -- I just need to get the still frames out of the fla. or swf. file, so I can then make a storyboard in photoshop...

I know this is probably a very straightforward thing, I've tried going through 'publish settings' selecting both jpeg and gif, but the resulting jpegs and gifs are either completely black or all pixelated and off-centre. I have no idea why it's doing this. It is a large file with any movie clips within movie clips...

Any help very much appreciated!

Looping Through Images In Flash From Filenames In A Text File
Hi,
What I want to do is have a text file with a list of filenames to pictures. Ex:

/images/pic1.jpg
/images/pic2.jpg

And I want the Flash file to loop through showing these pictures.
How can I do this, making them fade in and out.... I have no idea how to with using the text file. Can anyone help me out and give me some tips (or a short tutorial)?

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