This content has been marked as final. Show 5 replies
var myItem: Object = event.target.selectedItem;
downloadLink = myItem.url;
Thanks for reply
Can i use associated Array or something like this? which is more close to data container?
I don't know much about the guts of flex, but I assume it's based on Java's design etc.
Storing event.target.selectedItem in an objet should not be anymore efficient than calling event.target.selectedItem. The objet will simply be a pointer of sorts to event.target.selectedItem. At no point in the event.target.selectedItem call are you doing a search or something, so storing the result will not result in any big savings.
Now, if you were doing something like array.findItem(something) 4 times, then yes, it would be to your advantage to store the data.
Keep in mind that storing event.target.selectedItem in an object will probably break bindings....that may or may not be a problem. Objet doesn't support binding. There is a subclass of Object that does, but I forget which.
Just a suggestion based on my knowledge of how data is stored in an object oriented language...this may not be the case in flex.
Well, to access those 4 pieces of data you will need to access "something" 4 times, no way around that.
The question becomes, do you need that data to be saved for later use elsewhere? Probably not if the data is only relevant when the user has made a selection and can change their selection at any time.
That's just part of programming, there are lots of properties and methods in each class, and you often need to access each individually.
Got my Answer, Thanks to you :D
Thanks, i was actually shorteing the code ;)