Robotlegs game with AIR
Hello everybody.
I want to port to AIR (and possibly on mobile devices) existing game created by using Robotlegs framework. The game consists of a menu (one SWF) which link with a few mini games (url to other SWF from the server). Everything works fine. I created AIR app and the game is normally displayed. All the mini-games are in the app folder and everything is OK.
Now I want to in AIR present only in the game menu and other mini-games is downloaded from the server and copied to the user's folder and the main SWF access them. But the problem now - mini-game SWF added to the display list, but they are not visible. That is, if I use the link to the SWF that in app folder, it works. If this link to the user folder, it does not work. There is no error. Naturally, all many times checked, SWF are there.
Any suggest, please. Thank you.
addContextListener(GametEvent.GAME_SELECTED, gameSelectedHandler);
private function gameSelectedHandler(event:SlotEvent):void{
_currentSlotURL = 'C:/Users/Astraport/AppData/Roaming/com.lll.slotsgametest.debug/Local Store/slots/slotfruit.swf'; //not work
_currentSlotURL = 'slots/slotfruit.swf'; //work
if (moduleLoader.getModule(_currentSlotURL, ApplicationDomain.currentDomain))
{
mainView.addModule(moduleLoader.create(_currentSlotURL) as DisplayObject);
}
else
{
mainView.showSlotPreloader();
addContextListener(Event.COMPLETE, completeHandler);
addContextListener(ProgressEvent.PROGRESS, progressHandler);
}
}
private function completeHandler(event:Event):void
{
removeContextListener(Event.COMPLETE, completeHandler);
removeContextListener(ProgressEvent.PROGRESS, progressHandler);
mainView.removeSlotPreloader();
mainView.addModule(moduleLoader.create(_currentSlotURL) as DisplayObject);
}
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | 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
Support Staff 1 Posted by Ondina D.F. on 14 Sep, 2012 11:32 AM
Hello,
I don’t think that the issue you are encountering has anything to do with robotlegs.
You can try something like this:
You should do a research on security restrictions, SecurityDomain, loading swfs in AIR..
Here, using cross-domain policy files:
http://help.adobe.com/en_US/Flex/4.0/UsingSDK/WS2db454920e96a9e51e6...
hth
Ondina
2 Posted by Stray on 14 Sep, 2012 12:13 PM
As Ondina says, for Air, secure loading is a little more complex - basically in order to load a swf such that it has app-sandbox privileges, it needs to be loaded as bytes, not using swfloader.
Obviously that's dangerous, as Air apps can do a lot of damage in the user's computer if abused. So, generally it's best to sign the swfs to be loaded (packaged as Air) with the same key as the main Air app doing the loading, and check those signatures on loading, rejecting any that fail.
If this is relevant... let us know - I have a utility that handles secure loading of swfs for air to give them in-app privileges, it's on my github and I have a blog post that explains how to use it.
hth,
Stray
Support Staff 3 Posted by Ondina D.F. on 14 Sep, 2012 12:36 PM
I’d like to try this utility, Stray! Link?
4 Posted by Stray on 14 Sep, 2012 12:41 PM
No problem :)
https://github.com/Stray/Air-Secure-Module-Loading
Support Staff 5 Posted by Ondina D.F. on 14 Sep, 2012 12:42 PM
Many thanks:)
6 Posted by Astraport on 14 Sep, 2012 01:57 PM
Thanks. I study it.
Support Staff 7 Posted by Ondina D.F. on 14 Sep, 2012 02:19 PM
You're welcome.
Ondina D.F. closed this discussion on 14 Sep, 2012 02:19 PM.