Copy link to clipboard
Copied
Hi,
Since iOS does not allow AS code in any externally loaded assets, is there any programable way or existing utility that would be able to strip AS code from existing SWF files in order to make them iOS safe? We have lots of SWF assets that contain some minor AS code that is needed for their use on the web, but in order to repurpose these assets for mobile use they have to be edited. It would be a HUGE time saver if there was tool to batch strip this out.
thx
Copy link to clipboard
Copied
I though this behaviour (allow AS in external assets) was changed in AIR 3.6 or 3.7 according to this link:
actionscript 3 - AIR 3.6 iOS - Load external SWF with ABC - Stack Overflow
Copy link to clipboard
Copied
I don't think so... it still requires that the external swf's code be extracted and compiled into the main swf. That's fine if you have a handful of external swf files, but I have hundreds.
The code I'm talking about needing to strip out is just some basic stop() and SecurityDomain calls... it's not required for the external swf to function inside the main swf. It would be ideal if the packager could do this WITHOUT adding the code to the main swf file, but I don't see a way to do that now.
Copy link to clipboard
Copied
There is an option in ADT that lets you publish and app and to create code-stripped swfs that will live on a server somewhere. I haven't tried this yet, but you would think that the stripped swfs could be used as if they never had code in them. Anyway, here's the full article on it, maybe you could leave the code in the swfs and publish the app as described in the article:
Copy link to clipboard
Copied
I would think the stripped swf files could be used normally too, but I don't want the stripped code inserted into the main app swf file. There doesn't seem to be a way to prevent that part of the process.
Copy link to clipboard
Copied
You would do the strip build with a project that you don't intend to use. Then use the swfs that are produced in your real project.
Copy link to clipboard
Copied
Colin Holgate wrote:
You would do the strip build with a project that you don't intend to use. Then use the swfs that are produced in your real project.
So I tried your suggestion about creating a dummy project and then using the stripped swf files in my real project. It doesn't work. The stripped swf files won't load, and produce this error in the IntelliJ debugger:
[SWF] ipgcache/data/cmms/images/C10101442.swf - 4,165,605 bytes after decompression
[Fault] exception, information=VerifyError: Error #1042: Not an ABC file. major_version=0 minor_version=0.
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
at flash.tools.debugger.concrete.DManager.getFrame(DManager.java:927)
at flash.tools.debugger.concrete.PlayerSession.pullUpActivationObjectVariables(PlayerSession.java:1119)
at flash.tools.debugger.concrete.PlayerSession.requestFrame(PlayerSession.java:1095)
at flash.tools.debugger.concrete.PlayerSession.getValueWorker(PlayerSession.java:1217)
at flash.tools.debugger.concrete.IsolatePlayerSession.getValue(IsolatePlayerSession.java:129)
at flex.tools.debugger.cli.ExpressionContext.memberNamed(ExpressionContext.java:444)
at flex.tools.debugger.cli.ExpressionContext.locateParentForNamed(ExpressionContext.java:546)
at flex.tools.debugger.cli.ExpressionContext.determineContext(ExpressionContext.java:496)
at flex.tools.debugger.cli.ExpressionContext.resolveToVariable(ExpressionContext.java:356)
at flex.tools.debugger.cli.ExpressionContext.lookup(ExpressionContext.java:175)
at flash.tools.debugger.expression.DebuggerEvaluator.evaluate(DebuggerEvaluator.java:165)
at macromedia.asc.parser.ThisExpressionNode.evaluate(ThisExpressionNode.java:34)
at flash.tools.debugger.expression.DebuggerEvaluator.evaluate(DebuggerEvaluator.java:1034)
at macromedia.asc.parser.ListNode.evaluate(ListNode.java:44)
at flash.tools.debugger.expression.DebuggerEvaluator.evaluate(DebuggerEvaluator.java:1034)
at macromedia.asc.parser.ListNode.evaluate(ListNode.java:44)
at flash.tools.debugger.expression.DebuggerEvaluator.evaluate(DebuggerEvaluator.java:1068)
at macromedia.asc.parser.ExpressionStatementNode.evaluate(ExpressionStatementNode.java:50)
at flash.tools.debugger.expression.DebuggerEvaluator.evaluate(DebuggerEvaluator.java:1309)
at macromedia.asc.parser.ProgramNode.evaluate(ProgramNode.java:80)
at flash.tools.debugger.expression.DebuggerExpression.evaluate(DebuggerExpression.java:113)
at flex.tools.debugger.cli.ExpressionCache.evaluate(ExpressionCache.java:109)
at flex.tools.debugger.cli.DebugCLI.evalExpression(DebugCLI.java:3661)
at flex.tools.debugger.cli.DebugCLI.evalExpression(DebugCLI.java:3654)
at flex.tools.debugger.cli.DebugCLI.doPrint(DebugCLI.java:3593)
at flex.tools.debugger.cli.DebugCLI.processLine(DebugCLI.java:6318)
at flex.tools.debugger.cli.DebugCLI.process(DebugCLI.java:781)
at flex.tools.debugger.cli.DebugCLI.execute(DebugCLI.java:630)
at flex.tools.debugger.cli.DebugCLI.main(DebugCLI.java:401)
The blog on this matter even states that the stripped swf files are invalid swf files, so apparently they can only be used with the main swf file they are packaged with, which is very inflexible.