Makalele
Makalele

Reputation: 7521

Trace in FlashBuilder 4.7 not working

I'm using FlashBuilder 4.7 and Flex SDK 4.11.

I've created new Mobile Flex Project and created 2 files in default package:

bestPairs.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" 
           xmlns:bestpairs="*"
           width="640" 
           height="480">

<s:layout>
    <s:BasicLayout />
</s:layout>

<s:Label text="Hello World!" horizontalCenter="0" verticalCenter="0" />

<s:Button id="myButton"/>

</s:Application>

Main.as:

package 
{
import flash.events.MouseEvent;

import mx.events.FlexEvent;

import spark.components.Button;
import spark.components.Group;

public class Main extends Group
{
    public var myButton:Button;

    public function Main()
    {
        super();
        this.addEventListener(FlexEvent.CREATION_COMPLETE, onCreationComplete);

        trace("main!");
    }

    private function onCreationComplete(e:FlexEvent):void {
        this.removeEventListener(FlexEvent.CREATION_COMPLETE, onCreationComplete);
        myButton.addEventListener(MouseEvent.CLICK, onClick);
    }

    private function onClick(e:MouseEvent):void {
        // Do something
        trace("clicked!");
    }
}
}

because I want to split code from design. Anyway trace are not showing at all. In Debug Mode too. I tried also this: https://stackoverflow.com/a/3627826/1264375 (I made flex-config.xml file in src/config and added parameter to compiler - http://blog.flexexamples.com/2008/12/21/using-a-custom-flex-configxml-file-in-flex-builder-3/) and other googled solutions. Nothing is working I just see this:

[SWF] bestPairs.swf - 3,190,645 bytes after decompression

and later on:

[Unload SWF] bestPairs.swf

I'm using iPhone4 Air simulator to test app.

Is there any way to display trace logs? It's hard to develop without them.

Any help will be appreciated, Regards!

Upvotes: 0

Views: 268

Answers (1)

Josh
Josh

Reputation: 8149

Unless I am missing something, you never add a Main object to your application. For the trace to occur, you have to instantiate an instance of Main. Prior to that, none of the code in that class will run

Upvotes: 2

Related Questions