We help IT Professionals succeed at work.
Get Started

Error in Simple Flex Example

armanbena asked
Last Modified: 2012-05-12

I am just starting out with Flex.  I was following an example and am getting an error in the function where I set the conditions for the label.text. Any ideas???
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"

      private function init():void{
      button3.addEventListener(MouseEvent.CLICK, handleClick);
      private function handleClick(event:MouseEvent):void {
      if (event.target == button2) {
      -->label.text = 'Button 2 clicked\n';
      else if (event.target == button3) {
      -->label.text = 'Button 3 clicked\n';

      <mx:VBox x="57" y="85" height="100%">
            <mx:Button id="button1" label="button1" click="label.text +='Button 1\n'"/>
            <mx:Button id="button2" label="button2" click="label.text +='Button 2\n'"/>
            <mx:Button id="button3" label="button3" click="label.text +='Button 3\n'"/>
            <mx:Label id="label" text="Label"/>
Watch Question
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE