How to compile actionscript worker swf in FlashDevelop - actionscript-3

I already know the coding part of actionscript worker. Recently I switched my IDE to FlashDevelop. I can't figure out how to compile actionscript worker swf in FlashDevelop.
I try to use Tools - Flash Tools - Build current file. But it throws error saying
Error: Type was not found or was not a compile-time constant: File.
Maybe it is because my project is a AIR project and I use AIR API in my worker.
I also try to compile worker swf using amxmlc via command line. It compiles successfully. But AIR Debug Launcher crashes when executing worker swf part. The swf which I compiled manually is nearly half size of the former one that Flash Builder generated for me. I guess I compiled a release version swf so that ADL can't debug and then crashed.
So how do I compile a worker swf in FlashDevelop to debug or to publish a release of project?
Update:
I find that the "Build current file" command in menu is a feature in FlashDevelop called quick build. By default, it will compile current file output to project root directory without arguments. We can add compiler arguments using #mxmlc ASDoc tag (see the links below for detail) to make it compile a worker swf for us. But currently in FD 5.0.1 it seems to be a bug that #mxmlc +configname=air doesn't compile air swfs. I find a workaround using #mxmlc -noplay -library-path=[Flex_SDK]\frameworks\libs\air\airglobal.swc -library-path=[Flex_SDK]\frameworks\libs\air\airframework.swc, but the path can't be surrounded with quote otherwise FD will show an error. I may look into the source and try to fix it.
links:
AS3 Quick Build documentation
Quick Build
FlashDevelop: Compiling Multiple SWF In One Project

Compiling a worker is no different from compiling any swf, you will need a separate project to compile the worker, unless your main worker loads itself as a worker.
Since FlashDevelop does not manage dependencies beetween projects, you will have to compile it manually, then the main worker.
You may automate it with make or any build system outside FlashDevelop, or use Pre/Post build command lines
By the way amxmlc is just a shortcut for 'mxmlc +configname=air', -debug=true will compile debug version
I can assure you that File can be used in a worker, basically it's just some actionscript bytecode loading some other actionscript bytecode and having it run in a separate thread, so any swf can be used as a worker, except if it doesn't use flash.system.Worker class, it won't be able to communicate with other workers, or to stop itself.
To sum up, the limitations and issues are rather about communicating beetween threads and synchronizing them. For instance, being able to only copy complex objects through AMF3 serialization,pass only basic types/objects as parameters will makes it impossible to interact with the display list from non-main workers
Dont forget to update FlashDevelop /AIR SDK for best workers support

Related

Use IntelliJ Idea to Debug ActionScript Running in a Browser?

I have an ActionScript project that runs inside of another swf (embedded on an HTML page) so I can't use the 'Debug' option in IntelliJ's menu. Is there a way to connect the IDE's debugger to the browser so I can use breakpoints and such?
You can use the Flash Remote Debug option, just create a new remote debug profile
then hit debug and intelliJ waits until a swf debug file is launched on your computer it can be with a standalone player or plugin in a browser. both of them need to be debugger versions and your swf needs also to allow debugging (in Flash CC default does not accept debugging you need to change the publish settings).
I use this method to debug with IntelliJ an swf launched inside Flash CC hitting cmd+enter.
Maybe it works when you load and swf inside another.

No definitions matching so.cuo.platform admob.* could be found

I am trying to remote debug with FDB over USB and after I've compiled the app with amxmlc, I got the following errors:
No definitions matching so.cuo.platform admob.* could be found
Type was not found or was not a compile-time constant: IntroScreen_mc
...
My app uses admob extension, also in FlashDevelop after I compile the app there are no errors. I am using SDK 4.0 and all my swc libraries have been imported. I think there is something wrong with the paths but I don't know where to look.
Yes ,it a path error.
you not pack the ane lib realy ,you just packed the swc,so it work well when pack,but fail when run application.
how to fix?
right click your project in flash builder ,then set package option of ios or android.check up the check box under package option.

Cannot run Starling helloworld when using source code in FlashDevelop

I have recently installed FlashDevelop 4.4.3 and Starling 1.3.0.
I followed the getting started tutorial of Starling.
I can run the tutorial when I put starling.swc into lib directory and after making "Add to Library".
But if I remove starling.swc from lib directory and instead copy source codes (com and starling directories inside starling\src) of starling framework into my project folder then I get the following error:
C:\projects\ch01_01\src\starling\display\BlendMode.as(42): col: 32 Error: Access of undefined property Context3DBlendFactor
The same error occurs also when I set the classpath to <starling-installation>\starling\src
You don't need to copy anything. Just use the folder with your starling source.
Your classpath should always point to src directory. It won't work if you point to starling directory.
You most likely target wrong flash player version.
set it to 11.5 or something higher.

What is the best way to allow third-party changes to Runtime Shared Libraries?

How can I do the following in Flex 4.5 or later:
Compile an swc library file containing packages of simple functions
Compile an swf application referencing the swc file as RSL
Publish the swf application
Send the source code of the swc file to another developer
Allow the developer to modify the code of some functions while keeping their interfaces
Allow the developer to compile the source code into a new swc file using only compc
Allow the developer to replace my original swc file with his new swc file, then execute my swf application having the new swc file in the same directory.
I tried the above many times, just to fail. Is there any alternative?
The only way to eliminate additional compilation against the updated libraries is re-thinking your architecture: If all the dependencies in the RSL are properly decoupled, you should not have any problems.

Flash Builder Mac Breakpoints generate NullPointerExceptions

I have a complex, pre-existing Actionscript project to work with at my current employer. The project was originally created with FlashDevelop, which is not an option for me as a Mac user. I can successfully build the project and deploy it to others. It runs as expected.
The problem is with the debugging. I cannot make it work. I believe users of Flash Builder on Windows machines have successfully debugged this project on their machine. I can build and debug projects I make myself. It's THIS particular project, or something about how it is constructed, that is preventing debugging from occurring.
Symptoms:
Starting the program via the Debug button runs the program, but the presence of a breakpoint causes the program to freeze the browser where it is running
Removing the breakpoint or stopping the debugger allows the browser to unfreeze and continue normally
At no point does the breakpoint actually get reached and break into the debugger
Attempting to place a breakpoint during execution results in an internal error: java.lang.NullPointerException
Example log message from within .metadata/.log
java.lang.NullPointerException
!STACK 0
!MESSAGE Error processing debugger commands
!ENTRY com.adobe.flexbuilder.project 4 43 2011-08-24 13:35:07.404
at java.lang.Thread.run(Thread.java:680)
at com.adobe.flexbuilder.debug.model.FlexDebugTarget$FdbThread.run(FlexDebugTarget.java:793)
at com.adobe.flexbuilder.debug.model.FlexDebugTarget$FdbThread.eventLoop(FlexDebugTarget.java:732)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at com.adobe.flexbuilder.debug.model.FlexDebugTarget$FdbThread$1.run(FlexDebugTarget.java:752)
at com.adobe.flexbuilder.debug.model.FlexDebugTarget$FdbThread.access$7(FlexDebugTarget.java:642)
at com.adobe.flexbuilder.debug.model.FlexDebugTarget$FdbThread.advanceStateMachine(FlexDebugTarget.java:668)
at com.adobe.flexbuilder.debug.model.FlexDebugTarget$FdbThread.installDeferredBreakpoints(FlexDebugTarget.java:637)
at com.adobe.flexbuilder.debug.model.FlexDebugTarget.access$4(FlexDebugTarget.java:1006)
at com.adobe.flexbuilder.debug.model.FlexDebugTarget.instantiateBreakpoint(FlexDebugTarget.java:1012)
at com.adobe.flexbuilder.debug.breakpoints.FlexLineBreakpoint.instantiate(FlexLineBreakpoint.java:465)
at com.adobe.flexbuilder.debug.breakpoints.FlexLineBreakpoint.findSourceFiles(FlexLineBreakpoint.java:412)
Attempted Fixes:
Cleaned project
Cleared browser cache
Tried different browsers (Yes, I have the debug player)
Deleted .metadata
Deleted workspace
Reinstalled Flash Builder
Reinstalled Debug Flash Player
Restarted Mac
Tried a different SDK
Reordered Java preference for both 32 and 64 bit configurations
Removed symlinks from project configuration (that is, symlinks are no longer needed to correctly find the build or run location)
Cleared Flash logs
Ensured no more than one version of the program was getting compiled (so it can't actually be running from another location)
Explicitly turned on debugging through compiler argument: -debug=true
Changing just about every relevant and lots of irrelevant settings within Project Properties
Project Details:
Interestingly, clicking on Actionscript Applications in the Project Properties results in Flash Builder immediately becoming unresponsive
Uses third-party libraries for functionality that may or may not be Debug builds
Uses third-party code for functionality that is included with the rest of the code via Actionscript Build Path > Source path (note that this folder must be included explicitly for this project even though the path included is already in the source directory)
Runs from a local web server, accessing local database using a custom domain that is not "localhost" nor an IP address (changed for Chrome cookie issues), rather it looks like http://programname.local/
Launch configuration starts the web browser at the correct local url (as opposed to starting up from a file), probably irrelevant
There is one additional compiler argument that simply creates a global, compile-time constant, probably irrelevant
Source and project directories contain svn repository folders and files, probably irrelevant
I have an NDA, so I can only talk about the project and its structure, I can't post code
Configuration:
Mac OS 10.6.8
Flash Builder 4 (through CS5)
Flex SDK 4.0 and 4.5.1
Figured it out. Our app uses a preloader which I had always gotten from others. I had assumed it was compiled to debug because I always got my copy from our debug server. I didn't fully understand how it worked or what it was doing.
Due to a Flash error in the preloader, this morning I was forced to compile it for the first time. Compiling it normally (as debug) I realized the problem with non-debug swfs loading debug swfs might apply here.
Breakpoints worked as expected once I correctly compiled the preloader and fixed its bug. Apparently our preloader is doing the actual loading of the main app. Flash Builder apparently can't handle this setup (non-debug loading a debug swf), whereas FlashDevelop apparently can.
Have you tried restarting your Mac?
I feel your pain, and your list of attempted fixes are what I'd try first :)
I had a similar situation to this and after hours of cursing Adobe I restarted my Mac and that solved it (probably some kind of memory error).