As far as I know the swfupload 2.20 needs a to replace flash object dynamically (any other means that I don't know?). so my question is how to add onClick event to the button?
By the way, is there any particular document to swfupload 2.20? (The compatibility problems between flash 9 and flash 10 really cause me some trouble)
I just want to do some form
I just want to do some form validation and add some post parameters dynamically, is there a better way to do this in 2.20?
Use the events
Use the fileDialogStart event. Unfortunately this event cannot prevent the dialog from displaying.
We have some options. 1) We could modify the fileDialogStart event so it is executed before the dialog is shown and allow it to prevent the dialog from displaying. In order to do this we'd have to disable another bug fix for that event which means you would not be allowed to call any other SWFUpload functions while in the event (e.i., getStats, cancelUpload, etc).
2) Leave it as is and you do the validation earlier (e.g., validate on form field changes and disable/enable the button as needed).
You can use the fileQueued event to add post params to files. Or if you want to add them globally use the fileDialogComplete event.
However, be aware that once post params are added they don't automatically get updated if a form field changes. Usually the best time to add them is in the uploadStart event which is triggered immediately before the upload begins.
you mentioned in the first
you mentioned in the first option that we had to disable something in order to prevent the dialog from displaying. what was that? I mean how to do that? what have to disable?
is there any code samples?
Disabling the button
You have to disable the button.
Either in the settings you set button_disabled : true
or you call swfu.setButtonDisabled(true);
This disables the button and switches the button image to the disabled sprite.
Thank you gyphie~~
Thank you gyphie~~