Using Radio Buttons

 

7 points

 

Introduction

In this app, you use radio buttons to give the user a choice of which image to display in an Image box. The user makes a choice by clicking a radio button and then a button.

If one of the radio buttons is named 'radio1', you can get detect if this button has been selected using this code:

if (getChecked("radio1"))

If the Image box is named "imgAlbum" and the image you want to display is "sgtPepper.png", you can display the image using this code:

setImageURL("imgAlbum", "sgtPepper.png");

You can also write this program without adding a button in addition to the radio buttons. Just create an onEvent() for each radio button and then choose the image you want to display if that radio button is selected.

 

 

Video

The video shows what a completed app should do.