Custom OSMF Plugin with robotlegs issues with Child ApplicationDomain/getDefinition() ReferenceError: Error #1065: Variable

Ben Smith's Avatar

Ben Smith

13 Apr, 2011 03:44 PM

So i have created a custom OSMF player that uses robotlegs and this works great. I am now creating a OSMF plugin that also uses robotlegs and running into this issue about the Child AplicaitonDomain.
An OSMF Plugin get compiled into a swf and then loaded by the main player swf.

I was using robotlegs 1.1 that i now know dose not deal with any ApplicaitonDomain passing so i was hopeful that upgrading to 1.4 would fix this issue but it has unfortunately not.

im gettings the the dreaded ApplicationDomain/getDefinition() ReferenceError: Error #1065: Variable $classname

im thinking of putting together a testcase but just thought i'd drop you a line before doing that.


  1. 1 Posted by Ben Smith on 13 Apr, 2011 05:15 PM

    Ben Smith's Avatar

    ok so have built an example testcase together and it all works beautifully. doh
    although loading the testcase plugin into my real OSMF player is still not working to the problem must be there. i'll keep investigating and let you know my findings.

    BTW love a bit of robotlegs ... thanks shaun

  2. 2 Posted by Ben Smith on 13 Apr, 2011 05:43 PM

    Ben Smith's Avatar

    ok so i have managed to break my testcase with the same error im getting in my main project by adding a robotlegs context to the root sample player.

    var context:PlayerContext = new PlayerContext(this);

    So when it is not there everything work ok but as soon as both parent and child create a context it breaks.

  3. 3 Posted by Ben Smith on 13 Apr, 2011 05:50 PM

    Ben Smith's Avatar

    Not sure what can be done now over to you guy.

    I have attached my sample testcase projects
    there is 4 projects you have to load up in fb
    i was also using the latest Flex


  4. 4 Posted by Ben Smith on 14 Apr, 2011 12:15 AM

    Ben Smith's Avatar

    Ok and here is the solution / workaround that i have found.

    In the parent movie (i have not tried it the other way round) the one that loads the second swf i found that you could not explisity create the Context class with errors ... but if you getDefinitionByName on the context class it works fine:

    import flash.utils.getDefinitionByName;
    import flash.utils.getQualifiedClassName;

    var classname:String = getQualifiedClassName(PlayerContext);
    var PlayerClass:Class = getDefinitionByName(classname) as Class;
    var playerContext:IContext = new PlayerClass(this) as IContext;

    and you can call custom methods like this:

    (playerContext as PlayerContext).initPlayer();

    hopefully this will help someone not spend as much time as i have.


  5. 5 Posted by Maz Koba on 14 Apr, 2011 05:54 AM

    Maz Koba's Avatar

    Player with playhead updates, and all its takes to play... I see very little point in adding RobotLegs on it, I mean, Injection has a price.

    In the approach below, not even events are dispatched, but a reference of a interface to hold all events to make it cheaper (see image)

  6. 6 Posted by Ben Smith on 14 Apr, 2011 10:51 AM

    Ben Smith's Avatar

    Arrrrrrrr ok so this fix was a fale positive and dose not work ... back to the drawing board.

    here is my currently broken testcase.

    any suggestions would be great.

  7. Support Staff 7 Posted by creynders on 14 Apr, 2011 12:15 PM

    creynders's Avatar

    DId you define the applicationDomain for the child application correctly? Because if it's in its own sandbox, the loading application cannot access the classes inside it and vice versa.

  8. 8 Posted by Ben Smith on 15 Apr, 2011 06:54 AM

    Ben Smith's Avatar

    I'm not sure i have OSMF framework dose the loading ... i'll look into trying to do that but not sure how to atm.

    thanks creyders

  9. Support Staff 9 Posted by creynders on 15 Apr, 2011 08:02 AM

    creynders's Avatar

    Ok, then that's probably not the problem.
    I'm not sure whether this will solve your problem, but you shouldn't refer to the PlayerContext class directly in your main application, because it will get compiled into the same swf and that obviously defeats the purpose. You should define an interface for your PlayerContext class and cast the instance you create of it with getDefinitionByName to the interface. This way only the interface gets compiled into both swf's and not the PlayerContext class itself.
    That being said, to me it appears very strange that you'd create the PlayerContext class in the main application. I'm certainly no expert when it comes to modules, but I'd think you leave the instantiation of the PlayerContext class to the child application/document class and simply provide it with the necessary data to communicate to the main application class.

  10. Support Staff 10 Posted by Ondina D.F. on 01 Nov, 2011 05:17 PM

    Ondina D.F.'s Avatar

    Feel free to reopen this discussion in case you have more questions or you need further assistance with this issue. Please open new threads for new issues.
    Thank you for posting

  11. Ondina D.F. closed this discussion on 01 Nov, 2011 05:17 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac