[F8] Loading A Random Background Image And Preloading It.
Hey guys, currently making a new site. It is a fluid layout so everything streches etc. I am loading in a different background image each time the site is loaded and I have a good code for that from here:
http://www.kirupa.com/developer/mx/l...background.htm
But since the image needs to take up a lot of space on stage for things like 22" screens the image sizes are like 2MB. Is there anyway that I can preload the background image seperatly to the whole movie...well actually I know there is I just need to be pointed in the right direction or just given some help. I want the preloader to load the whole stage but then where the background image should be displayed a preloader is displayed until the background image has fully loaded.
Any help would be awsome!
thanks.
FlashKit > Flash Help > Flash ActionScript
Posted on: 07-22-2007, 01:57 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Loading A Random Background Image With A Preloader
hello
I've been following the Loading a Random Image tutorial from kirupa but I can't seem to make my image*.swf's to work..in it all I have is 3 frames, where the first 2 frames are for the preloader and the 3rd one is for the image.. but all I get is the loadBar fully loaded (but with no animation, just static) and no image... does that code from the kirupa tutorial stop the *.swf to make anykind of anymation?
another question is about how to simple load a movie on enter frame with a movieclip defining the location where it should be loaded to.. shouldn't it be: location.loadMovie("movie.swf") ? simply.... no?
thanks in advance..
Loading Random Fullscreen Background Image
so, i finally got the fullscreen / scaling background to work. AND i can add .swf's and other mc's over top of it without any problem. however, i want to be able to have the background image randomly generated. i know how to do that on its own, but i can't get it to work with this script. any advice?
here's my fullscreen / scaling bg script.
Quote:
Stage.scaleMode = "noScale";
_global.imgConstantWidth = bgImage._width;
_global.imgConstantHeight = bgImage._height;
setImage = function(mc){
var originalWidth = 1280;
var originalHeight = 850;
var widthGutter = (Stage.width - originalWidth)/2;
var heightGutter = (Stage.height - originalHeight)/2;
mc._x = -widthGutter;
mc._y = -heightGutter;
if (mc._width > Stage.width){
mc._x -= (mc._width-Stage.width)/2;
}
if (mc._height > Stage.height){
mc._y -= (mc._height-Stage.height)/2;
}
}
resizeImage = function(mc){
var scaleByWidth;
if (Stage.width/Stage.height > _global.imgConstantWidth/_global.imgConstantHeight){
scaleByWidth = true;
}else{
scaleByWidth = false;
}
if (scaleByWidth){
mc._height = Stage.width * _global.imgConstantHeight / _global.imgConstantWidth;
mc._width = Stage.width;
} else {
mc._width = Stage.height * _global.imgConstantWidth / _global.imgConstantHeight;
mc._height = Stage.height;
}
}
setImage(bgImage);
resizeImage(bgImage);
sizeListener = new Object();
sizeListener.onResize = function() {
setImage(bgImage);
resizeImage(bgImage);
};
Stage.addListener(sizeListener);
Help Preloading A Random Background
I can't tell you how long I've slaved over this question. I would ultimately like to load a random background, but first I'm just trying to preload a script-defined background. This is the coding I'm at right now and it doesn't work at all; it just sits with an empty load bar and "NaN% loaded" as the text. Any help you guys could give me would be VERY MUCH appreciated. Thanks in advance!
Justin
Here's the script--
stop();
//pic folder name
folder = "pics";
//create Holder and place him
this.createEmptyMovieClip("image", 1);
image._x = 0;
image._y = 0;
//load the content
image.loadMovie(folder + "/background.jpg");
//declare and launch preload
var content = image;
loadNow(content);
function loadNow(content) {
//Turn on and initialize the preloader
_root.loadBar._xscale = 0;
_root.loadText = "0% loaded";
//Set an interval to update the loading progress
loadInterval = setInterval(checkProgress, 10, content);
}
function checkProgress(content) {
//Set all variables to default
var contentSize = 0;
var downloaded = 0;
var percntLoaded = 0;
//Get total and loaded bytes
contentSize = content.getBytesTotal();
downloaded = content.getBytesLoaded();
percentLoaded = Math.ceil(downloaded / contentSize * 100);
//Update the preloader display
_root.loadText = percentLoaded + "% loaded";
_root.loadBar._xscale = percentLoaded;
updateAfterEvent();
//Is everything loaded?
if (downloaded == contentSize && contentSize > 0) {
clearInterval(loadInterval);
}
}
Help Preloading A Random Background
I can't tell you how long I've slaved over this question. I would ultimately like to load a random background, but first I'm just trying to preload a script-defined background. This is the coding I'm at right now and it doesn't work at all; it just sits with an empty load bar and "NaN% loaded" as the text. Any help you guys could give me would be VERY MUCH appreciated. Thanks in advance!
Justin
Here's the script--
stop();
//pic folder name
folder = "pics";
//create Holder and place him
this.createEmptyMovieClip("image", 1);
image._x = 0;
image._y = 0;
//load the content
image.loadMovie(folder + "/background.jpg");
//declare and launch preload
var content = image;
loadNow(content);
function loadNow(content) {
//Turn on and initialize the preloader
_root.loadBar._xscale = 0;
_root.loadText = "0% loaded";
//Set an interval to update the loading progress
loadInterval = setInterval(checkProgress, 10, content);
}
function checkProgress(content) {
//Set all variables to default
var contentSize = 0;
var downloaded = 0;
var percntLoaded = 0;
//Get total and loaded bytes
contentSize = content.getBytesTotal();
downloaded = content.getBytesLoaded();
percentLoaded = Math.ceil(downloaded / contentSize * 100);
//Update the preloader display
_root.loadText = percentLoaded + "% loaded";
_root.loadBar._xscale = percentLoaded;
updateAfterEvent();
//Is everything loaded?
if (downloaded == contentSize && contentSize > 0) {
clearInterval(loadInterval);
}
}
Background Image Not Visible After Preloading....
Morning u lot!
I have a problem with my background image.... if i test the movie in flash without preloading, it works fine, but if i simulate download, my background image isn't visible after preloading the movie, why??
here is the preloader code on the 15th frame:
Code:
var Loaded:Number = _root.getBytesLoaded() / _root.getBytesTotal();
preBar._width = Loaded * 125;
code on the 16th frame
Code:
if(_root.getBytesLoaded() == _root.getBytesTotal()) {
gotoAndPlay(17);
}
else {
gotoAndPlay(15);
}
and here is the main code to show the image:
Code:
function bgVisible(){
trace("bgvisible");
var bgPath = _root.mBG;
bgPath._visible = true;
bgPath.brightnessTo(0, 1, "linear", 0, "this._parent.showMenu()");
bgPath._width = Stage.width + 8;
bgPath._yscale = bgPath._xscale;
if (bgPath._height < Stage.height)
{
bgPath._height = Stage.height + 8;
bgPath._xscale = bgPath._yscale;
} // end if
bgPath._x = Math.floor(-(bgPath._width - 1000) / 2);
bgpath._y = Math.floor(-(bgPath._height - 700) / 2);
} // end of function
var mBG = photo;
var pBGNum = 1;
mBG._visible = false;
mBG.createEmptyMovieClip("eBG", 1);
mBG.eBG.unloadMovie();
mBG.eBG.loadMovie("imgBG/" + _root.pBGNum + ".jpg");
mBG.brightnessTo(-100, 0, "linear", 0.100000, "this._parent.bgVisible()");
Help Random Background Image
Hello guys, i need a hand please!!
Im trying to do a site but with a random backround.. add like 5 different images and make the background fit in the resolution of all computers and every minute make them change with an effect!
please if someone knows how can i do this that is not creating a movie clip symbol with animation cause that wont be random and wont fit in all resolutions.
Thank you guys!!
roth
Random Background Image Freaking Out?
Hi,
I have a movie clip with 9 frames. Each frame has a different image. Then I have AS to generate a random number and go to that number frame when the project is loaded (the whole thing is an exe on a CD by the way but the problem occurs whether I'm running it off my hard drive or the CD). It works great MOST of the time. The problem is that once in awhile when you load the project the random generator code seems to be ignored and all the images flash by, looping over and over. You have to close the project and relaunch to get it to stop.
Is there some way to fix this problem? This CD will be going to potential clients.
Thanks!
TS
Tile Background, Random External Image/swf
Hey all,
First post!
Anyways, I've been browsing around for a random tiled background and pieced together some components you guys have written, however its not working correctly?
The image(s) loads in the blank mc (named bc), however it does not tile?
loadMovie("bg_"+(Math.floor(Math.random()*3)+1)+". swf", "bg");
bg._visible = false;
w = bg._width;
h = bg._height;
y = _y;
for (iy=0; iy<20; iy++) {
x = _x;
for (ix=0; ix<24; ix++) {
n = "bg"+(iy*24+ix);
duplicateMovieClip("bg", n, 1+(iy*24+ix));
_root[n]._x = x+w/2;
_root[n]._y = y+h/2;
x += w;
}
y += h;
}
Any suggestions?
Random Fullscreen Background Image On Refresh
Hi there, I have flash site and client wants random fullscreen background image to load on refresh. sounds easy right ?. but i've tried a lot of components and code snippets but it's causing headaches as nothing seems to work. i have a client squirming because it isn't done and i was wondering if you could help me out.
I did purchase a component from flashden (randombgholder) which does exactly what i want, but it seems to clash with the flashloaded fCMS system i have working in place, and somehow knocks it out, but that could be my bad amateur flash coding causing it. And when i go to center the swf over the background using his code he provided it goes haywire.
perhaps i could do a random fullscreen background image on page refresh in html?? i tried some css ones, but nothing works probably because i'm very new to flash and the likes.
links to tutorials or someone i could even pay to do this - anything really appreciated.
THanks in advance, Angie.
Photogallery Issues - Preloading Movie With Random Image And Variables
hej,
ive been searching everywhere, but coulnd find it,
id like to preload movie loaded into a target MC, but this preloaded movie loads yet additional content, which is random image (an image of a variable size, and the size of the image will be passed on to flash in variables from php script) and a set of variables,
and Im totaly lost, as when i try to load it, the getBytesTotal will be only of the movie size to preload, it will not add up the image to the total size nor, which is obvious, the variables,
how to go around it for my movie not to start playing without all the variables and image having been loaded,
ok,
down to my second question
the whole thing is Im trying to build a photogallery,
after a person hits "PHOTOGRAPHY" link, the list of photogalleries is loaded and displayed into a targetet movieclip, each link to the photogallery would be generally a duplicated MovieClip, which would have a button and variable text inside of it,
what Im thinking of is when the photogalleries variables are loaded into the movie, I dont want the links-duplicated movieclips to appear just all together, but one at a framerate,
each of the links-duplicated movieclips would have a little tween, going from alpha 80 to 100 and than back again to 60, to make a wave-like appearence of the available photogalleries...
hmm.. I hope you understood, what I meant )
so my problem with the second question is, where do I put the
for(i... loop, to make the duplicate movies appear in the manner I described above?
I wrote:
onMovieClip(load) {
//set the i variable
i=1;
}
onMovieClip(enterFrame) {
duplicateMovieClip("blabla", "blabla"+i, i);
// no worries about the rest
i++;
if(i == number_of_photogalleries) {
stop();
}
}
but it somehow didnt want to work...
basicaly, what I want to achive is similar to:
reverence.rayoflight.net
and days of the month appearing on the calendar,
I also recommend to check it out, its a great databasedriven flashsite,
thanks a lot for any help,
Loading A Random Background At 100%
how would you go about doing this. (ex http://hi-res.net )
I know how to do both indvidualy but i cant make it all work together!
any help would be apreciated
Loading Random Background
Hi, i read and completed the tutorial on this topic:
http://www.kirupa.com/developer/mx/l...background.htm
what i needed is something similar, except that my background image is a motion clip and instead of having external .swf, i need all the MC's in just one flash. How do i do that?
Thank you for a quick response
x.
Victor
Loading A Random Background
Hi everyone
This is my first post here, but i've used the excellent tutorials section on many occasions with great success
I now have a question re: Loading a Random Background
This will indeed work perfectly for what i want, my question is this;
can i get the same effect using jpgs from an external source?
thankyou for looking
Sue
Loading A Random Background At 100%
how would you go about doing this. (ex http://hi-res.net )
I know how to do both indvidualy but i cant make it all work together!
any help would be apreciated
Random Clip Loading And Preloading Question
Hi everyone I hope someone can help me with an interesting problem I am having. I have searched the forums for an answer but I cant find anything that exactly applies to the situation I have.
I am trying to load / preload external movie clips here is the scenario:
Main movie grabs and preloads a random clip from a selection of 10 external clips.
Whilst the first clip is playing another random clip has to be selected and be preloading in the background whilst the first clip plays.
The first clip loops until the second clip is ready to play.
The process continues randonly playing clips without replaying a previously played clip. Once all clips have been played the process starts again.
The problem really lies in not repeating previously played clips and preloading the selected clips in the background.
Does anyone have any ideas?
All help and sudgestions are greatly appreaciated!
Thanks
How Do You Use Loading A Random Background On The Website
I found the loading random background tutorial
http://www.kirupa.com/developer/mx/l...background.htm,
so i follow through the tutorial to make my .swf file work as every time i open the .swf file, it gives me different background. However, when i insert its in my webpage, it gives me no response. It won't even load or do anything else at all, so is there anything i need to do or any specific code that i need to include when i insert it to my webpage so it'll load the new background everytime that i refresh the page?
By the way, the tutorial's really helpful, thank you!
Loading Random Background Tutorial Q.
I was just reading the testing the tutorials regarding loading a random background. I have tried this and worked!
BUT!...
I tried this for my flash document but the background covers everything else.
The keyframe, in which the script for loading the random image is in, is in a layer under a layer where my title is in. But when it loads the image, it appears on top of my image.
I'm trying to make an interactive DVD and want it so that my background changes each time you load the .swf file. (If possible to make it change also whenever you come back to the home page after visiting another page in it)
How do I solve this problem?
Question About Random Loading Background
I got the tutorial to work (it's pretty simple) but I want the background to randomly load images on it's on, basically looping through all of the random bacgrkounds without the page having to be refreshed. How do I achieve this? Thanks
Random Background When Loading Website
Hi there,
I'm new to Actionscript and was hoping somone could assist me with creating a random picture loader for my background, so that when you enter the website the picture in the background is different every time you enter.
Thanks for any help!
Loading Random Background Problems [renamed]
I am looking for someone skilled with Flash, a Wizard hopefully...
I have been trying to create a .swf that loads a Random background image (like the one on Kirupa's MX tutorial on this site) ... and my skills are just too insuficient.. I got it working but the images loads in sequence too fast and my general composition and work is kinda messy...
Is there someone here who is interested in helping out ?
The project is for our website, we are a non-commercial gaming clan, and alot of programmers, but none of us have any serious Flash experience. We are able to advertise/link back to anyone who might wanna help us out.
Contact me on email: therseus@gmail.com
Help Loading A Random Background Full Screen
In the bottom layer of my main movie, Id like to put a random background image which loads on entering the frame and stretches to full screen. I would like to use a preloader for the image so Im trying to load a swf using this which I found here:
http://www.kirupa.com/developer/mx/l...ackground2.htm
Code:
choice = Math.round(Math.random()*5);
switch (choice) {
case 0 :
location.loadMovie("image0.swf");
break;
case 1 :
location.loadMovie("image0.swf");
break;
case 2 :
location.loadMovie("image0.swf");
break;
case 3 :
location.loadMovie("image0.swf");
break;
case 4 :
location.loadMovie("image0.swf");
break;
case 5 :
location.loadMovie("image0.swf");
break;
}
but I could not get it to stretch full screen. How do I get the externally loaded swf to stretch full screen and be able to resize via a listener from within my main movie?
Thanks!
Rich
AS 2 Loading Random Background FULLSCREEN Images
Hi there,
I have been looking at this tutorial http://www.kirupa.com/developer/mx/l...background.htm
but I need the background images to be FULLSCREEN. Can someone help me out? Is there a way to do this that someone can point me to ? I have a client squirming, and my head is on the block.
I am using as2, flash cs3.
Thanks in advance, Angie.
Loading Random Background Problems [renamed]
I am looking for someone skilled with Flash, a Wizard hopefully...
I have been trying to create a .swf that loads a Random background image (like the one on Kirupa's MX tutorial on this site) ... and my skills are just too insuficient.. I got it working but the images loads in sequence too fast and my general composition and work is kinda messy...
Is there someone here who is interested in helping out ?
The project is for our website, we are a non-commercial gaming clan, and alot of programmers, but none of us have any serious Flash experience. We are able to advertise/link back to anyone who might wanna help us out.
Contact me on email: therseus@gmail.com
Preloading Image Before Loading Into MC (Flash 8)
Folks,
Enough lurking - I finally have a legitimate reason to register and post.
I have a small SWF that I'm using to display a random image on page load. Basically it's a splash banner that's built into my site layout. All data is fed from an external XML file so that to add images to the "pool", all I have to do is toss the image into the adImages/ folder and update the XML. I count the "ad" nodes in the XML and push the path to each image to into an array. Then I generate a random # between 0 and the array.length-1 and then use loadMovie to display that image in an empty mc.
Everything works just fine locally. Even when I loaded the SWF up to my site and pointed the browser directly to it, I had no problems whatsoever.
But when I embed the swf into my splash page, it doesn't load an image. It just sits there displaying the swf background. I know the paths in my xml are correct, as it works just fine when you point your browser directly to the swf file. In my splash page I'm merely replacing an existing swf (embedded via swfobject), so i know my javascript is fine.
I'm wondering (and oblivious to) if I need to add script that preloads the image in between the steps of randoming picking the image and then loading it into the empty mc. Don't understand why it'd work locally, and online, but not if embedded into a page...?
Any suggestions? Code is attached as a GIF...
steve
Loading SWF On Background Image?
Hello all,
I need to have a photo slideshow play on the home page of a resort site, but I'm afraid the content will be heavy and I don't want to show the preloader.
Is there a way to have a background image in a table and then load the SWF on top of it? Does this involve DHTML layers?
Thanks in advance!
Robert
Loading External Image Files And Preloading Them.
I fairly new to flash 8 actionscript. I've searched other posts for the same problem that I'm facing.
I want when clicking on a button that it loads a jpg file and that shows the precentage of load of that same file. I also want to be able to close that image so that I can return to the main site and choose from the thumbnails another image and do the same thing to that image etc etc etc.
Thank you for the attention.
Background Image Loading Timer
Here it goes : I have a 4 x 3 grid which contains 8 MC's with images (jpg's). The 4 remainder grids cells are buttons. So here's the tricky part for which I need some help
Each of the 8 'image' cells needs to hold 8 different images (total of 64 images) which I load from the server. Each button action will trigger two 'image' cells to bring up a new image but in random. How do you call up a random image in the specific MC using AS ?
Thanks,
Smalco
Help Loading Image Background As MC /multiple MC's
Hello.This is really a two question post . but the first quesion is more important.
1. I am using this code to load a background.
photoclip.loadMovie("stripes.jpg");
I have an empty movie clip on stage. I have given it the instance name photoclip. It is positioned in the upperleft hand corner.
The issue is that the background appears but the only partially.
how do I load a background dynamically and get the full dimensions of the image to show up? Also are there ways to tile backgrounds like you can do in CSS?
2. Ideally I'd like to have a whole bunch of empty movie clips and load images into them. Is it possible to have multiple Movie clips on the stage that are different instances of the same object? I want each of these movie clips to load different images. I know i could just put the image in the MC but I think loading trthem dynamically will make for a smaller flash file.
I am using flash 8 and have very limited experience.
Thanks in advance,
Loading Background Image OnMouseOver, Etc.
I'm try to solve this problem, but it seems too dificult for me... So, any help or clue are welcome!
Let me decsribe it!
I have movie that has two different images... When the movie is loaded and reach the end, I have large button that onMouseOver effect has new image (smiling girl).
The problem is that I want her to smile all the time while the mouse is over animation. That should includes the case when someone trys to type something and finally press small button to submit data. But when mouse cursor is not rolling over she should stop smiling...
The problem is that it's simple to have her smiling in every other case, but when the event as described occurs, she stop simling..
I try several solutions that came up in my head, such as attachMovie, createEmptyClip, different depths, rollOver/out etc, but it seems that I haven't bright idea what i should do i order to get the expected result.
So, please help me! It's pretty urgent...
http://img219.imageshack.us/my.php?i...utmovieof5.swf
Loading Background Image OnMouseOver, Etc.
I'm try to solve this problem, but it seems too dificult for me... So, any help or clue are welcome!
Let me decsribe it!
I have movie that has two different images... When the movie is loaded and reach the end, I have large button that onMouseOver effect has new image (smiling girl).
The problem is that I want her to smile all the time while the mouse is over animation. That should includes the case when someone trys to type something and finally press small button to submit data. But when mouse cursor is not rolling over she should stop smiling...
The problem is that it's simple to have her smiling in every other case, but when the event as described occurs, she stop simling..
I try several solutions that came up in my head, such as attachMovie, createEmptyClip, different depths, rollOver/out etc, but it seems that I haven't bright idea what i should do i order to get the expected result.
So, please help me! It's pretty urgent...
http://img219.imageshack.us/my.php?i...utmovieof5.swf
Loading Background Image OnMouseOver, Etc.
I'm try to solve this problem, but it seems too dificult for me... So, any help or clue are welcome!
Let me decsribe it!
I have movie that has two different images... When the movie is loaded and reach the end, I have large button that onMouseOver effect has new image (smiling girl).
The problem is that I want her to smile all the time while the mouse is over animation. That should includes the case when someone trys to type something and finally press small button to submit data. But when mouse cursor is not rolling over she should stop smiling...
The problem is that it's simple to have her smiling in every other case, but when the event as described occurs, she stop simling..
I try several solutions that came up in my head, such as attachMovie, createEmptyClip, different depths, rollOver/out etc, but it seems that I haven't bright idea what i should do i order to get the expected result.
So, please help me! It's pretty urgent...
http://img219.imageshack.us/my.php?i...utmovieof5.swf
Loading Of Background Image From CSS To Flash 8
Hiya, I need to load background image from css to flash 8. Is this possible and if possible, how am I going to do it? Can anyone pls help me and greatly appreciated if u could show me the actionscript on how to do it. Thanks alot!
Loading Background Image OnMouseOver, Etc.
I'm try to solve this problem, but it seems too dificult for me... So, any help or clue are welcome!
Let me decsribe it!
I have movie that has two different images... When the movie is loaded and reach the end, I have large button that onMouseOver effect has new image (smiling girl).
The problem is that I want her to smile all the time while the mouse is over animation. That should includes the case when someone trys to type something and finally press small button to submit data. But when mouse cursor is not rolling over she should stop smiling...
The problem is that it's simple to have her smiling in every other case, but when the event as described occurs, she stop simling..
I try several solutions that came up in my head, such as attachMovie, createEmptyClip, different depths, rollOver/out etc, but it seems that I haven't bright idea what i should do i order to get the expected result.
So, please help me! It's pretty urgent...
http://img219.imageshack.us/my.php?i...utmovieof5.swf
Random Image Loading
hi there,
im trying to figure out/ write a script, so that everytime a user were to hit refresh, the swf would display a different image.
im assuming i would have to select a number by using random(5)
and then associate that number to a movieclip or scene.
if anyone has info or insights on how to go about this, i would really appreciate it.
an example of what i am talking about is here:
http://www.onenine.com/flash.html
thanks in advance -
jennifer
Random Image Loading
Hi, firstly what to say I tried to find the answer in other theads and forums, but no succes...
hope someone can help
I'm creating a page that every time it goes back frame 1 a new image is loaded in a empty MC. I used the following code:
pic_arr = ["dynamic/image_big_A.jpg",
"dynamic/image_big_B.jpg",
"dynamic/image_big_C.jpg",
"dynamic/image_big_D.jpg",
"dynamic/image_big_E.jpg",
"dynamic/image_big_F.jpg",
"dynamic/image_big_G.jpg",
"dynamic/image_big_H.jpg"];ranNum = random(pic_arr.length);
image.loadMovie(pic_arr[ranNum]);
It works! The PROBLEM is that it repeats itself, wich is something i would like to stop, at least not to see the last one shown again. Any suggestions?
__________________________________________________ _______________________
Thanks god for this forums, if not I wouldn't got as far anyway
Random Loading Image
Im trying to create a Dynamic slideshow that loads an image fades it out and loads another.
This is my code thus far. I can get the image to load but its not random.
Code:
function loadImages(amount:Number) {
for (var i = 0; i<amount; i++) {
var sURL:String = "images/0"+i+".jpg";
randImage = Math.floor(Math.random()*sURL.length);
holder.loadMovie(sURL);
}
}
loadImages(1);
Loading A Random Image
I need some help loading a random image into a movie clip.
I'm creating a flash presentation for my band with a script generated moving banner across the top of the presentation.
I have had help with a script which sends a movie clip in a repeating pattern from left to right on the stage. I wish to load an image into the clip with a different image into the following clip and so on.
I have attached the .fla file for someone to help me with.
This is not the presentation, just a mock up of what I'd like done.
I would really appreciate the help.
Random Image Loading
I've want to display 2 random images on the same page from a directory that has 5 images in it.
I got the random part, but I can't get the pics to load simultaneously. Can someone point out what I did wrong?
Code:
Array.prototype.pickRandomValues = function(n) {
var selected = [];
for (var i = 0; i<n; ++i) {
var r = Math.floor(Math.random()*this.length);
selected.push(this[r]);
this.splice(r, 1);
}
return selected;
};
loadMovie("img/"+pictures_array.pickRandomValues(1)+".jpg", "container_mc");
loadMovie("img/"+pictures_array.pickRandomValues(1)+".jpg", "container_mc copy");
Loading A Random Image
Hi all,
I refer to the tutorial on Loading a Random Background but what if I want to make my images randomly appear on top of each other on the click of a button just like the jackpot?
Random Image Loading Via XML
i'm trying to randomly load images via xml but my output window keeps saying "undefined".
can somebody help me please?
Code:
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;
}
randomImage();
}else{
content = "file not loaded!";
}
}
xmlData =new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("bg.xml");
p = 0;
function randomImage(){
if(loaded == filesize){
p = Math.floor(Math.random() * total);
bgholder._alpha = 0;
bgholder.loadMovie(image[0], 1);
}
}
Loading Random XML Image
I've got external jpgs loading into my flash via XML the same as this:
http://www.kirupa.com/developer/mx20...togallery1.htm
However, I want the images to load randomly. So unlike the above tutorial, I want it to load a random image each time the user visits it.
Also, I do not need a next and previous button, but one single button which refreshs the movie with a new random image.
Does anyone know how adjust the actionscript/xml to do this?
thanks.
Loading Random Image
I want to make a button that loads a random image in a new window. Is this possible?
Loading A Random Image
Hi all,
I refer to the tutorial on Loading a Random Background but what if I want to make my images randomly appear on top of each other on the click of a button just like the jackpot?
Random Image Loading Via XML
i'm trying to randomly load images via xml but my output window keeps saying "undefined".
can somebody help me please?
Code:
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;
}
randomImage();
}else{
content = "file not loaded!";
}
}
xmlData =new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("bg.xml");
p = 0;
function randomImage(){
if(loaded == filesize){
p = Math.floor(Math.random() * total);
bgholder._alpha = 0;
bgholder.loadMovie(image[0], 1);
}
}
Random Image Loading
Hi.
I'm building a Web site completely in Flash. On the home page along with some text I would like to load a random product image that is for sale. The text on the home page needs to stay the same, but the product image and product description as well as the "buy me" button need to load randomly so every time a user logs in he/she sees a different product. Any suggestions or links to tutorials would be very much appreciated. Thanks in advance.
Ivan
www.foundation-one.net
Random Dynamic Image Loading
Objective: create a movie that dynamically loads random images and changes to another image after a period of time, while having an "in-between" fade transition (between images loaded).
I'm able to dynamically and randomly load images to my flash project, and have even gone so far as to randomly choose an image from a folder. However, with random(), you have to specify the amount to be 'randomed' and if the number of images are too little, an error will occur saying it can't find the specific image.
Additionally, suppose in the future I want to add more images without messing with the Flash file, how am I going to come up with a script that's going to allow flash to find the images? Coz at this moment if I don't alter the flash file by adding the number of images, then it won't find the new images.
-oxy
Dynamically Loading A Random Image
I'm sure this is really easy and I'm going to kick myself when someone shows me but I've got out of practice with Flash (not that i was a master or anything in the first place).
Basically I am trying to dynamically load one of three images, selected at random, into a movieclip when a button is pressed.
I think it should be something like this:
button1_btn.onRelease = function() {
randNum += random(3);
loadMovie("images/[randNum].jpg", box1_mc);
}
Although now of course it is looking for an image called [randNum].jpg - rather than using randNum to select an image. Where am I going wrong?
thanks for your help
Naomi
|