Sunday, September 15, 2013

Flash Builder: Creating Converter App 3 (insert Function)


1) DOWNLOAD: Project File (Starter)


2) Add Event Handler for the button.
2a) Switch to Design Mode. Click the button.
2b) Click the drop-down button and select Generate Event Handler.




3) Check the generated codes.
It should be the word click only. Correct your codes if you get click.portrait or click.landscape.




4) Edit the function codes.
4a) Find the generated codes for the function "button1_clickHandler()".




4b) Replace // TODO Auto-generated method stub with the following codes:

if (String(radiogroup1.selectedValue)=="Inch") {
text2.text=String(text1.text);
text3.text=String(Number(text1.text)*2.54);
}
if (String(radiogroup1.selectedValue)=="Centimeter") {
text2.text=String(Number(text1.text)*0.393701);
text3.text=String(text1.text);
}




5) Run the app.
i)



ii)




iii)



iv)




DOWNLOAD: Project File (Completed)

No comments:

Post a Comment