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

  • Home
  • SEARCH
  • 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 907919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:37:53+00:00 2026-05-15T16:37:53+00:00

I’ve got a really simple flex application, with a main file Rec.mxml : <?xml

  • 0

I’ve got a really simple flex application, with a main file Rec.mxml:

<?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="215" minHeight="138" width="215" height="138" backgroundAlpha="0.0">

 <fx:Script>
  <![CDATA[
   var rec:LRec = new LRec();
  ]]>
 </fx:Script>

 <fx:Declarations>
  <!-- Place non-visual elements (e.g., services, value objects) here -->
 </fx:Declarations>
</s:Application>

And an AS3 class:

package
{
 import mx.core.Application;
 import mx.events.FlexEvent;

 public class LRec extends Application
 {

  public function LRec()
  {
   trace("CONSTRUCTED"); 
   addEventListener(FlexEvent.APPLICATION_COMPLETE, this.mainInit); 
  }

  /**
   * After the application startup is complete, debug
   */
  public function mainInit(event:FlexEvent):void {
   trace("COMPLETE");
  }
 }
}

The trace ("CONSTRUCTED") is printed, but not "COMPLETE" — it looks like the FlexEvent.APPLICATION_COMPLETE event is never registering. Any ideas why?

Also, this is the first time I’ve really done this sort of programming, so if anything else looks wrong, please tell 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-05-15T16:37:53+00:00Added an answer on May 15, 2026 at 4:37 pm

    I’ve updated your code below with some comments on where you were going wrong. If you have any other questions feel free to ask.

    Test.mxml

    <?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="215" minHeight="138" width="215" height="138" backgroundAlpha="0.0"
        initialize="handle_initialize(event)"
    >
    
        <fx:Script>
            <![CDATA[
                import mx.events.FlexEvent;
    
                // Probably want to keep your rec object around
                private var rec:LRec;
    
                // Construct your LRec instance in the Application's inititialize state,
                // rather than declaring it statically.
                protected function handle_initialize(event:FlexEvent):void
                {
                    // Construct a new LRec instance, assign it to our private variable.
                    this.rec = new LRec();
    
                    // The <s:Applicaiton instance we define in this mxml is the object that 
                    // will actually dispatch the applicationComplete event, so we want to
                    // listen for that here and pass it on to our LRec instance's mainInit 
                    // method when it fires.
                    this.addEventListener(FlexEvent.APPLICATION_COMPLETE, this.rec.mainInit);
                }
            ]]>
        </fx:Script>
    
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
    </s:Application>
    

    LRec.as

    package
    {
        import mx.events.FlexEvent;
    
        // Don't inherit from Application, as you've already defined your application
        // in your mxml, and you should have only one Application instance per application.
        public class LRec
        {
    
            public function LRec()
            {
                trace("CONSTRUCTED");
    
                // Doesn't need the event listener anymore.
    
                // Do any instantiation needed.
            }
    
            /**
             * After the application startup is complete, debug
             */
            public function mainInit(event:FlexEvent):void {
                trace("COMPLETE");
    
                // Do any of the work that needs to wait for the applicationComplete
                // event to fire.
            }
        }
    }
    

    Here’s a good article (though a bit dated) on the Flex Instantiation Model.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
In my XML file chapters tag has more chapter tag.i need to display chapters
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I'm parsing an XML file, the creators of it stuck in a bunch social
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I've got a string that has curly quotes in it. I'd like to replace
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I am doing a simple coin flipping experiment for class that involves flipping a

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.