ActionScript 2.0 :: Specifying An Image In An Array?
Nov 21, 2004
I just completed the image gallery tutorial here (great tutorial!) and I am wondering if there's a way to have a button tell the array to display a specific image instead of just cycling them sequentially.
The button action script is
on (release) {
_root.changePhoto(1);
}
Which tells it to go to the next image defined in the array. What I would like it to do is display a specific image in the array like "01.jpg"
Right now I have a manual slide show that works using a simple fade in. Images via an external directory, set up in an array and dropped into an MC whenever someone clicks "next".
What I need to have happen are different transitions applied to each new image via "next" button click.
I've tried a number of things - setting up a transition array and using "switch" however I seem to be missing the proper code for this.
As it stands, here's the basic functioning code:
import mx.transitions.*;import mx.transitions.easing.*; i = 0;var imageList:Array = new Array("slides/1.jpg", "slides/2.jpg", "slides/3.jpg", "slides/4.jpg", "slides/5.jpg", "slides/6.jpg", "slides/7.jpg",
I just completed the image gallery tutorial here (great tutorial!) and I am wondering if there's a way to have a button tell the array to display a specific image instead of just cycling them sequentially.
The button action script is
on (release) { _root.changePhoto(1); }
Which tells it to go to the next image defined in the array. What I would like it to do is display a specific image in the array like "01.jpg"
I have a page that I'm trying to build that has a scrolling image bar at the bottom but I want to also show the full size image in flash above the images that come up in the thumbnail array when you mouse over each image in the array. I found some code that makes the thumbnail array work but I have no idea how to display the second larger image on mouse over because its loading the images externally... what can I do? Feel free to email me back.
Trying to make a code that dispays a number of products/images. Problem is pretty simple... when I put in a new picture, it ends on top of and covers the last. I want it to end beside the other, on a row. Do I use an image array to fix this?
Also, if I want to position my array/gallery somewhere else on stage, where/how do I adjust the x y values?[code]...
I have a fairly complicated question about converting the data on an image into an array. At the moment the map of a game i am developing is stored like this:
I'm attempting to create an image gallery with Flash and XML. After finding a number of similar threads and attempting to sort the results with Actionscript, I am still unable to display the images in order eg. beauty1.jpg, beauty2.jpg, beauty3.jpg etc.[code]...
I have this to load a random image from my array. But how can I keep track so that a new random pic wont be the same as one allready shown, until all pics in the array has been shown once?
In my photo gallery, I have an array of images that load sequentially using 'next' / 'prev' buttons. The code fades out the current swf, recognises when the new external swf has fully loaded, then fades in:
When the xml file of images is loaded, I place each image into an element of an Array so I can handle them individually. Problem I am having now is this. When image at element 1 is pressed, it should become one of my movie clips background. I am using some code I was using in as3, when the image wasnt in an Array and it worked fine. Now I am in AS2, and the image is in an Array, it doesnt seem to work. Additionally, I get no errors whatsoever.
The code for this is picHolder[1].onPress = function() { picHolder[1].width = card.width; picHolder[1].height = card.height; picHolder[1].x = 0; picHolder[1].y = 0; card.addChild(picHolder[1]); };
Whereby picHolder[1] is an image, and card is my movie clip. If I do picHolder[1].startDrag(true), I can pick up and drag the image. So, I know I am dealing with the correct image here. Should I be doing the above differently when working with an Array?
instead of cycling through the images in the array, it jumps right to the last one. import fl.transitions.Tween; import fl.transitions.easing.*; play_btn.addEventListener(MouseEvent.CLICK, goPlay)
I want to resize an image which i have held within an array so that they can be used for thumbnails.
images show in full size i want them resized as i am using the same image for both the main image and the thumbnails to help keep the file size down. Below is the code its all working great now apart from the resizing which i have tried doing all sorts and i cant figure it out.
function loadImage(filePath:String):void { //for loop to load thumbnails for(var thumbnum:int=0; thumbnum<6; thumbnum++)
Is it possible to load an image (preferably jpg) from a binary array? The reason I ask is because I'm loading the images dynamically through SOAP webservices so I get a byte representation of the jpeg image. I can't run the loadMovie method to point to an image URL because it doesn't exist. Can it be loaded somehow using the bitmap classes?
I'll have to make a page that will stream out the jpg dynamically from the website, but I'd prefer to keep it all on the webservices end if possible.
I am trying preload multiple images into an array of MCs..So far I can do this with 1 image using the loadBitmapSmoothed function from this site: [URL]Im using this function mainly because the images will be panning and scaling alot.Here is my code which includes a preloader and I have also attached the flash file (Flash8)
PHP Code:
stop();import flash.display.*;// INITIAL PRELOADER SCALEpreloader_mc._xscale = 0; function loadBitmapSmoothed(url:String, target:MovieClip) { // Create a movie clip which will contain our // unsmoothed bitmap var bmc:MovieClip = target.createEmptyMovieClip( "bmc", target.getNextHighestDepth()); // Create a listener which will notify us when
I have a question about setting up an image array from an external source. I have the following action script and would like to edit it so that it reads from an external file. Either TXT or XML. how to edit the array action.
I have a nested array that contains an image and a string like this; [{image:"images/image1", text:"one",}, {image:"images/image2", text:"two",}, Is there a way that I can have a sound (mp3) in each part as well?
I'm would like to use the UILoader to randomly load an image from an array according to the day of the week. The attached FLA file is in AS2, it is exactly what I would like to do but now in AS3. I've been able to successfully trace the date using:
var today_date:Date = new Date();var dayOfWeek = today_date.getDay();trace(today_date.getDay());
In AS2 I used this the loadMovie function to randomly display SWF's in the movieClip. From what I can tell loadMovie is not an option in AS3 making me think that using the UILoader may be a good solution.This is what my code looks like in AS2 (also attached the FLA file):
loadShow = function() { var today_date:Date = new Date();var dayOfWeek = today_date.getDay();trace(today_date.getDay());[code]....
I have a Width and Height parametr. I have been given an array of colors in such format: [r, g, b, a, r, g, b, a, r, g, b, a... etc] Data can be acsessed by something like this
for(var y = 0; y < height; y++) { for(var x = 0; x < width; x++) {
[Code].....
I want to paint that data on some sprite. How to do such thing?
BTW: I use Flash Builder for mxml+actionscript coding. So if it is easy for you you can give example using MXML (not todraw on some sprite but on some MXML component).
I have an image viewer which has both next and prev buttons and a thumbnail menu at the bottom. They are both loading images from the same array, I need to get them to talk to one another. For example: if I click one of the thumbs to take me to array4, then click the next button it will recognize array4 and go to array5. Right now the thumbnails don't send that information to the rest of the script.
Here's my script: stop(); import mx.transitions.Tween import mx.transitions.easing.* var photos_arr:Array = new Array( [Code] .....
I want to load an array with images in Main.as, by using a loader in another class. The problem is, I have to wait for the images to load before returning the array. How do I return the array images[] (once it's loaded) back to characterGFX[] in Main.as? I'm just lost.
Main.as
Code: package { public class Main extends Sprite{ private var gfx:Gfx = new Gfx();
I need to create a dynamic image gallery. The files are defined in an array like imgs = ['img1.jpg','img2.jpg']; then I loop through the array. The images should be arranged horizontally..
Code: this.imgs = ['test.jpg','bla.jpg']; var x = 0; var y = 0; var i; for (i in imgs) { var t = this.createEmptyMovieClip ("thumbnail" + i, i); var c = t.createEmptyMovieClip ("picHolder", 0); var thumb = imgs[i]; c.loadMovie (thumb); c._x = x + i * c._width; c._y = y; }
hows things, this is my first post on kirupa. Which i have found to be a great source of information regarding AS3 flash and so much more. I've set up an array which contains images fro a folder. when you click the thumbnail a larger version of the image with the name appears. I want to be able to click the previous or next button and move through the array eg;
var imgArray:Array = new Array (img1, img2, img3, img4)
if img3 is displayed and you press the previous button it loads img2 same with the next button
I'm converting Kirupa tutorial for AS2/XML gallery to a AS3 image gallery that works with AMFPHP.I'm running into a output error:TypeError: Error #1010 After some searching I found out that the script says that there's a undefined propperty in the script below. It should load an image from the Array "Image" in a empty movieclip wich excists on stage called "picture" ["picture"+0] is also used in other parts but then as ["picture"+p]. P=0 with an increment based on button clicks (previous and next)
function firstImage() { if (this.loaded == this.filesize) { picture.alpha = 0; var loader:Loader = new Loader();
Last week I had posted about getting a bit of clarification on dynamic tabs, as seen in this thread: [URL] The next step has my head spinning a bit. Here's the setup: This is a slideshow viewer, ala PowerPoint. Images are pulled in from an external directory via an array. Dynamic tabs are also generated in an array. Right now the demo has 10 images in the first array and 6 tabs in the second array:
[Code]...
now, some of the images will be part of a range - as in maybe the first three would fall under the "Safety" tab, next two under "Efficacy", etc....so when a viewer clicks on a tab the player loads up the first photo in that sequence. So: User clicks tab "X", this compares "X" with the range of images associated to "X" and loads the first in the sequence. Now, to add in more fun, there's a next and back button. So now if someone hits the next button then they should view sequentially the next image in the "X" image array (or sub-array). and the reverse for the back button. so my first thought is that I'd need to have the AS compare Safety with the imageList Array - something like
I have a PHP image object created using imagecreatetruecolor(). I'd like to send this via AMFPHP to Flash. I understand the best format is using a ByteArray. How can I achieve this without writing the image to the disk?