Friday 8 May 2009

Flexing

Today I was doing more flexing. Some problems I had were:

In a function called by a FocusEvent.FOCUS_OUT event, event.target.name gave me something like "UITextInput 257" rather than the actual name/id of the TextInput. The solution was to use event.currentTarget.name instead, which gave the actual name/id.

I had a function called by a DragEvent.DRAG_DROP event. In the function, I copied across the data being dragged to where it was being dropped, so I was also using event.preventDefault() to prevent the default behaviour of the data being copied, so it wouldn't be copied twice. However, this meant that after the data had been copied, the list where the data had been copied to would scroll up and down automatically depending on whether the mouse was above or below the list. (Obviously the list also needed to contain enough items for it to be scrollable).

I tried dispatching a DragEvent.DRAG_COMPLETE event from the UIComponent that the items were being dragged from, but still got the same problem. This may be that I don't know how to dispatch an event properly, or include the proper parameters needed for Flex to recognise the DRAG_COMPLETE event is related to the DRAG_DROP event that just occured.

Anyway, I fixed it by not event.preventDefault()ing, but instead blanking the DragSource so there wasn't any data for the event's default action to copy: event.dragSource = new DragSource();

Another problem was that if I added text to an input programatically, then it wouldn't save into the image's XMP, but if I typed the text manually, it would save. I tried dispatching an XMPEvent.XMP_MODIFICATION event from the UIComponent, but again this didn't work, again quite possibly I am not dispatching the event correctly or with the the correct parameters needed.

Anyway, I found that if I turned my XMPTextInput into a UIComponent that has a dataProvider e.g. XMPTextInputMRU, and a dataProvider was specified (even if it was empty), then it would save that field into the image's XMP. So I changed my XMPTextInput into a XMPTextInputMRU, then when I wanted to change it dynamically, I set its dataProvider to an empty string.

In the evening I watched an episode each of Lost, The Legend Of Zelda, and The New Super Mario World with Eck Moc and Lil' L. We also watched part of POTC2.

The weather today was a mixture of cloud and sun. It rained quite a few times and even hailed once, and was very windy again.

Food
Breakfast: Blackcurrant jam toast sandwich; cup o' tea.
Lunch: 2x cheese on toasts; stick of celery; cherry plum tomatoes; clementine; slice of cherry Madeira cake; Fox's Classic; cup o' tea.
Dinner: Fish pie; peas. Pudding was some mini jaffa cakes. Coffee; some chocolate bunny.
Supper: Cup o' tea; Choc chip Harvest Cheweee (yep, three 'e's) bar.

No comments: