Ask a Question related to Macromedia Flex General Discussion, Design and Development.
-
Chester Copperpot #1
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
-
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. ... -
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... -
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? -
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... -
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:... -
Chester Copperpot #2
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
-
GordonSmith #3
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
-
poonamsheth #4
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



Reply With Quote

