ActionScript 2.0 :: Images - Dynamic Loading Into Array And Displaying
Apr 11, 2005
I'm trying to create something that will load a bunch of images into an array and then be displayed whenever needed via using the attachMovie() function.
Code:
for (var i=1; i<list.length; i++) { //list is an array full of urls to images
_root.createEmptyMovieClip("img"+i,i);
loadMovie(list[i], "_root.img"+i);
}
I dont think this is what I want because I don't actually want the images to appear right here (this is the loading part). What I want is each image to be in a separate symbol with a unique identifier so that I can create them dynamically during runtime.
View 1 Replies
Similar Posts:
May 25, 2009
I've constructed a dynamic slideshow using ActionScript 2.0 and PHP/MySQL. The reason for this, aside from update purposes, is that the slideshow will eventually display over 200 images. Thus, to save loading time and bandwidth, I decided to use PHP to pull ten images from an SQL database, formatting the output in XML. The slideshow itself works fine. Unfortunately, there are a couple of issues I need to address; my ActionScript is extremely rusty, so much of my work's patchy.
The code's displayed below:
import mx.transitions.Tween;
import mx.transitions.easing.*;
var myShowXML = new XML();
myShowXML.ignoreWhite = true;
myShowXML.load("getData.php");
[Code] .....
The code in red is my main focus. It's the loop which loads all images as movie clips using the XML information from an array. The loop loads all of the images, making them transparent before the presentation begins. What I would like to do instead, to save loading time, is to load the next image while the current one is displaying. The function "moveSlide" controls the transition of the images, so I'd imaging it'd be best to plade it in there.
There's already an incremental variable being used, with _root.target_mc, for removing transparency from the current slide. The code in blue is also nagging me quite severely. I retrieve the next chain of slides by simply contacting the PHP script again. The only way I could think of doing that was to refresh the slideshow (this is done COMPLETELY in ActionScript, with nothing on the stage). Unfortunately, I could only work out how to reload the whole video.
View 1 Replies
Jun 6, 2009
I'm trying to load some jpeg's into my movieclips. They are loading, but my height is displaying wrong. The image is 64x100px. I'm changing my movieclip to show the same size, but the display of the image is stretched.Doing a Debug of the movie, the movieclips show the correct dimensions, but the images are still stretched vertically somehow. My _xscale and _yscale are both at 100.
This is in actionscript 2.0. I've ran this file on both MX2004 and CS3, with the same result. The images aren't progressive,
Code:
numImages = 30;
spacing = 10;
x_pos = 0;
y_pos = 0;[code]..........
View 1 Replies
Feb 9, 2008
I have been using senocular's excellent 'squirrel finder' tutorial try and create a fairly simple xml-fed flash interface. Basically, i need to have a list of architectural projects in a menu, and when each one is clicked the project info is loaded into a dynamic text field and a series of maybe 2 or 3 images are also sent to movie clips on the stageThis is my xml file:
<?xml version="1.0" ?>
<menu>
<menuitems>
[code].....
View 1 Replies
Jul 16, 2009
i defined a global array in the first frame.When the user clicks on a button a value is inputted into the array, and they can click on several so all the different values are stored in an array.I want to display the last value of the array, so the last button they clicked on, on a separate frame.so i define my array like:
_global.purchases = new Array();
and the code on my button is:
on (release){
_global.purchases="awhite";
_root.gotoAndPlay("checkout_page");
}
and the code on the frame with the text box is:
var arrayCount = purchases.length;
var latestValue = arrayCount-1;
if (purchases[latestValue]=="awhite"){
imagename_txt = "A White";
}
However, the text doesnt display at all. If I trace my array then I get "awhite". If i trace arrayCount I get "6" and "5" for latestValue. But if i try and trace purchases[0] then I get "undefined".
View 5 Replies
Jul 16, 2009
i defined a global array in the first frame.When the user clicks on a button a value is inputted into the array, and they can click on several so all the different values are stored in an array.I want to display the last value of the array, so the last button they clicked on, on a separate frame.so i define my array like:
_global.purchases = new Array();
and the code on my button is:
on (release){ _global.purchases="awhite"; _root.gotoAndPlay("checkout_page");}
and the code on the frame with the text box is:
var arrayCount = purchases.length;var latestValue = arrayCount-1;
if (purchases[latestValue]=="awhite"){ imagename_txt = "A White";}
However,the text doesnt display at all. If I trace my array then I get "awhite". If i trace arrayCount I get "6" and "5" for latestValue. But if i try and trace purchases[0] then I get "undefined".
View 1 Replies
Jul 16, 2009
i defined a global array in the first frame.When the user clicks on a button a value is inputted into the array, and they can click on several so all the different values are stored in an array.I want to display the last value of the array, so the last button they clicked on, on a separate frame.so i define my array like:
_global.purchases = new Array();
and the code on my button is:
on (release){
_global.purchases="awhite";
_root.gotoAndPlay("checkout_page");
}
and the code on the frame with the text box is:
var arrayCount = purchases.length;
var latestValue = arrayCount-1;
if (purchases[latestValue]=="awhite"){
imagename_txt = "A White";
}
However, the text doesnt display at all. If I trace my array then I get "awhite". If i trace arrayCount I get "6" and "5" for latestValue. But if i try and trace purchases[0] then I get "undefined".
View 4 Replies
Sep 11, 2010
i have two different library objects which i add to stage and have them moving around. I have no problems getting the number of all the objects on stage into one dynamic text box, but i want to have the number of each of the two different objects shown in their separate text box. When i try this code, all i get in the dynamic text-boxes, are the name of the objects.
package {
import flash.display.MovieClip;
import flash.display.Stage;
import flash.events.Event;
[Code].....
View 2 Replies
Apr 15, 2008
This sounds so simple, but its to save me doing things like this:
Code:
var Lol:Array = new Array();
Lol["Rofl"] = 0;
_root.Lol_Rofl = Lol["Rofl"]; Just to get the array value to display in a dynamic textfield, is there any other more efficient way so that I do not need to declare a seperate variable with the value of the array data to get it to display?
View 4 Replies
Sep 14, 2006
Right now I am working on a game where I need to have 19 pieces revolving with 19 different MCs in them. The code I have can accommodate the movement and 19 pieces, but how to get 19 different ones in there - just one with 19 duplicates.
I thought if I addressed them in an array, I could tell my emptyMovieClip to load them into itself with individual MCs. I'm sure I'm on the right path, but it's not working yet.
My array:
anames = new Array (mcAnniePiece,
mcAlbertPiece,
mcAshleyPiece,
[Code].....
View 2 Replies
Dec 17, 2009
I know there are tons of tutorials out there about loading images from an xml file and creating a slide show. I can plug and play with those pretty good. However I would prefer it if I could start writing code myself. I am starting basic and each day working on adding code to a project.
Here is a made up app. Basically I have created three loaders that add an image to each one which I put into an array, cause why not. I have two event listeners one for an on stage click to load an image, and one a timer to load an image. The next thing I would like to try and do is load one image for a period of time, then load another etc.
So would I need a loop that loops through the array somehow connected with a timer?
public class array extends Sprite
{
//Create Loaders
private var imageOne:Loader= new Loader;
[Code].....
View 1 Replies
Feb 26, 2009
So I've got an array of images,
Code:
pixArray = ["Images/Architecture/Hospitality/01.jpg", "Images/Architecture/Mixed/01.jpg", "Images/Architecture/Office/01.jpg", "Images/Architecture/Performing/01.jpg"];
It's part of a slideshow, loading one image, waiting 4 seconds, then it loads another, etc etc. The problem is, between each image, it has to load. I'm trying to find a way to get flash to keep loading all the images in the array until they're all loaded, something to the effect of: On the completion of the loading of the first image, start loading the second image in the array. On completion of loading that, load the third image, etc, until there are no more.
I already have a variable that tells it how many items there are as well:
Code:
var total:Number = 4;
View 3 Replies
May 25, 2010
I am loading my images into an Array after my url is loaded
Code:
function urlLoaded(event:Event):void {
urlLoader.removeEventListener(Event.COMPLETE,urlLoaded);
xml=XML(event.target.data);
xmlList=xml.children();
[Code] ....
It is arrayThumb I am interested in, I wanted each each to be placed into a location within this Array. I then wanted to do
Code:
thumbArray[0].addEventListener(MouseEvent.CLICK, click_handler1);
function click_handler1(e:MouseEvent) {
trace("IMAGE CLICKED");
}
But when I try this, I get
TypeError: Error #1010: A term is undefined and has no properties.
View 2 Replies
Dec 11, 2009
I have a flash file that loads images from an xml file. Is there a way to make the images load randomly? I would like a different image to start every time it loads. here is where the xml is pulled in...
[Code]...
View 3 Replies
Aug 30, 2007
I am developing an advertising site and the site has three seperate flash areas. on the top of the page i have created a movie clip and successfully managed to get the images to load randomly. GReat...Here is my dillema in the other three areas that consist of seperate movie clips i want to load images that have been numbered sequentially like p1.jpg etc... what i want to do is to have the images load randomly, and be positioned in the movie clip where i want them to appear dynamically... then if the user clicks onto the next set of images, i need to be able to tell whether one of the previous images has been displayed, if it has, not to show it again.
View 2 Replies
Feb 26, 2009
So I've got an array of images,
Code:
pixArray = ["Images/Architecture/Hospitality/01.jpg", "Images/Architecture/Mixed/01.jpg", "Images/Architecture/Office/01.jpg", "Images/Architecture/Performing/01.jpg"];
It's part of a slide show, loading one image, waiting 4 seconds, then it loads another, etc etc. The problem is, between each image, it has to load.I'm trying to find a way to get flash to keep loading all the images in the array until they're all loaded, something to the effect of:
on the completion of the loading of the first image, start loading the second image in the array. On completion of loading that, load the third image, etc, until there are no more. I already have a variable that tells it how many items there are as well:
Code:
var total:Number = 4;
View 1 Replies
Jan 18, 2010
I am trying, with this code, to first, shuffle the order of the images in the array so their loading sequence is never the same when the page is reloaded.Then, im trying to have the shuffled array open one at a time, image by image, at a set interval.
Code:
Array.prototype.shuffle = function() {
for (i=0; i<this.length; i++) {
[code].....
View 6 Replies
Jan 8, 2012
I have written the following to send variables to PHP which searches a MySQL database and returns the results in XML. However for the life of me I cannot get the XML data loaded into the Movie Clips of my Flash site.Is there an obvious problem that I've overlooked?
ActionScript Code:
var imageDir:String = "Images/";
var getImage:XML;
var imageList = new Array();
var newPic:MovieClip = new MovieClip();
[code]....
View 5 Replies
May 15, 2004
I have 3 movieClips on the stage. I want this to load images from urls that I have withdrawn from a php script that randomly selects from stored urls in the database. I want to load one of these into each movieclip. Here is the code that I have, but it doesn't work. (Btw, this is on a frame of the movie)
PHP Code:
loadText = new LoadVars();
loadText.load("generateQuiz.php?week="+_root.week);
loadText.onLoad = function() {
j = 1;
sortItOut();
[Code] .....
View 4 Replies
Apr 2, 2011
Trying to pick 4 images randomly and load them into and array and then show them using a timer when all 4 images are shown 4 more images will be loaded again. here is the code:
var images : Array = new Array();
var rndNumbers : Array = new Array();
var imageLoader : Loader;
[code].....
View 1 Replies
Jul 5, 2010
I am trying to pass a string of images into an array and then load each image dynamically into a seperate bmp. The code is as follows:
ActionScript Code:
package{
import flash.events.*;
import flash.display.Sprite;
import flash.display.Bitmap;
import flash.display.BitmapData;
[Code] .....
View 4 Replies
Aug 17, 2009
I have a project where I'm loading some HTML into an HTML-enabled dynamic textbox, along with some images, using the img tag. The problem I have is that no matter what I do, the text tries to flow down one side of the image (depending on whether I have the image set to align 'left' or 'right'). I don't want this. I want the text to sit under the image, not flow around the side. I've tried everything I can think of, and I just can't seem to achieve this.
View 3 Replies
Sep 26, 2010
I was just wondering what are the pros and cons of using embedded images instead of dynamic loading? Because when making games on pure AS3 (without Flash IDE), its a pain to manually embed all the assets needed... That makes your code sloppy, besides you don't have control to automatically change the hud, for example, by only changing the external file.
But I heard that some sites only let you upload a single swf, so you can't have external images. Also I heard that some are worried about users downloading their art... But as far as I know, they can also download them if they hack the swf with a decompiler. Having it external, you can encrypt the image, and unencrypt it on the code, so if they try to download they will only get encrypted code.
View 3 Replies
May 15, 2004
I have 3 movieClips on the stage. I want this to load images from urls that I have withdrawn from a php script that randomly selects from stored urls in the database. I want to load one of these into each movieclip. Here is the code that i have, but it doesn't work. (btw, this is on a frame of the movie)
PHP Code:
loadText = new LoadVars();
loadText.load("generateQuiz.php?week="+_root.week);
loadText.onLoad = function() {
[Code].....
View 4 Replies
Sep 3, 2010
I'm currently using this script which works perfectly.
ActionScript Code:
//LOAD IMAGES
var imageLoader:Loader;
function loadImage(url:String):void {
// Set properties on my Loader object
[Code]...
View 5 Replies
Oct 13, 2002
i know there been a lot of poasts on this but none of them. I am duplicating a movie clip called "thumb" on my main timeline. they are named by number (1 to 233) within each clip i would like to load an image
[Code]...
the reason i have put in 10.jpg is just to get it loading one image into all clips. But its not loading the image into any. the trace is bringin back each MC's name fine when i remove the if(_name != "thumb"){ it loads the image into the duplicated original MC so im completely confused. this is the duplication script on the first frame of my Main timeline
[Code]...
View 2 Replies
Sep 8, 2011
I am using below code to load images from array, which works fine. My unsolved question how do I put all the images after it has been loaded to holderMc_animation (which in in root, with instance name holderMc_animation)...is sequence order?
image 1 goes to keframe1 of holderMc_animation
and image 2 to keyframe 2 of holderMc_animation and so on...
Actionscript Code: ......
Have uploaded FLA file
View 5 Replies
Jan 8, 2012
I have written the following to send variables to PHP which searches a MySQL database and returns the results in XML. However I cannot get the XML data loaded into the assigned Movie Clips. I think the problem might be somewhere in the URLLoader.
var imageDir:String = "Images/";
var getImage:XML;
var imageList = new Array();
var newPic:MovieClip = new MovieClip();
var thumbnailGroup:MovieClip = new MovieClip();
var loadGallery:String = "getImage.php";
[Code] .....
The remaining script (not included) handles the loaded data but is there an obvious problem I have overlooked in the above?
View 2 Replies
Oct 26, 2009
I am using a loader (Loader.loadBytes()) to load multiple jpeg images (motion jpeg)continually whenever a new jpeg image is ready. However, when the mouse is moving over the loader, it seems to repaint everything including the background and causes the flashing. Is there a way to prevent this from happening without using the double-buffer concept? Is there way to stop repainting the background?
Is the problem caused by the images loading or mouse over? When the mouse is not moving over the loader, everything looks fine. However, when only a image is loaded by the loader, I think the display won't be flashing even though you move the mouse over it.
View 0 Replies
Jan 18, 2010
Again some questions I feel a decent as3coder should know...I created a class to load image files. It works nice and all, but I have some questions... ok here goes ...This is my class :
ActionScript Code:
package {
import flash.display.Loader;
[code]......
View 1 Replies