flex - I need a way to display an image conditionally based on text input -


I have a way to capture text from several input fields and then display the images next to the text that the text In the text field

imagine a user type in the text field:

Tomato Cabbage Chocolate

An image appears next to the tomatoes field and The second cabbage appears next to the field of cabbage etc.

I have text fields, I have a case statement, but I do not know how to combine components together or how to display the image.

It depends on what you are doing with it.

It seems that you want an image of tomatoes beside the tomatoes text field, one image of cabbage for the next cabbage, and also for chocolate. First of all, the user can not see any picture, but when the user types anything in those text areas, the image next to it appears suddenly. is that so?

If this is the case, then the easiest (though not the most efficient way) way to do this is to move forward and normally to add those images next to the text field, as if they were Will show in the program. Go ahead and keep them all in the right place where they are going, shape them, everything is the only difference here is that you have your own visible property on false Want to set up?

Then you can handle a different function, the event listener of the text field, or you are talking about a switch statement that is just a function that handles all those three text fields. Then:

  Personal Function On Change (Event: Event): Zero {if (event.target.text! = "") {Switch (event.target) {case txtTomatoes: imgTomatoes.visible = True; break; Case txtCabbage: imgCabbage.visible = true; break; Case txtChocolate: imgChocolate.visible = true; }}}  

This is the only way to do it, and it depends on what you want to go with it.


Comments