ActionScript 3 help, shuffling arrays: shuffling 3 cups.

Hi, I'm having a problem with this file. It's meant to shuffle 3 cups but I get this error: TypeError: Error #1010: A term is undefined and has no properties.
at cupsc_fla::MainTimeline/frame1().
It was working in AS2 but I changed it around to get it to work for AS3 but now it won't work.
Here's the code:
import fl.transitions.Tween;
import fl.transitions.easing.*;
import flash.events.*;
var posArray:Array = new Array(cup0.DisplayObject.x, cup1.DisplayObject.x, cup2.DisplayObject.x);
move_mc.addEventListener(MouseEvent.CLICK, pressBtn);
shuffle = function (targetArray) {
for (i=0; i<targetArray.length; i++) {
var tmp = targetArray[i];
var randomNum = Math.random(targetArray.length);
targetArray[i] = targetArray[randomNum];
targetArray[randomNum] = tmp;
function pressBtn(e:Event) :void{
shuffle(posArray);
var tween0 = new Tween(cup0, "_x", Strong.easeIn, cup0.DisplayObject.x, posArray[0], 1.5, true);
var tween1 = new Tween(cup1, "x", Strong.easeIn, cup1.DisplayObject.x, posArray[1], 1.5, true);
var tween2 = new Tween(cup2, "x", Strong.easeIn, cup2.DisplayObject.x, posArray[2], 1.5, true);
I'm stumped!

There are a number of potential issues with the code as you show it. 
cup0.DisplayObject.x,  ??? what are these
shuffle = function... change that to be written just like your pressBtn function
Math.random(nothing goes in here)... should be Math.random()*targetArray.length, although you want to get an integer value out of it, not a decimal value
As far as the 1010 error goes, go into your Flash Publish Settings and select the option to Permit Debugging.  That can help by adding the line number of the offending code to the error message.

Similar Messages

  • Need help for array counting

    Any help for array question
    Hello to All:
    I want to tally or count some of the elements that I have in array but not sure how.
    I have for example: int myArray[] = {90,93,80,81,71,72,73,74};My objective is to tally all of the 90's, tally all of the 80's and tally all of the 70's.
    So, the result that I want to have would look something like the following:
    System.out.println ("The total tally number of 90's is " 2 );
    System.out.println ("The total tally number of 80's is " 2 );
    System.out.println ("The total tally number of 70's is " 4 );I do not want to add these numbers, just want to count them.
    Also I want to use a "forloop" to achieve the result intead of just declaring it at 2 or 4 etc..
    Any help Thankyou

    [u]First , This is not exactly what I have to
    do for homework. There is a lot more, a lot more
    involved with the program that I am working on.
    Second, this is an example, an example, an
    example of something that I need to achieve.
    Third, you are asking for a code, to me that
    sounds as if your asking for homework. Fourth,
    I did not ask for any rude comments. Fith, in
    the future please do not reply to my messages at ALL
    if you can not help!!!!
    Sixth, We did not ask for lazy goofs to post here.
    Seventh, In the future please do not post here. Take a hike - there's the virtual door.

  • Help- Shuffle shows up on desktop, but not in iTunes

    So i guess i am luckier than some that it shows up at all, but it would be nice if it could show up in itunes. I also have a problem with the connection (usb) as it seems to disconnect itself without any movement. Any help would be much appreciated- Thanks, Andrew
    ps- i have a 1gig shuffle, ibook dual usb, osx 10.2.8
    and i got the ipod off ebay (am i screwed?)

    I guess it turns out that upon attempting to register my iPod Shuffle, Apple says that I have a counterfeit item. Here's their reply to my registration:
    "We regret to inform you that the serial number you have cited is recognized by our registration system as having the same format as a known series of counterfeit iPods. Please look closely to be certain that you have cited the serial number correctly. If not, please let us know the correct serial number of your product.
    Due to the incredible success of the iPod family of digital music players, a number of counterfeit devices have appeared on the market. Although they may bear Apple's name or logo, they are not manufactured or licensed by Apple.
    We would very much appreciate if you could send us a digital photo of your device by email.
    You should make a reservation and take your iPod to an Apple Store retail location to have it inspected at the Genius Bar, for the purpose of determining whether or not it is, in fact, a counterfeit product. To locate the nearest Apple Store and to make a reservation to see the Mac Genius, please visit <http://www.apple.com/retail>. If the Apple Store personnel conclude that the iPod is counterfeit, Apple will be unable to provide any kind of service or support for the product.
    Apple does not provide service or support for non-Apple products. We also suggest that you consult the vendor or reseller from which you obtained the product.
    Best regards,
    Apple Online Services Support
    Oh well, I guess I'm off the the Dispute Center of my paypal since this eBay seller used all the advertisement bearing Apple licenced product.

  • Please help - shuffle has stopped updating play count & date last played

    All of a sudden these features have stopped working. (I've had this shuffle since January and it worked just fine till last week.) If I play a tune from iTunes on the computer, the play count & date are updated; but if I play a tune on the iPod, this information doesn't change as it used to. Can anyone help me out? I've already restored etc.

    I had a similar problem and was able to recover. I deleted all files on the iShuffle including the hidden ones. On Windows I killed the iPodservice and iTuneshelper processes. That allowed me to view the iShuffle memory in an Explorer window. Blow away all of the files and directories. (Be sure they are not hidden.) Pull the iShuffle out, launch iTunes (to restart the services - or reboot to play it safe), and plug the iShuffle back in.
    Hope this helps!

  • Help - Shuffle not updating

    Anyone help?
    Last week I enabled my shuffle for complete disc use & now it wont revert to original setting. Ive reverted to 100% songs in the 'Display iPod options' but Autofill doing nothing and when i try to drag a song manually from library i get a message: "There is not enough free space on iPod to hold all of the selected songs". Am I doin something stupid?

    same problem here, but it wont let me use ipod updater it just sits there saying initializing and never does anything, itunes dont even recongnize my ipod i think it broke or something

  • Help Shuffle wont play!!!

    every time i turn my shuffle on to play it i press the play button but the status light blink orange and green over and over. Whats goin on???
      Windows XP  

    Your shuffle will blink orange and green also if you do not have any songs on it. If that's not the case check to see if the songs you have on the shuffle are the right format, this could also be causing the problem. If this still is not the issue do restore the ipod, but make sure after restoring it the songs you put on the shuffle are in fact the right format or you will continue to get the green and orange error light. Refer to knowledgebase article #300553 for complete step instructions.

  • Help: Shuffle dead

    When I connect shuffle to my desktop computer, nothing happens. The computer won't recognize my ipod shuffle. I tried to use ipod updater to reset the shuffle, but still the updater couldn't recognize the shuffle so i couldn't reset it.
    and the worst part is the warranty for my shuffle expired one month ago. Is there anything i can do to save the shuffle?
    i'm using WindowsXP.
    Any suggestion will be appreciated.

    Steps to save the Shuffle? Quien sabe? There are a lot of different things to try
    a. Start by running completely through the "Five R's"; that's always a starting point, but things don't end there. Do it all with fresh downloads of iTunes and iPod Updaters as required.
    Read and follow EXACTLY the steps involved in Restoring from the iPod Updater. It's critical to do things in the proper order and from the right starting conditions.
    (ii) Plug the Shuffle in with the power/slide switch to ON (any position). If no mounting after a while, manipulate, e.g., triple-click the Play/Pause, then turn the power OFF for 5 seconds or so,then back ON.
    b. Go through all of the troubleshooting steps on the iPod Shuffle Support Page that address Windoze/iTunes not seeing your Shuffle
    c. Try Restoring on a different platform. Do it on a Mac if at all possible (sorry, but that will work a fair amount of the time ..... it even works in reverse on some occasions).
    d. Try letting it sit in a charging source for an extended period of time, if that hasn't already occurred, to eliminate low battery as much as you can. You might see it suddenly mount.
    e. There's more besides. It involves reading through the material accessed via the iPod Shuffle Support Page and combing through these forums for solutions which have worked for others. Success can't be guaranteed, so good luck and happy hunting!

  • Help: Shuffle recognized/charges on PC, but will NOT WORK when ejected!

    Hello,
    My 2 year old shuffle suddenly doesn't work! I've tried the "five R's", used the Device Manager to reinstall the driver, or whatever, when it was plugged in, and restored it tons of times. The only thing I haven't done is completely uninstall/delete iTunes and reinstall, or used the original CD software for a restore.
    The iPod is recognized with no problems when plugged in; I can add and delete songs, and let it charge. But when I eject it and take it out nothing works, nothing at all!
    Any suggestions are greatly appreciated!
    Thank you.

    Are you saying the iPod dies as soon as you remove it from any sort of external power source such as a USB connection to your PC?  If so, it's likely that the iPod's battery is dead and in need of replacement, especially since the iPod is an older 2G model that has been around for some time.
    B-rock

  • Help with array's again

    Hello again
    I know im probably getting on peoples nerves now, but im still working on my lottery simulation. Ive tried different techniques, all of which have worked so far but now im trying a different way and have encountered a problem i cannot de-bug.
    Please can you have a look at my code, its probably obvious to most of you experts.
    int[] winners = new int[5];
    winners[0] = Lotto.drawBall();
    int num = Lotto.drawBall();
    for(int counter = 1; counter<5;){
        while(counter <= winners.length){
            if(num==winners[0] || num==winners[1] || num==winners[2] || num==winners[3] || num==winners[4]){
                num = Lotto.drawBall();
            else{
                winners[counter] = num;  //here is where my exception occurs
                counter++;
    System.out.print(winners[0]);
    System.out.println();
    System.out.print(winners[1]);
    System.out.println();
    System.out.print(winners[2]);
    System.out.println();
    System.out.print(winners[3]);
    System.out.println();
    System.out.print(winners[4]);I get an Array index out of bounds exception but i cannot see how.
    Please can you help me again??
    D_H

    int[] winners = new int[5];
    winners[0] = Lotto.drawBall();
    int num = Lotto.drawBall();
    for(int counter = 1; counter<5;){
    while(counter <= winners.length){ /*Here you should use counter < winners.length*/
    if(num==winners[0] || num==winners[1] ||
    s[1] || num==winners[2] || num==winners[3] ||
    num==winners[4]){
    num = Lotto.drawBall();
    else{
    winners[counter] = num;  //here is where
    re is where my exception occurs
    counter++;
    System.out.print(winners[0]);
    System.out.println();
    System.out.print(winners[1]);
    System.out.println();
    System.out.print(winners[2]);
    System.out.println();
    System.out.print(winners[3]);
    System.out.println();
    System.out.print(winners[4]);I get an Array index out of bounds exception but i
    cannot see how.
    Please can you help me again??
    D_Hcheck the while condition you are using count until it is equal to 5

  • Noob needs help with array manipulation

    First off, I'd like to say hello to eveybody!
    I'm trying to figure out how to search for a value in an array, delete the first occurence of it, and shift the rest of the array down one. Can anyone point me in the right direction of an algorithm, mabey?
    Any help is most appreciated!

    first of all, let me comment that for this purpouse, you're better using the ArrayList class.
    anyway, you would need to make a temporary array inside a method, and traverse the array in question using a loop. most people use a for loop.
    Then, put all the values of the old array into the temporary one, except for the one you dont want.
    after the loop, set the old array to equal the temporary array.

  • Require help on Array of Nested tables and Oracle Object type

    Hi All,
    I have a scenario where I have some millions of records received from a flat file and the record is stored in Table as below:
    Tablename: FILE_RECORD
    Rows:
    FILE_REG_ID = 1
    RECORD_NBR = 1     
    PROCESSED_IND = U
    RECORD= 00120130326006A
    FILE_REG_ID = 1
    RECORD_NBR = 2     
    PROCESSED_IND = U
    RECORD= 00120130326003
    1) I have to read these records at once and
    a) Split the RECORD column to get various other data Eg: Fld1=001, Fld2=20130326, Fld3 = 003
    b) send as an Array to Java.
    2) Java will format this into XML and sent to other application.
    3) The other application returns a response as Successful or Failure to Java in XML
    4) Java will send RECORD_NBR and the corresponding response as Success or Failure back to PLSQL
    5) PLSQL should match the RECORD_NBR and update the PROCESSED_IND = P.
    I 'm able to achieve this using SQL Table type by creating a TYPE for Each of the fields (Flds) however the problem is Java cannot Access the parameters as the TYPE are of COLUMN Types
    Eg: For RECORD_NBR
    SUBTYPE t_record_nbr IS FILE_RECORD.T010_RECORD_NBR%TYPE;
    Can you please let me know how I can achieve this to support Java, I know one way that is by creating an OBJECT TYPE and a TABLE of the OBJECT TYPE.
    Eg: T_FILE_RECORD_REC IS OBJECT
    FILE_REG_ID number(8), RECORD_NBR number (10), PROCESSED_IND varchar2(1), RECORD varchar(20)
    Create type T_FILE_RECORD_TAB IS TABLE OF T_FILE_RECORD_REC
    However I'm facing a problem to populate an Array of records, I know I'm missing something important. Hence please help.
    It would be helpful to provide some guidelines and suggestions or Pseudo or a Code to achieve this. Rest all I can take up further.
    Thanks in advance,

    I know once way that is creating a OBJECT TYPE and a TABLE of OBJECT TYPE, howeve I feel I'm missing something to achieve this.You're right, you need SQL object types created at the database level. Java doesn't know about locally defined PL/SQL types
    However you can do without all this by creating the XML directly in PL/SQL (steps 1+2) and passing the document to Java as XMLType or CLOB.
    Are you processing the records one at a time?

  • Need Help with Arrays/Text

    I'm trying to create a flash program that uses it's own code to send and create images. Each square has a colour and that colour gets added into the array. A black, then grey, then white is:
    filecode = ["Bl", "Gr", "Wh"];
    That works fine, but when I try to paste it into an Input text box it will only fill in the first part of the array.
    filecode = ["Bl,Gr,Wh"];
    So the program has NO idea what I want.
    The only ways I can think of fixing this is by putting in 402 text boxes to suit every box...But every one of them needs a Variable Name.
    Or by sending the information straight into the array. But this way you are just looking at what you just drew, and that is not at ALL practical.
    Helping me with this headache will be greatly apprectiated.
    FlashDrive100.

    If you can explain the first part of your posting it might become a little clearer what you are trying to do and what isn't working... particularly this...
    " when I try to paste it into an Input text box it will only fill in the first part of the array."
    I can't speak for anyone else, but at this point, I share your file's problem... not knowing what you want.

  • Please help, 2D Array of Vectors and Incompatible types :(

    I have a 2D array of vectors called nodeLocations but when I try and access the vector inside I get a compile error.
    My code is something like this:
    nodeLocations[j].addElement(noArc)
    My editor picks up that its a Vector and shows me addElement as an acceptable entry to put after the "." yet the compiler says:
    "addElement(java.lang.Object) in java.util.Vector cannot be applied to (int)"
    Can someone please help?
    Thank you in advance.
    also a related problem:
    I get inconvertible types (says int required) when I try and get an element from a vector stored in a 2D Array. I know that it comes out as an object and so should be cast but it does not seem to work. My code is as follows:
    else if (((int)(nodeLocations[nodeNumber][adjNodeNumber].elementAt(0))) != distance)
    I would appreciate any help anyone can give.
    Similar errors to the above two happen when
    I try a push with a Stack in a vector.
    I try to get something out of the stack inside the vector.

    The Vector class's addElement() method requires an Object parameter. It appears that you're trying to add an int to the Vector. You'll need to create an Integer object and place that into the vector (see sample below) or use the pre-release version of JDK 1.5 which provides autoboxing capabilities.
    int z = 5;
    Integer x = new Integer(z);
    nodeLocations[j].addElement(x);

  • Help with arrays and Exception in thread "main" java.lang.NullPointerExcept

    Hi, I have been having trouble all day getting this array sorted and put into a new array. I think it is something simple with my nested loops in sortCityArray() that is causing the problem. Any help would be greatly appreciated. The error is thrown on line 99 at Highway.sortCityArray(Highway.java:99)
    import java.util.Scanner;
    import java.io.*;
    import java.util.Arrays;
    public class Highway
    private String[] listOfCities=new String[200];
    private City[] cityArray=new City[200];
    private City[] sortedCityArray=new City[200];
    private String city="";
    private String city2="";
    private String fileName;
    private City x;
    private int milesToNextCity;
    private int milesAroundNextCity;
    private int speedToNextCity;
    public Highway(String filename)
    String fileName=filename;//"I-40cities.txt";
           File myFile = new File(fileName);
           try {
           Scanner scan=new Scanner(myFile);
           for(int i=0; scan.hasNextLine(); i++){
           String city=scan.nextLine();
           String city2=scan.nextLine();
           int milesToNextCity=scan.nextInt();
           int milesAroundNextCity=scan.nextInt();
           int speedToNextCity=scan.nextInt();
                   if(scan.hasNextLine()){
              scan.nextLine();
           cityArray=new City(city,city2,milesToNextCity,milesAroundNextCity,speedToNextCity);
    // System.out.println(cityArray[i].getCity());
    // System.out.println(cityArray[i].getNextCity());
    // System.out.println(cityArray[i].getLengthAB());
    // System.out.println(cityArray[i].getLengthAroundB());
    // System.out.println(cityArray[i].getSpeedAB());
    catch (Exception e) {
    System.out.println(e);
    //return cityArray;
    /*public City[] doCityArray(){
    File myFile = new File(fileName);
    try {
    Scanner scan=new Scanner(myFile);
    for(int i=0; scan.hasNextLine(); i++){
    String city=scan.nextLine();
    String city2=scan.nextLine();
    int milesToNextCity=scan.nextInt();
    int milesAroundNextCity=scan.nextInt();
    int speedToNextCity=scan.nextInt();
         if(scan.hasNextLine()){
              scan.nextLine();
    cityArray[i]=new City(city,city2,milesToNextCity,milesAroundNextCity,speedToNextCity);
    // System.out.println(cityArray[i].getCity());
    // System.out.println(cityArray[i].getNextCity());
    // System.out.println(cityArray[i].getLengthAB());
    // System.out.println(cityArray[i].getLengthAroundB());
    // System.out.println(cityArray[i].getSpeedAB());
    catch (Exception e) {
    System.out.println(e);
    return cityArray;
    public City[] sortCityArray(){
    sortedCityArray[0]=new City(cityArray[0].getCity(),cityArray[0].getNextCity(),cityArray[0].getLengthAB(),cityArray[0].getLengthAroundB(),cityArray[0].getSpeedAB());
    for(int j=0; j<cityArray.length; j++ )
         for(int i=0; i<cityArray.length ;i++)
              if(sortedCityArray[j].getNextCity().equals(cityArray[i].getCity())){
              sortedCityArray[j+1]=new City(cityArray[i].getCity(),cityArray[i].getNextCity(),cityArray[i].getLengthAB(),cityArray[i].getLengthAroundB(),cityArray[i].getSpeedAB());
              break;
    /*     for(int i=0; i<cityArray.length ;i++)
              if(sortedCityArray[j].getNextCity().equals(cityArray[i].getCity())){
              sortedCityArray[j+1]=new City(cityArray[i].getCity(),cityArray[i].getNextCity(),cityArray[i].getLengthAB(),cityArray[i].getLengthAroundB(),cityArray[i].getSpeedAB());
         break;
              for(int i=0; i<cityArray.length ;i++)
              if(sortedCityArray[j].getNextCity().equals(cityArray[i].getCity())){
              sortedCityArray[j+1]=new City(cityArray[i].getCity(),cityArray[i].getNextCity(),cityArray[i].getLengthAB(),cityArray[i].getLengthAroundB(),cityArray[i].getSpeedAB());
         break;
              for(int i=0; i<cityArray.length ;i++)
              if(sortedCityArray[j].getNextCity().equals(cityArray[i].getCity())){
              sortedCityArray[j+1]=new City(cityArray[i].getCity(),cityArray[i].getNextCity(),cityArray[i].getLengthAB(),cityArray[i].getLengthAroundB(),cityArray[i].getSpeedAB());
         break;
    //     j++;
    System.out.println(sortedCityArray[0].getCity());
    System.out.println(sortedCityArray[0].getNextCity());
    System.out.println(sortedCityArray[0].getLengthAB());
    System.out.println(sortedCityArray[0].getLengthAroundB());
    System.out.println(sortedCityArray[0].getSpeedAB());
    System.out.println(sortedCityArray[1].getCity());
    System.out.println(sortedCityArray[1].getNextCity());
    System.out.println(sortedCityArray[1].getLengthAB());
    System.out.println(sortedCityArray[1].getLengthAroundB());
    System.out.println(sortedCityArray[1].getSpeedAB());
    System.out.println(sortedCityArray[2].getCity());
    System.out.println(sortedCityArray[2].getNextCity());
    System.out.println(sortedCityArray[2].getLengthAB());
    System.out.println(sortedCityArray[2].getLengthAroundB());
    System.out.println(sortedCityArray[2].getSpeedAB());
    System.out.println(sortedCityArray[3].getCity());
    System.out.println(sortedCityArray[3].getNextCity());
    System.out.println(sortedCityArray[3].getLengthAB());
    System.out.println(sortedCityArray[3].getLengthAroundB());
    System.out.println(sortedCityArray[3].getSpeedAB());
    System.out.println(sortedCityArray[4].getCity());
    System.out.println(sortedCityArray[4].getNextCity());
    System.out.println(sortedCityArray[4].getLengthAB());
    System.out.println(sortedCityArray[4].getLengthAroundB());
    System.out.println(sortedCityArray[4].getSpeedAB());
    return cityArray;
    /*public String[] listOfCities(){
    File myFile = new File("I-40cities.txt");
    try {
    Scanner scan=new Scanner(myFile);
    for(int i=0; scan.hasNextLine(); i++){
         String city=scan.nextLine();
         city=city.trim();
    scan.nextLine();
    scan.nextLine();
         listOfCities[i]=city;
         System.out.println(listOfCities[i]);
    catch (Exception e) {
    System.out.println(e);
    return listOfCities;
    public static void main(String args[]) {
    Highway h = new Highway("out-of-order.txt");
    h.sortCityArray();

    the ouput is perfect according to the print lines if I use (increase the int where j is in the loop manually by one) :
         for(int i=0; i<cityArray.length ;i++)
              if(sortedCityArray[0].getNextCity().equals(cityArray.getCity())){
              sortedCityArray[0+1]=new City(cityArray[i].getCity(),cityArray[i].getNextCity(),cityArray[i].getLengthAB(),cityArray[i].getLengthAroundB(),cityArray[i].getSpeedAB());
              break;
         for(int i=0; i<cityArray.length ;i++)
              if(sortedCityArray[1].getNextCity().equals(cityArray[i].getCity())){
              sortedCityArray[1+1]=new City(cityArray[i].getCity(),cityArray[i].getNextCity(),cityArray[i].getLengthAB(),cityArray[i].getLengthAroundB(),cityArray[i].getSpeedAB());
         break;
              for(int i=0; i<cityArray.length ;i++)
              if(sortedCityArray[2].getNextCity().equals(cityArray[i].getCity())){
              sortedCityArray[2+1]=new City(cityArray[i].getCity(),cityArray[i].getNextCity(),cityArray[i].getLengthAB(),cityArray[i].getLengthAroundB(),cityArray[i].getSpeedAB());
         break;
              for(int i=0; i<cityArray.length ;i++)
              if(sortedCityArray[3].getNextCity().equals(cityArray[i].getCity())){
              sortedCityArray[3+1]=new City(cityArray[i].getCity(),cityArray[i].getNextCity(),cityArray[i].getLengthAB(),cityArray[i].getLengthAroundB(),cityArray[i].getSpeedAB());
         break;
    But I cant do this for 200 elements. Are the loops nested right?
    Edited by: modplan on Sep 22, 2008 6:49 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Help with arrays in PHP

    Hi All,
    I have created a page that shows thumbnail images of all
    images in a
    given directory. Here is the function that searches the
    directory and
    builds an array of qualified files:
    > function getImages($dir) {
    > $directory = new DirectoryIterator($dir);
    > $fileTypes =
    '#\.jpg$|\.jpeg$|\.gif$|\.png$|\.JPG$|\.GIF$|\.PNG$#i';
    > $filtered = new RegexIterator($directory, $fileTypes);
    > $array = array();
    > foreach ($filtered as $item) {
    > $array[] = $item->getFilename();
    > }
    > return new ArrayIterator($array);
    > }
    >
    > // get an ArrayIterator of filenames and the total
    number:
    > $images = getImages('../images/images_news/');
    > $totalImages = $images->count();
    Here is the HTML and PHP used to display the images (I'm
    excluding code
    that is specific to the paging function):
    > // Implement offset and files per page
    > foreach (new LimitIterator($images, $offset,
    $filesperpage) as
    > $image) { ?>
    > <div class="imgcont">
    > <div class="imgholder">
    > <img src="../images/images_news/<?php echo $image;
    ?>"
    > alt="<?php echo $image; ?>" height="55"
    class="center" />
    > </div>
    > <p class="smallname"><?php echo $image;
    ?></p><br />
    > </div>
    > <?php } ?>
    > <div class="clear"><br />
    My question is this. I need to provide a way to delete images
    that will
    no longer be needed. Actually, I need to be able to delete
    the main
    image and the thumbnail image, each of which is in a separate
    directory. What I don't know is how this type of thing is
    normally done
    (I don't want the FTP route because I don't want a client
    messing about
    in the directory structure). And what I don't understand is
    how to
    select one or more files to delete when they were produced by
    an array.
    For ease of use, it would be nice if I could add a checkbox
    that the
    user could check to indicate that the image(s) should be
    deleted. I
    just can't figure out how to select the file(s). I sure hope
    this is
    not one of those simple things that will make me hide my head
    in shame.
    Any help would be most appreciated.
    Brett

    Brett wrote:
    > the thumbnail images now have _tmb inserted between
    > the file name and the extension. So when deleting I keep
    getting
    > warnings that the file mypic001.jpg cannot be found in
    the thumbs
    > directory. How do I get the _tmb into the file name?
    foreach ($_POST['images'] as $image) {
    unlink($mainImgDir . $image);
    $pos = strrpos($image, '.');
    $thumb = substr($image, 0, $pos) . '_tmb' . substr($image,
    $pos);
    unlink($thumbsDir . $thumb);
    > By the way, you used unset() where I think you meant
    unlink().
    Yes, I did. Sorry about that.
    > Finally, I have discovered that if I upload a file named
    Ti301.JPG, I
    > get Ti301.JPG001_thb.jpg. It seems that the strtolower()
    function in
    > getNextFilename5.php is not converting the uppercase
    extension, it is
    > just adding the incremented number plus _tmb and the new
    extension. Any
    > ideas about how to correct that?
    That shouldn't be happening, but I don't have time to look
    into that
    now. Sorry.
    David Powers, Adobe Community Expert
    Author, "The Essential Guide to Dreamweaver CS3" (friends of
    ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

Maybe you are looking for

  • A charicteristic  exists in a query,but i can't  find it in the cube from

    Hi: There is a charicteristic  in a query, but i can't  find it in the char list in the multiinfocube from which the query retrieve data.  so  why did the charicteristic exist in the char list of the query?

  • Cannot import Java classes to form

    I am using Forms Forms [32 Bit] Version 10.1.2.0.2 (Production). I want to use the Persian Calendar from this web-site http://persiancalendar.sourceforge.net/. I download the stuff and there are 2 JAR files. I did this: -- Put the JAR files in my E:\

  • Fetch Netvalue and Sales order No.

    Hi Friends Kindly help me to Fetch 'Sales Order Number' and 'Net Value of the Sales Order in Document Currency' before Saving the Sales Order since i need to store in custom table. Thanks in Advance

  • Looking for awesome Flex developers

    I'm looking for awesome Flex developers who are interested in creating real-time collaborative applications. Deadline is 7 of May. You may call it a race. The apps created are automatically registered in a public voting system. The most popular app c

  • I missing some new iO6 features

    So, I recently updated my phone's software to the latest.  Right away I noticed that when someone calls, I'm missing the additional options:  reply with message & remind me later.  Why is that missing??  Is there a way to fix this missing feature WIT