AS3 Multiple Application Domain using local null.swf file - ios

I have the following issue, I cannot find a solution on the web, please let me know if you can help me or point me to a proper info about this issue.
To understand the background, Im porting a game from flashDevelop to Flash Builder (please dont give me tips about this comment if doesn't help to my particular problem). Everything works fine right now, the game use a file null.swf as a container of local files (I don't undertand that part completely, but the game has a lot of embed swc files, and the game use the null.swf to access those files, through LoaderMax).
The problem is that everything works fine with a fast build, but it's not working with a standard build, I have the error on Loader class that says "Multiple application domains are not supported on this operating system".
Useful information:
Im using AIR 3.9, compilation flash swf-version=20 (I had 18 when I started with this issue)
null.swf is properly included on the IPA, the code recognize the file, and as I said before it works with a fast build.
For embed swc files, I had to include the files with a compiler argument: "-include-libraries ../../filename.swc ../../filename2.swc etc.."
Thanks for any help.
Regards

It's fixed, using a context:
context = new LoaderContext(false, ApplicationDomain.currentDomain, null);
If I use the third parameter, like ..., SecurityDomain.currentDomain); it doesn't work.

Related

Attempt to load library; get "bad image" error

I've been trying to load a library into lua file. Sparing the details, as they are not really important, I have tried this many ways.
The final way, and the one I believe to be correct although I still can't get it to work, is to use "package.loadlib". See code:
ed = package.loadlib("Encode_Decode.lua", "luaopen_ed")
print(ed)
But when I run the program I get this error:
Encode_Decode.lua is either not designed to run on Windows or it
contains an error. Try installing the program again using the original
installation media or contact your system administrator or the
software vendor for support.
I know the program runs because I used it internally to test it's encoding and decoding abilities and it worked fine. I'd really prefer not moving the contents of the library over as my main lua file is crowded as it is. I will if I have to though.
Yes it is in the main folder. I've also tried changing the extension of the library file into a .dll, with the same error.
What am I doing wrong?
I apologize in advance if this is a duplicate, I did my best to research this problem as thoroughly as I could. But to be honest it's almost 3 AM and I've been searching for almost an hour.
Stupid beginner mistake, used the wrong syntax.
require("Encode_Decode")
print(dec("bnVs")) --returns "nul"
package.loadlib is used for loading shared libraries; i.e. .dll or .so files. You're passing a .lua file to it, so Windows attempts to load it as a .dll and fails when it can't.
To load Lua source code, you can use dofile. Alternatively, you can use require, which is a bit more complex, but handles loading modules only once and works with both Lua and C modules.

Flash as3 ios: error #2007: parameter possible symbol clash in multiple swfs, abc env must be non-null

I'm developing an app for iOs using flash air, version 3.8, this version allow me to load a externals swf with assets, flash professional cs6 and flash builder 4.7
I have some kind of lobby where the user select a differents games. If I deploy the app just with 1 game (1 swf), I would loaded a game without problem
But, If I deploy the app with other games, I would just loaded 1 of them swf, but the other games give me this error:
error #2007: parameter possible symbol clash in multiple swfs, abc env must be non-null
The parameter abcenv doesn't exist in my code.
Thanks in advance
I have found exactly the same issue it also happens with AIR 3.9 You can only do this by embedding the game logic into your main menu and constructing classes as you need to. I know this makes the initial part of say your menu heavier.
You can however load in swfs as library assets, if you need this. I think the bug has to do with swfs and a restriction of overlapping classes and the fact that you can only use one Application Domain. But this is my best guess on the underlying restriction with this. If you do find a work around let us know.
I encountered this error and solved it today. After Google I found nothing can help. Now maybe I'm the only person that solved the problem easily. This is my story:
Working on a AIR actionscript mobile project.
In ad-hoc package for iOS, loading multiple SWF files successfully, except two. Those two cause the "Error #2007: parameter possible symbol clash ......" error.
Found there is a very small difference between the normal SWF and the error one: in the error SWF, one MovieClip is 3D transformed, I saw there are three 3D axis above the MovieClip. Then I deleted the MovieClip from stage and Library and replaced with a new one. Problem solved.
Note that I didn't re-name anything, or delete any duplicated things. In fact there are many duplicated things (image file with same name, and MovieClip copied between the SWFs) in the SWF files.
I ran into this same issue. The issue is that AIR for iOS has to compile ALL of the external .swfs together, so if there are naming conflicts, that can cause trouble. This especially seems to be a problem if two or more of the .swfs were made from the same cloned .fla, even if one of the files had changes made to it.
In my case, it turned out that there were several unused earlier versions of .swfs in the folder of .swfs to be loaded (such as external_movie-prev.swf). I was able to solve the problem quite easily just by deleting these extra files.
This is a common technique in development, just to rename a previous version of a file and add in a new version to the folder for testing. In normal software development these extraneous versions do no harm. But in the case of AIR for iOS, this situation can cause your app to inexplicably freeze when you try to go a movie that also has an unused previous version in your assets folder. This took me several hours to chase down, so I hope it helps someone else.

Using DTCoreText with RubyMotion

