I have a series of images that are being dynamically loaded. I am using an array to specify the path of each individual image. I want to make my program cycle through the individual items of the array and load each image randomly until every image is loaded. While this is going on, I am using a conditional to detect if certain keyboard presses are invoked. The keyboard presses are specific to each array item. What are your opinions on how I should handle this keyboard event listener? How should I go about coding the array of images to be in sync with each specific keyboard press, and be able to detect when each image has been loaded? Please include sample actionscript you would use. Thanks, Sam
Not clear. Wether you want to load images randomly or on key press.
The images that will be loaded are a set list. However, I would like them to be random when the movie loads them so it is always a different sequence when the program runs. My biggest concern is how I will be able to sync the keypress events with specific images. Thanks, Sam
If I understand you correctly each image will have a different letter assigned to it. So, if you want to load the proper letter with the proper image make it a multidimensional array imageArray[ [#letter,#image], [#letter,#image] , [#letter,#image] ] imageArray[0][0] <-- would give you the letter of the first image imageArray[0][1] <-- would give you the image of the first image imageArray[1][0] <-- would give you the letter of the second image imageArray[1][1] <-- would give you the image of the second image and so on...
I hope you can arrange them randomly by using array and random(array.length) and array.splice option. You could capture keycode Like (A-Z are 65-90) So you can select an image from array using Key.getCode())-65.
Thank you for your replies! And also thank you for giving me new ideas for the software I am in the process of creating! I looked into your suggestions, and have come to the conclusion that I will be creating objects with simple strings relating to the images, and keyboard commands. These will then be put into an array. I will then be able to randomly cycle through the array, and directly reference the different object variables from within a loop statement. I am in my initial phase of development right now. I was curious as to the splice command you mentioned array.splice. Could you elaborate on how this could be useful? If you two users send me your email address directly, I will send you free versions of my software after it is released. Thank you, Sam
What is your email that I can send mine to? You could, if you did not already figure it out yet, call a random element in the array by doing: myArray[random(myArray.lenght)]
Array .splice is used to cut the entry from array. It's used generally to delete the entry once used so that it doesn't get repeated. I mean if you have an Array [a,b,c,d,e] if you select an item randomly, it may pick an item again. like first time it picks "a" second time "c" third time "a. ashish912@yahoo.com
My email is samuelspitnale@hotmail.com I really appreciate the help you have provided and would like to reward you with free versions of my software. It is training software related to adobe, macromedia, and microsoft office. Once It is completed and I have my site up and running I will give you free downloads of each. I am so greatful that you have shown me the splice command because it will help with my random array situation. Thank you both!
Don't see what you're looking for? Try a search.
|