Archive

Archive for March, 2008

Runtime Sharing problems solved for good!

March 25th, 2008 1 comment

I stayed at work until 8:00 pm today because I could not figure out why I was getting a #1065 Reference Error when using Runtime Sharing.

The scenario

A main ActionScript application loads multiple swf files (screens). These swf import various symbols from a central swf (global_asset_library). When I load the first screen, I can see in ServiceCapture that the global_assets_library is requested, because the screen imports assets from it. When I load a second screen that should import assets from the same library, it does not request it, probably because it’s cached. It however displays a #1065 error and leaves a blank where I should have seen my beautiful scenery. So I could not load any subsequent screens because they use Runtime Sharing.

What happened internally?

From good old-fashioned trial-and-error and some incomplete documentation, I figured out that each swf, by default, loads the global_asset_library in its own context (security domain). That means that any other screen is now prohibited from accessing whatever was loaded by the first screen. Our global_asset_library (and I stress Global) now became the sole property of the first screen. Not what we want.

What do we do now?

We use a nice little class called LoaderContext from the flash.system package (AS projects don’t need to be converted to Flex – yay!). This LoaderContext will allow us to load all swf into the application, instead of the swf that requests it.

Show us the code!

var request:URLRequest = new URLRequest(swfPath);
var context:LoaderContext = new LoaderContext();
context.applicationDomain = ApplicationDomain.currentDomain;
var loader:Loader = new Loader();
loader.load(request,context);

2008 PHP Quebec Conference is now over

March 16th, 2008 No comments

The conference is now over. I got 16 hours of sleep and am ready to work on the video that will be provided to the visitors and speakers within a few weeks (90% certainty).

The conference gets better each year. This year we got better food and I am sure that everyone from last year noticed. The wireless was actually working this year. No PHP conference can go by without it. It did take us a couple of hours to fix it in the beginning though so I ask forgiveness from the first speakers who were limited by that fact. We organized a job fair and a cocktail with free drinks for everyone.

I saw a few sessions and they were really great. The PHP Labs that were a new concept this year were also great. There was much interactivity and the feedback from the visitors was positive.

The post-conference activities (restaurant, 2 Pierrots and sugar shack) were really fun. I can’t wait for next year!

Please post links to photo albums in the comments.

Tags:

2008 PHP Quebec Conference

March 15th, 2008 No comments

The 2008 edition of the conference is almost over (we have yet to go to the sugar shack). The event was a total success. For the first time, all tickets we sold out. We had wonderful sponsors that allowed us to do more than before (elePHPants, job fair, cocktail…) We had very good speakers and quality presentations. I talked to many visitors and they were all very happy with the event. It is always a pleasure for me to organize this event and I will surely start planning next year’s edition soon. Thanks to all the volunteers who helped us to keep the conference smooth.

Tags:

Data Binding expressions

March 7th, 2008 No comments

In MXML, you may use expressions as a source of data binding.

Example:

<mx:Label text="Beer" visible="{age >= 18}" />

The Label will only be displayed if the person is 18 or older.

Did you try a more complex expression?

<mx:Label text="Beer" visible="{age >= 18 && gender == 'male'}" />

Ah ha! You get a compiler error. Why? Because you’re inside MXML and the & character is special.

Solution: replace the & with &amp;

<mx:Label text="Beer" visible="{age >= 18 &amp&amp; gender == 'male'}" />
Tags: ,

[Bindable] public override

March 7th, 2008 3 comments

I stumbled upon a compiler error when overriding a setter function with the Bindable metadata tag: “overriding a function that is not marked for override”

The answer is short and simple: use –[Bindable] public override– instead of –[Bindable] override public–
It may sound silly but the override actually has to come second in order for the compiler to interpret it properly in this particular situation.

Tags: ,