Changin 1 item in Array changes all items Flex 2 beta 2

Ask a Question related to Macromedia Flex General Discussion, Design and Development.

  1. #1

    Default Changin 1 item in Array changes all items Flex 2 beta 2

    I change one item in my array and it ends up changing all the items in that
    array. I originally thought that the array was just string the memory
    location, which it may, so I added a blank constructor to my class which should
    grab a new chunck of memory but it still is not working correct. Any ideas
    would be great.

    Chester Copperpot Guest

  2. Similar Questions and Discussions

    1. Flex Builder 2.0 Beta Now Available for Mac OS X.
      Adobe Labs released the beta for Flex Builder 2.0 for OS X. It's Universal Binary and supports both Intel and PowerPC platforms. ...
    2. companies using flex 1.5 or flex 2 beta 3
      hi, can anyone let me inform abt the companies in india using Adobe Flex technologies with Java. I am proficient with flex 1.5 and looking ahead...
    3. Flex 2 Beta 3 Flex Component Explorer
      Is there some valid or explainable reason that every time I click on a component in the explore I am being asked to restart my computer?
    4. Flex 2 beta 3 tutorials
      In Getting Started with Flex 2.0 (Adobe Flex 2.0 Help) it says: "Ensure that a tutorials directory was created in the samples web application...
    5. Uninstalling Flex 2.0 Beta 1 (for upgrade to Beta 2)
      Hello all, Here it says to simply use the Add/Remove programs to uninstall the Beta 1 pieces:...
  3. #2

    Default Re: Changing 1 item in Array changes all items Flex 2beta 2

    Pretty sure this fixed it. In my constructor of my class I cast the objects to
    get a new chunk of memory. See attached code.

    Chris

    public function DateEvent(... args):void {
    if(args.length != 0){
    // this.DateEventArgs(args[0], args[1], args[2], args[3], args[4],
    args[5], args[6] );
    this._name = new String(args[0]);
    this._id = new Number(args[1]);
    this._startDate = new Date(args[2]);
    this._endDate = new Date(args[3]);
    this._recurringStartDate = new Date(args[4]);
    this._recurringEndDate = new Date(args[5]);
    this._frequency = new String(args[6]);
    } else {
    this._name = new String();
    this._id = new Number();
    this._startDate = new Date();
    this._endDate = new Date();
    this._recurringStartDate = new Date();
    this._recurringEndDate = new Date();
    this._frequency = new String();
    }
    }

    Chester Copperpot Guest

  4. #3

    Default Re: Changing 1 item in Array changes all items Flex 2beta 2

    Normally a constructor with optional arguments would be coded like this:

    public function DateEvent(name:String = "", id:String = "")
    {
    _name = name;
    _id = id;
    }

    I'm guessing your original problem was because all your Array elements were
    actually referencing the same DateEvent instance. You need each element to
    reference a different DateEvent instance. How are you populating the Array?

    GordonSmith Guest

  5. #4

    Default Re: Changing 1 item in Array changes all items Flex 2beta 2

    FROM UR Doubt WHAT I CAN understand is .,
    u want to fot the date right?

    The example uses the change event l to display the selected date in several
    different formats.

    main.mxml
    ---------------------
    <?xml version="1.0"?>
    <mx:Application xmlns:mx="<a target=_blank class=ftalternatingbarlinklarge
    href="http://www.adobe.com/2006/mxml">

    ">http://www.adobe.com/2006/mxml">

    </a> <mx:Script>
    <![CDATA[

    import mx.events.CalendarLayoutChangeEvent;

    private function useDate(
    eventObj:CalendarLayoutChangeEvent):void {

    // Make sure selectedDate is not null.
    if (eventObj.currentTarget.selectedDate == null) {
    return
    }

    //Access the Date object from the event object.
    day.text=eventObj.currentTarget.selectedDate.getDa y();
    date.text=eventObj.currentTarget.selectedDate.getD ate();

    month.text=eventObj.currentTarget.selectedDate.get Month();

    year.text=eventObj.currentTarget.selectedDate.getF ullYear();


    wholeDate.text=eventObj.currentTarget.selectedDate .getFullYear() +
    "/" + (eventObj.currentTarget.selectedDate.getMonth()+1) +
    "/" + eventObj.currentTarget.selectedDate.getDate();

    }
    ]]>
    </mx:Script>

    <mx:DateChooser id="date1" change="useDate(event)"/>

    <mx:Form>
    <mx:FormItem label="Day">
    <mx:TextInput id="day" width="100"/>
    </mx:FormItem>
    <mx:FormItem label="Day of month">
    <mx:TextInput id="date" width="100"/>
    </mx:FormItem>
    <mx:FormItem label="Month">
    <mx:TextInput id="month" width="100"/>
    </mx:FormItem>
    <mx:FormItem label="Year">
    <mx:TextInput id="year" width="100"/>
    </mx:FormItem>
    <mx:FormItem label="Date">
    <mx:TextInput id="wholeDate" width="300"/>
    </mx:FormItem>
    </mx:Form>
    </mx:Application>

    well ,,, the first line of the event listener determines if the selectedDate
    property is null. This check is necessary because selecting the currently
    selected date deselects it, sets the selectedDate property to null, then
    dispatches the change event.


    poonamsheth Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139