I'm currently working on my first major RubyMotion application. I have a lot of html text to display, and want to move away from using UIWebView -- as it's a bit of a hack and it's hard to size correctly without a lot of hoops. So, one of my options is DTCoreText, which seems like the most used and stable control of this lot.
I originally tried to use the CocoaPod version, but for some reason it's causing issues with MKNetworkKit from another pod. I messed with it for a bit, but saw that there are a lot of reported issues in MKNetworkKit about the build process, so I best left it alone.
Instead, I went for the vendor option. I git cloned the DTCoreText repo into my vendor directory and added it to my project. While it gets me closer by compiling the library and making my libDTCoreText.a file, I'm still stuck after actually running it.
My Rake files includes this (the rest is pretty generic):
app.vendor_project('vendor/DTCoreText',
:xcode,
:target => 'Static Library',
:products => ['libDTCoreText.a'])
app.libs << '/usr/lib/libxml2.2.dylib' #For DTCoreText
Like I said, the libDTCoreText.a file gets compiled and copied into the right place in my project.
My app has this in the code. It's as basic as possible -- I just wanted to see it work.
#source = DTAttributedTextView.alloc.initWithFrame(CGRectZero)
#source.attributedString = NSAttributedString.alloc.initWithHTMLData(post.source.dataUsingEncoding(NSString.defaultCStringEncoding), options:{}, documentAttributes:nil)
#source.frame = [[self.frame.size.width / 2 - size.width / 2, 600], [250, 250]]
The application compiles, fine but at runtime when we hit the code above, it crashes with:
Objective-C stub for message `initWithHTMLData:options:documentAttributes:'
type `##:##^#' not precompiled. Make sure you properly link with the framework
or library that defines this message.
*** simulator session ended with error: Error Domain=DTiPhoneSimulatorErrorDomain
Code=1 "The simulated application quit." UserInfo=0x10019d470
{NSLocalizedDescription=The simulated application quit., DTiPhoneSimulatorUnderlyingErrorCodeKey=-1}
Does anyone have any ideas where I can start looking? I don't know a ton about the XCode build process yet, so it's possible I'm missing something. But it just seems like it should work. It's saying to me that it can see the headers correctly (and can compile), but it doesn't know where the actual library is.
Well, I have relevant experience with DTCoreText but none with RubyMotion. DTCoreText uses categories, and as such has special load requirements. In my Xcode project, in "Other Linker Flags", I have this: -force_load $(BUILT_PRODUCTS_DIR)/libDTCoreText.a
That line insures that the library is properly loaded. If you don't do that, you get crashes when you try to use it.
I've been very happy using DTCoreText now for a year, and IMHO its a much better solution for attributed text than using UIWebViews.

Trying to publish an AIR for iOS app using Flash CS5.5, but no ipa is being produced

I've finally obtained an iOS developer license, I've managed to publish a hello world, basic kind of app, get an IPA file and install it on my iphone.
However, now i'm trying something more complex, including using imported libraries. I start the publish process as usual, no error is produced but i'm not getting a message that the ipa is ready.
When i look at the target directory I have folders named like 'AOTBuildOutput5264907783565294361.tmp' with files in them.
Looks like it crashes in the middle, but I get no error message to debug!
Please help me find out where I can read these error messages or provide some other kind of insight!
Thanks in advance
Rotem
I've occasionally run into problems like this. It usually occurs when I'm trying to publish the app from my dropbox folder whilst it is trying to sync.
I can only assume that the problem happens because another application is accessing that file (in my case dropbox).
So make sure nothing else is trying to sync to that folder. Hope that helps.
I ended up moving my development folder to somewhere else in my filesystem and everything went fine. I guess having hebrew charachters in the path didn't work so well for the compiler.

Convert Flash to iOS app

For the record, I am an iOS developer, and have absolutely no background on how flash programs work/run/developed...etc.
I have a Flash program that is mostly a collection of SWF files. It does, however, contain some Actionscript, Javascript and other integrated languages here and there..
I would like to convert this project/program to an iPad application. Is it possible?
What I got from searching the net:
Converting Actionscript to LUA script
Using Corona SDK to port the program to iOS
Starting a new iOS project in flash and moving the code somehow..
Other tedious ways which are not feasible at all....
The above mostly handles the actionscript part .. what about the SWF files?
As a last resort, one could at least guide me to a developer/company who can handle this task, or provide training to accomplish this.
Additional details
The flash program app file is already generated, and the program works on desktops perfectly. The program is somehow an interactive e-book, and it has some linked XML files to index the table of contents and other sections...
I've not done a lot of iOS development yet, but here are my experiences so far; maybe they help you form a better idea.
Only the main SWF can contain actionscript code.
I'm not sure how far assets (Sounds, Fonts, MovieClips) in other SWFs which are exported for actionscript are accessible to the main SWF.
It is possible to include additional XML files (and other types) which can be loaded via the normal loader classes.
Recently I came acrosshe tool which allows you to convert and play swf to some cross-platform frameworks. Now they support only Cocos2d-x, Unity 3d and Starling. But I saw the logo of Corona on their homepage. You can go there and ask them. I don't remember the right name of the site, but tool is called GAF converter

Resources