Hey Manish The last part of your mail was very right.. as part of the phase-1, we are using flex only for ui rendering.. phase-2 would deal with moving some more logic into flex..
Coming to the code snippet that you sent.. do you think I can continue to use my javascript function and your mxmlcode.. I think NO.. can you suggest something so that my javascript function remains untouched i.e. it works on the id attribute of the parameter passed, and mxml passes a suitable value to it.. Thanks Srikanth -----Original Message----- From: Manish Jethani [mailto:[EMAIL PROTECTED] Sent: Monday, January 31, 2005 1:21 PM To: [email protected] Subject: Re: [flexcoders] How do you pass reference to button from MXML to javascript?? 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 Yahoo! Groups Links

