ProfilerAgent Runtime Error when calling unload()

A few days ago I found an error with the Flex Builder 3 profiling mode.

If you load in a file and in decide to unload it in the same frame (note this is at runtime, not Flash keyframes as this is a Flex Builder Error) you get a Runtime Error that points to the ProfilerAgent class, something I never knew existed until this bug showed up. If you run the code through in debug mode then it works fine, it is only when in profiling that this happens.

I have updated the code for people to see here:

http://www.happyjimbo.com/misc/loading.zip

If you run the Fail.as file in profiling then you will see what I am talking about. I have also included a file called WorkAround.as which stops the bug from happening.

The test waits until the next before it calls the unload() function, which seems to work fine. This is just simply done by an ENTER_FRAME event being run and then killed after it has run once. Not the most elegant of solutions, but it works.

Why is this important? Well you can just press the dismiss button and there does not seem to be any issues.. However I have no confidence at all that the results the profiler is showing are accurate anymore, and in my line of work I need them to be.

I have raised this issue on the Flex Bug and Issue Management System, and the post can be found below, hopefully with details of what Adobe find to be the issue…

http://bugs.adobe.com/jira/browse/FB-13752

New FlashDevelop settings for Adobe Air

If like me you have installed the official Flex 3 SDK and have been hoping to play with Adobe’s AIR and want to use FlashDevelop you might have hit a bit of a brick wall.

Not wanting to make an MXML project, I have been having nightmare issues wondering why my application has not been compiling, turns out that with FlashDevelop 3.0 Beta 6, the XML file that is generated for your AIR Project (in the bin directory) is actually not correct for the full release of AIR and needs to be updated/changed.

I would advise others to do what I have done, and change the template settings for FlashDevelop’s AIR Project itself so that you do not have to make the changes each time.

In FlashDevelop go to Tools - Application Files This will then being up and explorer window, go to Templates - ProjectTemplates - 06 ActionScript 3 - AIR Projector and then open up the project file.

You can now open up the file in the bin directory called $(PROJECTID).xml.template in FlashDevelop and swap everything in the file to be the following:

<?xml version=“1.0″ encoding=“UTF-8″?> <application xmlns=“http://ns.adobe.com/air/application/1.0″>                 <id>$(PROJECTID)</id>     <version>0.1</version>     <filename>$(PROJECTID)</filename>             <initialWindow>         <content>$(PROJECTID).swf</content>         <visible>true</visible>         <systemChrome>none</systemChrome>         <transparent>true</transparent>         <width>800</width>         <height>600</height>     </initialWindow>         </application>

Now Close FlashDevelop, re-open it and create a new AIR Project, and this should now be able to compile.

I would also advise to make the changes to the same files within your Program Files - FlashDevelop - FirstRun, you will then see the Template folder, and from there it is the same as above.

Back from the dead

So it would seem that Director is alive and kicking with Adobe…

http://www.adobe.com/products/director

From a completely biased point of view, I think Adobe would do well to let developers use AS3 within Director 11 (with full sprite/movieclip support), and for it to be just as powerful as the lingo/javascript support. I suppose the main question is whether Director 11 will support ECMA4 javascript or not??

Even so, some of the 3d work done with director is amazing to say the least, and I think it is safe to say we will not be seeing any hardware support for the Flash Player anytime soon….

Why it isn’t (or is?) a good idea to use ’stage’ in as3

Whilst im confident that for those determined enough to load in external swf files they will find a way around this, I recently ran into a problem trying to load in an external swf whilst I was making a basic MXML swf loader. I kept on getting the horrid non-descriptive #1009 error everytime the external swf was loaded:

TypeError: Error #1009: Cannot access a property or method of a null object reference

It soon dawned on me that it could because I was using ’stage’ in the swf that was being loaded into my new file, and indeed this was the case. The code that was causing the error looked like this:

var levelDisplayManager:LevelDisplayManager = new LevelDisplayManager(); levelDisplayManager.init(stage);

I was passing ’stage’ down into the manager so that I would be able to add items to the DisplayList within the manager. I then remembered back to a conversation I had with a friend about AS2, and how he would create an empty MovieClip in his FLA and pass this to his main class, rather then passing ‘this’; so he could use it to display his objects. I thought it was so simple, yet brilliant due to how much more control he would have, so I decided to do the same thing but making sure to add the new MovieClip to the DisplayList in my ‘Main’ actionscript file:

var display:MovieClip = new MovieClip(); addChild(display);                         var levelDisplayManager:LevelDisplayManager = new LevelDisplayManager(); levelDisplayManager.init(display);

With this I am now able to import the swf file into my MXML program with no issues at all, and whilst it is just a simple thing to do, I believe that due to ActionScript 3’s unhelpful error reporting it could become one of those simple problems for many who are new to AS3.

Flash CS3 pricing vs Flex 2

Flash CS3 full:

£574.58 (inc vat)

Flex 2 full:

£151.25 (inc vat)

Now obviously Flex 3 will no doubt be out sometime soon, seeing as it has been in public beta for quite a while now, but will be interesting to see if it stays at the same price that Flex 2 currently is.

But what will be even more interesting to see is if Flashdevelop is able to do the ‘profiling’ (a break down of the memory resources that your swf is using, and where they are being allocated) with the Flex 3 SDK that Flex Builder 3 does, as that is by far its greatest appeal to me…

Choosing a theme

Right so only just installed wordpress and it was super easy, but the hardest part now is deciding on a theme to use.

There seems to be tons, and I just don’t have the time to look through them all, whilst I like this current design can anyone suggest any more good ones? If you are just bored and want to view through them all, they are here to view:

http://themes.wordpress.net/

Posted in Random. 1 Comment »