This content has been marked as final.
Show 10 replies
-
1. Re: trace & Alert is not working
RUSH-ME Jan 29, 2009 5:26 AM (in response to rahimhaji)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
Newsgroup_User Jan 29, 2009 5:47 AM (in response to rahimhaji)
"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 & Alert is not working
rahimhaji Feb 1, 2009 9:42 PM (in response to RUSH-ME)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 & Alert is not working
RUSH-ME Feb 2, 2009 12:25 AM (in response to rahimhaji)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 & Alert is not working
RUSH-ME Feb 2, 2009 12:33 AM (in response to rahimhaji)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 & Alert is not working
rahimhaji Feb 2, 2009 2:06 AM (in response to RUSH-ME)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 & Alert is not working
markuspedro Feb 2, 2009 2:28 AM (in response to rahimhaji)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 & Alert is not working
markuspedro Feb 2, 2009 2:28 AM (in response to rahimhaji)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 & Alert is not working
RUSH-ME Feb 4, 2009 4:55 AM (in response to rahimhaji)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 & Alert is not working
rahimhaji Feb 4, 2009 9:09 PM (in response to RUSH-ME)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


