IntelliJ external AS3 library linkage setting ignored - actionscript-3

I have a big actionscript project with several external libraries added to dependencies tab. To optimize compilation time I decided to create a module that will compile all these libraries to a single swc. And that is something I've encounter problem with as IntelliJ seems to ignore linkage settings for these libraries. I set linkage to 'include' so that my swc will aggregate all the code from external libraries but instead it looks like I always end up with 'merged' linkage mode.
If my swc-module has no additional code, then IntelliJ will refuse to compile it at all because it says that there's nothing to compile. If I create a dummy class that will access some classes from external libraries then it will compile an swc but with only mentioned classes. That's exactly what 'merged' linkage mode is.
I don't know if it is me doing something wrong or it is a bug in IntelliJ but it's definitely a problem. So I decided to start with a question on StackOverflow.

Related

Remove MVVMCross from UnitTest (Ressource.Attribute Error)

I have a Unit-Test Project where i used MVVMCross for Dependency Injection, but since i made a Implementation of the Library which i tested for UWP, i kinda wanted to use the Unit-Test for both Implementations.
For that purpose i used Compiler Switches and ended up removing MVVMCross.
But when i uninstall it from the packages i always get "Resource.Attribute" does not contain a definition for "MvxBind" and some other MVVMCross attributes.
I rebuilded the project. I deleted the obj and bin folder and looked through every file in the project folder, but i cant find a thing why it keeps adding those attributes to my Ressource.Designer.cs
If i add MVVMCross back and just dont use it all, obviously it works. But i kinda want to remove it there, since it is just overkill.

Getting to know Flash IDEs

I am trying to learn AS3 by downloading Flash Projects(open source), but can't seem to really grasp the right way to get the projects to run (through compiling) with IDEs (I am using FlashDevelop as an IDE). Here's an example:
http://www.flashkit.com/movies/Games/Shooting-manish_c-12372/index.php
Here's what I try to do:
I open a new Project on FlashDevelop
I copy all the folders to src, and make the main file(In this project it's called "rhymingRockets.as") as the Document Class.
I delete main.as (generated by default), and try to run it, but get the errors: Error: Definition fl.transitions.easing could not be found.
Click here to see the problem
Sorry for bothering you with such a simple question, but any help will be greatly appreciated, as I am new to Flash.
Error: Definition fl.transitions.easing
That error indicates that you are not linking to the fl.transitions.easing library/package correctly. There is a related question here (as3 fl.transitions.Tween could not be found). If someone is sharing the source of a project, they may not have shared the source code or compiled .swc for any libraries the project may use since that is not project specific.
You might find this link of use: Linking .swc files in your ActionScript Editor. Since you say you are new to Actionscript, I'd suggest that you don't waste too much time on getting 3rd party projects to run – I realize it's tempting but not much learning from that and lots of frustration. Better to work with your own small learning projects to try out different ideas or libraries.

ASC2.0 and Frame metatag

Apparently, the new ActionScript Compiler 2.0 no longer supports the old [frame] metatag which allowed you to add preloaders to pure actionscript projects.
I've verified this IntelliJ - switching the "Prefer ActionScript Compiler 2.0 for pure ActionScript build configurations" makes a difference between the preloader being instantiated and executed, and the main class being instantiated and executed.
Googling yield no result, so is there currently any way around this issue - use ASC2.0 but have the benefits of the Frame metatag?
This still works when using the mxmlc commandline tool;
mxmlc Loader.as -frame=ContentFrame,Main
(produces a 2-frame SWF; the first has no name and contains Loader, the second is named ContentFrame and contains Main).

Unify the size of swf

When I compile the same project with ant many times it gives a different sizes for each compilation
I added the rsl and more option to mxml it works fine ,but the size is still changed
Please any idea to unify the size
This is not really possible, unless you do some, quite involved post-processing. Below is the list of things I know to change the size between compiles, but it may not be exhaustive:
When you compile pure AS3 project or a project that uses framework:
Resources you embed on variables have their class names generated using the current date in the name.
Flex compiler generates a tag of obscure purpose (can be removed manually, but persists in release builds), which seem to contain a GUID and a compilation time or something similar. It is usually found at the very beginning of the SWF file, somewhere after the rectangle of the SWF dimensions.
In a project that uses framework:
All code generation is suspect to generating inconsistent names, particularly, all bindings will certainly produce different assembly upon each compile. Styles and some other rarely used metadata will cause this too.
Specifically for spark skins, which come as sources rather then compiled libraries - some of them embed resources in a bad way, so you would probably need to compile them into a library and plug it into a project, removing the sources from the source path.
All in all, if you are using pure AS3 project, your task is difficult, but doable (will require following certain conventions and some post-build script that unzips the SWF, purges the compiler-added extra tag and zips the SWF back. But if it is a SWF based on the framework - I'd say the effort isn't worth it, just accept it cannot be done.

Problem using Flash Components in multiple SWC files

[Edit: Short version - how do you properly handle namespace collisions in SWC files if one SWC has fewer classes from that namespace than another?]
I have a rather large Flash application which I'm building in Flash Builder (because coding/debugging in the Flash IDE is... not good) and I've got a ton of external SWC files which I'm linking in to my application. This has worked well so far - the file size is on the large side, but it's a lot simpler than loading in SWFs, especially since I am extending most of the classes in each SWC and adding custom code that way (it's a very design-heavy app.) The problem I'm having is when I have Flash Components, like ComboBox or TextInput, in more than one SWC. Whichever SWC was compiled last will work fine, but the others will fail with errors like the following:
TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::MovieClip#1f21adc1 to fl.controls.TextInput.
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
at com.company.design.login::LoginForm()
at com.company.view::Login()[/Users/ken/Workspace/src/com/company/view/Login.as:22]
at com.company.view::Main/showLogin()[/Users/ken/Workspace/src/com/company/view/Main.as:209]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at com.company.view::Navigation/handleUIClick()[/Users/ken/Workspace/src/com/company/view/Navigation.as:88]
I've been researching components, ComponentShim, etc. but I'm running up against a brick wall. I thought it might be the fact that some of the components had their skins modified in the source FLA, so I tried replacing them with the default skins, but that didn't seem to help. How can I ensure that I have the components imported and available to all my classes, yet still be able to skin them and include them in my various FLAs? (I am never creating new instances of them, they are all laid out by my designer.)
I dunno if this will help you, but I had a similar problem with an asset in a SWC library that was the visual representation for a class in my main project. What I ended up doing was having the visual asset be a Flash-created class that extended the class in my project rather than having the same name.
For example, my asset and the class were both com.blah.TitleBackground. To fix the issue I made the visual asset have teh class of com.blah.TitleBackgroundAsset and set the base class for the component to com.blah.TitleBackground. That fixed this particular issue for me. I still have more to wade through, but your post sparked the idea for the solution to get around the name conflicts.
I can't find the detailed fix (apparently, the work email I used at the time was trashing older messages without my knowledge!) but the short answer is to create one FLA that has all the components you want to use in it, set those components (and the ComponentShim) to 'Export for Runtime Sharing'. Then, in your other FLAs, whenever you want a component, drag it from the components FLA library (it should show up in your main library with 'Import for Runtime Sharing' turned on.) Make sure you don't have a ComponentShim in your main library. You'll need the compiled component SWF file in the same folder as your FLAs.
What this does is keep all the component code, including skins, in one central place, so when you compile (be it as a SWF or a SWC, though this problem mainly crops up when using SWCs) there are no conflicts.