Srikanth Duvvuri wrote:
Existing Code:
<input type="button" class="button" id="next" onClick="javascript:return multdrcrdet_ONCLICK17(this,this);">
Pseudo code of javascript:
function multdrcrdet_ONCLICK17(obj,p1)
{
var tmpBtnId = Obj.id;
if (tmpBtnId == 'Save' || tmpBtnId == 'Post') {
// do something
}
else {
// do something else
}
}
We are changing this functionality to use Flex.
How are you calling the JavaScript function?
http://www.moock.org/webdesign/flash/fscommand/
Disclaimer: I haven't tried this...
You can access the button object in your Flex app simply by referring to it by its name.
<mx:Application> <mx:Button id="Save" click="callExternalScriptFoo('Save')" /> </mx:Application>
In your JS you can refer to the button using its id:
// javascript function myFoo() { // flashMovie.Save is the button, where flashMovie // is the name/id of the Flex app (the SWF) }
Of course, if you only want to know which button was clicked, you can just use the name passed to the JS function.
BTW, it appears that you're using Flex _only for rendering the UI components_ and leaving the client-side logic to external JavaScript. Any reason why you can't port it to Flex (ActionScript)? Flex is more than just pretty buttons and menus.
Manish