Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8761737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:21:39+00:00 2026-06-13T15:21:39+00:00

I have very basic question about Flex SDK, but I didn’t find any resources

  • 0

I have very basic question about Flex SDK, but I didn’t find any resources for my problem and honestly don’t know if it even possible to do what I want. So here is my question:

I created Flex project with Adobe Flex Builder 4.6. Then I placed the button (let’s say it’s id is btn1) in main MXML file. I want to create second button dynamically right from the script part of main MXML file. Specifically I want to create it from button click handler of btn1.

Here is my MXML code (it is the only file in project ):

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx" 
               minWidth="955" minHeight="600">

    <fx:Script>
        <![CDATA[
            protected function btn1_clickHandler(event:MouseEvent):void
            {
                var btn2:Button = new Button();
                btn2.label = "Hello";
                btn2.x = 50;
                btn2.y = 50;
            }
        ]]>
    </fx:Script>


    <fx:Declarations>
        <!-- Non visual elements -->
    </fx:Declarations>

    <s:Button id="btn1" 
              x="10" y="10" 
              label="Кнопка"
              click="btn1_clickHandler(event)"/>

</s:Application>

But when I click btn1 – nothing happens. It is possible that I don’t understand something in flex programming paradigm – please point it out for me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T15:21:43+00:00Added an answer on June 13, 2026 at 3:21 pm

    You have to add the button to the view using addElement().

    var btn2:Button = new Button();
    btn2.label = "Hello";
    btn2.x = 50;
    btn2.y = 50;
    
    addElement(btn2);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Very basic question - but I couldn't find an answer. I have got a
This seems like a very basic question but I couldn't find any help on
I'm a Ruby newbie. Have a very basic question about static and instance variables.
This is a very basic question...quite embarassing, but here goes: I have a Stopwatch
I'm new to Flex/Actionscript and have a very basic question. Let's say I have
I have a very basic question about calculating RMSE in an NB classification scenario.
This is probably a very basic question but I haven't found any detailed information
This probably is a very very basic question but i can't seem to find
This might be a very basic question, but I could not find the answer
I have a very basic question about PHP. So, there is index.php that includes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.