Appendix A. Troubleshooting tips

While we’re always happy to answer questions on the forum, if your problem falls into the category of things that can happen to any Robotlegs project, this reference is probably the fastest way to get a solution. If you don’t find the answer here, or your problem is more closely tied to the specific details of your application, hit the forums and the community will help you out.

Problem: Injection doesn’t occur

This is probably the most common problem that developers working with Robotlegs for the first time experience. The usual causes are:

  • Broken injection point declaration

  • Metadata is being stripped by the compiler

  • Instantiating an object with injected dependencies using new

  • Injected properties are null in constructor

Broken injection point declaration

Because the Flash/Flex compiler can’t validate custom metadata, an error in your injection point you won’t produce a compiler error, you’ll just find that the injection hasn’t happened and the value is null.

This is what a healthy injected dependency looks like:

[Inject]
public var someValue:SomeType;

What’s gone wrong?

Did you make the property public? This won’t work because the injector can’t access the property to set it:

[Inject]
private var someValue:SomeType;

Metadata is case sensitive, so none of these will work:

[inject]  [INJECT]  [InJect]

A semi-colon between the metadata and the variable breaks the relationship, so this won’t work:

[Inject];
public var someValue:SomeType;

Metadata is being stripped by the ...

Get ActionScript Developer's Guide to Robotlegs now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.