Archive for category FlashDevelop

Log, trace, log, release, log?

Ok, this title doesn’t make sense if you haven’t read the article which goes against the concept of title, but I find it funny!

So here I was looking for a solution to the problem I think every Flash Developer most have had: I can trace fine when I am in the Flash IDE but sometimes I need to test in the browser and then I loose my traces…

Easy solution: use a logger tool like Alcon or MonsterDebugger.

Problem: it’s annoying. When you are at the point where you need the extra logger you need to find the ActionScript classes to make it work blabla.

What I want is an elegant solution that when I test locally it uses the trace and when I test in the browser it uses the logger. I was already using the snippet for trace in FlashDevelop so I thought I could make a snippet that would have this if statement and do just that. My first bump in the road was the fact that I didn’t know how to add an import statement when using a snippet at a different place in the code.

So while looking in the FlashDevelop forums I came upon FDTracer. Well it doesn’t exist anymore, it was a pluggin before but it is now an integral part of FlashDevelop. Turns out I always had it under my nose but I never knew about it. It would be nice if in the interface they actually tell what it is and how to use it.

So here are a couple of pictures to show you where that logger is. In FlashDevelop, under View it is called Flash Log Viewer and is by default one of the tab at the bottom of the program:

What this thing does is that it reads the logs that the Flash Player writes on the computer. You see, when you put the final swf on the server and the user plays it in his browser, all of your trace statements are written in the log file. That is why leaving trace statement in your final release is not that good for performance. Anyway one last thing to know is that you actually have to start it before it works. So press the little play button and start seeing your trace.

What is cool with this little thing is that it will work locally and in the browser, you don’t have do to anything(execpt press play) to make it work. Also if you feel spyish you can check the trace from Flash website made by others.

So yeah, please clean your traces…

, , , , , ,

10 Comments


My verdict on FDT

I said I would try FDT for a month and I am sad to say that I did not find it superior to FlashDevelop. FDT has some good sides and even stuff that it does better than FlashDevelop, here are some:

  • compile errors while editing
  • debugger
  • ant support

But it has two major problems, first it is built on Eclipse which makes it much more complicated than it should be. Secondly it is very expensive (well I had more problems with it than just that, but these are the game changers). I don’t even understand why it cost so much… It even cost more than Flash Builder. Anyway that seems weird to me, but maybe it’s just me. Anyway in comparison to FlashDevelop which is free, it doesn’t stand a chance.

While venturing in the FDT world we came across templates, snippets and short keys. Those are very useful things when you use them. Templates are also time savers when you are using PureMVC because when you want to create a Mediator, all you have to provide it is the mediator name, and it’s view  name and type and it will generate the rest; no more copy paste from other mediator. Also project template are very cool. Snippets are mini templates, for example to generate getters and setters. Short cuts are combination of keys you press to do an action instead of going trough a menu to do the same action. Well, it just happens that FlashDevelop has all those things, but I just wasn’t using them… So out of all this I came out with increased efficiency.

FDT might still be a very good tool, mostly if you are already familiar with Eclipse, but for me FlashDevelop is still the way to go. If  FlashDevelop gets a Debugger than I won’t even ask myself the question.

, , , ,

11 Comments


Compile time variables in Flash Develop

That is something that I have been wanting for a long time but I just found out how to do it.

So what is a compile time variable?

It is a variable that you can do conditions on at compile time (if) and the compiler will only include a set of lines in the resulting swf. This can be usefull for debugging purpose or when you have multiple languages or versions in a site. Let’s look at an example:

if (CONFIG::LANG == "en"){
  _pageHolder = new PageHolderEn();
} else {
  _pageHolder = new PageHolderFr();
}

In the previous code, if the compile time variable CONFIG::LANG is equal to “en”, than the line “_pageHolder = new PageHolderEn();” will be included in the final swf, otherwise it will be the other line. You can give a Boolean, int and String value (and probably other types too) to the variable.

So how do you set the value of that compile time variable?

Well there are a couple of examples out there about how to do so in Flash CS4 IDE or in Flash(Flex) Builder, but none in Flash Develop so that is what I am going to explain here. First if you do this in Flash Develop, it means you are either doing a Flex project or an ActionScript project (meanin you are compiling with the Flex compiler (is it still named like this?)). So once you have created your project, go in the Project Properties and in the Compiler Options tab, look for the Additional Compiler Options. Here is a screenshot of what it looks like:

compile-time

What you need to add in there is this:

-define+=CONFIG::LANG,"en"

Where CONFIG::LANG is your variable name and “en” is the value as a String.  For the variable name it seems to always be starting with CONFIG::, I don’t know if that is a convention or if that is needed so that the compiler knows its a compile time variable. I will need to do more reasearch on this. If you wanted to set the variable to a boolean you’d do this:

-define+=CONFIG::LANG,true

And same principle for a int, you’d put just the number without the quotes.

Now in Flash Develop, the project properties are stored in a file with the .as3proj extention so if you don’t want to have to change the Additional Conpiler Option you can just copy the project file and rename it. In the new file change the compile time value and depending how you want to compile, you open the right project file.

Well, it’s as simple as this.

, , , ,

1 Comment


New FlashDevelop beta version

This is just to tell you that there is a new version of the beta of FlashDevelop 3(ActionScript editor). There wasn’t any change since august 25th. I didn’t try it yet, but I soon will, it can only be better.

, ,

No Comments