10 Replies Latest reply on Feb 4, 2009 9:09 PM by rahimhaji

    trace & Alert is not working

    rahimhaji Level 1
      Dear Friends,

      iam using snackr open source to evaluate and learn flex. i know Flash3 & AIR very well. iam New to Flex.iam trying to use trace or alert.show command in order to debug the coding. it is not giving out put. even it is not going to that line. i read the help file and searching for mm.cfg to edit and fix enabletrace =1.

      pls help me..

      Thanks and Regards,
      Syed Abdul Rahim
        • 1. Re: trace & Alert is not working
          RUSH-ME Level 3
          Hi

          Just check out for tracing
          Step1: Create a file named as mm.cfg inside the following path
          C:\Users\Username\mm.cfg
          Example:
          C:\Users\omm\

          Step2: Inside the mm.cfg file write the following code
          ErrorReportingEnable = 1
          TraceOutputFileEnable = 1

          Step3: The flashlog.txt file will be created in the following location
          C:\Users\omm\AppData\Roaming\Macromedia\Flash Player\Logs

          it is not going to that line means?
          Mind to post the sample code?
          • 2. Re: trace & Alert is not working
            Level 7

            "rahimhaji" <webforumsuser@macromedia.com> wrote in message
            news:gls7g4$r4o$1@forums.macromedia.com...
            > Dear Friends,
            >
            > iam using snackr open source to evaluate and learn flex. i know Flash3 &
            > AIR
            > very well. iam New to Flex.iam trying to use trace or alert.show command
            > in
            > order to debug the coding. it is not giving out put. even it is not going
            > to
            > that line. i read the help file and searching for mm.cfg to edit and fix
            > enabletrace =1.

            You'll only see trace statements in debug mode in Flex. Not sure about the
            Alerts.

            HTH;

            Amy


            • 3. Re: trace &amp; Alert is not working
              rahimhaji Level 1
              Dear Mr.Rushme,

              Thks for your reply, as u said, i creeated a folder called c:\user\syed.rahim\mm.cfg, and run the following code, i want to find the saving path of the file, i mean application storage

              i.e. trace(docRoot.nativePath); Alert.show(docRoot.nativePath);

              in some case i want to use trace for debugging, like certain function is getting fire or not? but the trace or alert is not working, basically i want to display a message and debug..

              code is:

              <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"
              applicationComplete="handleApplicationComplete(event)"
              frameRate="60"
              visible="false"
              autoExit="true">
              <mx:Style source="styles/styles.css"/>
              <mx:Script>
              <![CDATA[
              import ui.utils.UIUtils;
              import model.logger.Logger;
              import model.feeds.FeedModel;
              import model.options.OptionsModel;
              import ui.windows.SnackrMainWindow;
              import mx.controls.Alert;
              /**
              * Name of the database where we store all feeds and options. This file
              * is within the user's documents folder in the Snackr subfolder.
              */
              static private const DB_FILE: String = "FeedDatabase.sql";

              private var _mainWindow: SnackrMainWindow = null;

              private function handleApplicationComplete(event: Event): void {
              // Create the Snackr data folder if it doesn't exist (inside the user's
              // document's folder).
              var docRoot: File = File.documentsDirectory.resolvePath(UIUtils.appName);
              docRoot.createDirectory();
              trace(docRoot.nativePath);
              Alert.show(docRoot.nativePath);
              // Initialize the logger. The logger writes to the file Log.txt in the
              // Snackr data folder. We keep the previous 3 log files around.
              var oldLogFile: File;
              for (var i: int = 2; i >= 0; i--) {
              oldLogFile = docRoot.resolvePath("Log" + (i == 0 ? "" : String(i)) + ".txt");
              if (oldLogFile.exists) {
              try {
              oldLogFile.moveTo(docRoot.resolvePath("Log" + String(i+1) + ".txt"), true);
              }
              catch (e: Error) {
              // Too early to log this. Oh well. It just means that we won't be preserving
              // log files earlier than the current one.
              trace("Can't back up log file " + oldLogFile.name);
              }
              }
              }

              Logger.instance.initialize(docRoot.resolvePath("Log.txt"));

              Logger.instance.log("Snackr starting");

              // Open the Snackr database file and initialize the models from it.
              var feedModel: FeedModel = null;
              var optionsModel: OptionsModel = null;
              var sqlConnection: SQLConnection = null;
              var dbFile: File = docRoot.resolvePath(DB_FILE);
              try {
              sqlConnection = new SQLConnection();
              sqlConnection.open(dbFile);
              sqlConnection.compact();
              optionsModel = new OptionsModel(sqlConnection);
              feedModel = new FeedModel(sqlConnection);
              }
              catch (error: SQLError) {
              Logger.instance.log("Couldn't read or create the database file: " + error.details, Logger.SEVERITY_SERIOUS);
              throw error;
              }

              _mainWindow = new SnackrMainWindow();
              _mainWindow.initializeModels(sqlConnection, feedModel, optionsModel);
              var showInTaskbar: String = optionsModel.getValue(OptionsModel.OPTION_SHOW_IN_TASKBAR);
              if (showInTaskbar == "0") {
              _mainWindow.type = "lightweight";
              }
              else {
              _mainWindow.type = "normal";
              }
              _mainWindow.open();
              }
              ]]>
              </mx:Script>
              </mx:Application>

              Thanks and Regards,

              Syed Abdul Rahim
              • 4. Re: trace &amp; Alert is not working
                RUSH-ME Level 3
                Hi rahimhaji

                trace works on deguger mode. Have you installed the debugger for flex. what I think due to some exception its not going to the expected line. I.e. for showing message.

                Please checkout in line
                var docRoot: File = File.documentsDirectory.resolvePath(UIUtils.appName);
                docRoot.createDirectory();
                whether its working properly or not.



                • 5. Re: trace &amp; Alert is not working
                  RUSH-ME Level 3
                  Hi rahimhaji

                  trace works on deguger mode. Have you installed the debugger for flex. what I think due to some exception its not going to the expected line. I.e. for showing message.

                  Please checkout in line
                  var docRoot: File = File.documentsDirectory.resolvePath(UIUtils.appName);
                  docRoot.createDirectory();
                  whether its working properly or not.



                  • 6. Re: trace &amp; Alert is not working
                    rahimhaji Level 1
                    Dear Mr.Rush-me,

                    Thks for ur reply. i have debugger in my flex3 builder, once i press that bug symbol, i can see all the messages in console window down. but whatever i type at trace or Alert, my messages are not coming...

                    Thanks and Regards,
                    Syed Abdul Rahim
                    • 7. Re: trace &amp; Alert is not working
                      markuspedro Level 1
                      Hi,
                      when you using alert library make this operation:
                      digit in you code the letter A (like Allert) then per ctrl-space keys and choose alert.
                      In this way you are sure to have insert into code the allert library.
                      After make Alert.message("your message") .

                      Bye
                      Marco
                      • 8. Re: trace &amp; Alert is not working
                        markuspedro Level 1
                        Hi,
                        when you using alert library make this operation:
                        digit in you code the letter A (like Allert) then per ctrl-space keys and choose alert.
                        In this way you are sure to have insert into code the allert library.
                        After make Alert.message("your message") .

                        Bye
                        Marco
                        • 9. Re: trace &amp; Alert is not working
                          RUSH-ME Level 3
                          Hi Rahimhaji

                          Snackr is a AIR based application. But you are usung <mx:Application> tag where autoexit property is not available.
                          Use <mx:windowedApplication> instead of that.
                          Restart your program
                          Go through your code step by step.

                          Hope this helps

                          • 10. Re: trace &amp; Alert is not working
                            rahimhaji Level 1
                            Dear Mr.Rush-me,

                            Thks a lot, sure i will change. it is working now. i found that trace also working..

                            Thanks a lot, keep in touch,

                            Regards,
                            Syed Abdul Rahim