Exporting several swf's from single fla - actionscript-3

I have a single fla-file which has several different animations on a main timeline.
Each animation sequence starts with a frame marked with a specific label.
I need to keep the source file this way, but I also need to have separate swf files each with a specific segment from a timeline.
Currently I have to manually change publish settings to a specific swf name, add small changes to the ActionScript in a frame and publish. This procedures has to be done 4 times.
Is there any possibility to run a single jsfl script and make it publish 4 swfs, each one having just a segment of a main timeline?
I've searched the documentation and haven't found any clues. But I've never worked with jsfl though.
Thank you.

Related

How to update SWF without re-compiling the FLA

All my SWF files run the same script class, There are a lot of .swf files to be updated after making some changes in that script class, Normally to see changes in SWF files I would open the FLA files and compile. Since there are thousands of SWF it will take too much effort.
is there any way to update all existing .swf files without a need to re-compile .fla files
Thanks for your consideration.
I guess by "refresh" what you actually mean is recompile.
To automate that, you have a two options:
1- JSFL, which is a pain in the ass.
2- Write a program that will compile every .fla throught command line, which somehow can be even more painful
I'm not an expert in both of the solutions so let me just give you a guide on how to do it the first way: http://gskinner.com/blog/archives/2004/08/jsfl_fla_batch.html
By definition, it's impossible to create or modify a (million of) swf (pdf, doc, gif, php...) file without opening it.

AS3 How can one detect that a display object is subject to a motion tween?

I guess this is a question for real gurus only..
I'm using the Flash Authoringtool to create MovieClips, yet I play them using my own engine (which behaves better for mobile).
Yet, for proper behaviour, given a DisplayObject, I need to know if its parent is tweening it inside the MovieClip it is part of.
I've already come up with Brute-force and non-elegant ways to do that:
In the authoring tool, add a prefix to the name of any movieclip that is subject to tweening. That name prefix can be checked lateron at any moment. Of course, as this prefixing is a manual process, it's easy to forget or mistype one.
In the code, play each sub-movieclip of the main movieclip for all of its frames, and for all of its children, detect if the transformation matrix changes at any of these frames. If so, automatically prefix their names. Although automized, this solution may take up noticable time for larger movieclips.
So what I'm hoping for is that some other way exists like:
if((dpo.parent) as MovieClip) != null)
{
bDpoIsBeingTweened = ((dpo.parent) as MovieClip).someProperty;
}
Looking forward to any elegant solution.
The solution is quite simple: stop using Adobe's tweening library.
Use TweenLite which is hundreds of times faster, easier to code, and has many other benefits. For example being able to use isTweening to determine if some object is being tweened or not.
Here's the documentation.
To include external libraries in the Flash IDE you can do it in 2 ways.
1) Copy the folder of the external library in your project folder (where your .fla file is)
2) Define a folder in "File > Actionscript settings" where you want to put external libraries files in your hard disk.
Then in your code you just need to import those classes with import. For example:
import com.greensock.TweenLite;

Flash Architecture and "TypeError: Error #1009:"

This is an architecture question that I hope solves some of the issues that are popping up with a large-ish UI problem I'm working on.
Background: I'm building an in-game UI in Flash (using Flash CC) for use with Scaleform. I'm somewhere between nood and moderately knowledgeable; probably enough of the latter to be dangerous.
My current architecture is:
Parent: This will manage and create all instances of the UI. It has its own FLA/SWF file.
Component 1: This is one of the components of the parent, with its own FLA/SWF file
Component 2: This is another component of the parent, with its own FLA/SWF file
Shared HUD Assets: This contains common elements between all elements (its own FLA/SWF file); it exports all of its symbols, and these are imported into the libraries of the appropriate component
Shared Assets: This is common across all UI (buttons, background, etc.) It also exports/imports like the HUD assets
The intent here is to allow multiple types of components to be stored in each component file, with the HUD choosing which one to use and "assembling" the HUD. Artists would be able to work in the component and asset files without touching the larger HUD file and having to muck around in code.
Initially, I tried storing all of the assets in the main parent, but Flash is... a bit of a pain with managing imported symbols for multiple layouts. I'd end up with duplicate fonts, links that broke, etc.
Next, I tried creating instances using pure AS, i.e. "component = new component()" from imported AS files, but it appears I've run into issues with layouts created in the Flash IDE (and not done exclusively in AS) not being accessible to the parent. (I'm assuming this is an issue; it's possible I'm misreading some people experiencing similar issues on this site and others.)
Now, I'm decided loading the SWF files should address that issue, but I'm running into a number of "TypeError: Error #1009" in these loaded SWF files; specifically, a button (AnimatedToggleButton) that's referenced by another Scaleform component (ButtonBar). Both it and the ButtonBar are imported to the HUD component from Shared Assets, but AnimatedToggleButton is unused anywhere else. It's properly exporting and importing, and works from when compiled in the component SWF, but it comes up as a missing class/null in the parent when the SWF is loaded. I'm tried all of the usual tricks, waiting for the stage, etc.
Is this the right architecture for this sort of thing? And if it is, what's the deal with imported symbols? Do they not exist unless used?
Do you have "Export in Frame 1" checked in the Symbol Properties?
If not, then yes, only symbols that appear on the stage will be exported and accessible to the parent SWF.

AS3 - Load only certain items/objects from external SWF

Is there any way possible to say, have A.swf use only certain items from B.swf, without having to load the entire swf as a child first? What i'm trying to do is have A as lite as possible and pull some items from time to time from B without having to cache the entire file in flash memory somehow. I've looked at other similar questions but none seem to really answer or fit this exact problem.
Before anyone asks, yes I do know how to use loader, loadercontext, and create instances of classes from the library. This is more of a methodology question rather than a "how to" question.
Only idea I can come up with, is to export all of the children as individual swf objects and then have A request B to compose itself of the seperated items that get requested by A. Would this be efficient?
I don't think you can do what you want to do, however since the assets are strictly graphical in nature, it doesn't seem inefficient to just export them as individual assets and load them when you need them. ( In fact it seems very efficient to me... )
I haven't tried it, but to save time you could probably automate the export process with jsfl. ( Jsfl lets you script the Flash IDE itself, to automate tasks that you would otherwise have to do manually. ) Take a look at this Stack Overflow answer here:
Generating individual SWF's with classes from a fla with a large library
That example shows how to batch export swfs out of the library.
Note than in Flash CS6 you can export a MovieClip from the library by right clicking and selecting export, but unfortunately it doesn't let you export a group all at once.
A swf is a compiled package, and is not meant to be split into parts. One solution would be to pull all of the common elements out of A and B into a swc (a compiled Flash library, not meant to be run). You can then include the swc in the compilation of A and B.
Unless you will be creating lots of files with only a few common elements, I don't see why you would need to export each of the children as individual swf files.

How to scan through a Flash .swf or .flv file and extract a specified number of frames from it?

I would like to be able to
create a folder for the copied video frames
access the individual frames frome a .flv video file and/or .swf file
save these frames to the auto-created folder
I assume one would need to do this using Action Script 3 to scan through the .swf and .flv files and extract the frames.
Are there gudies on how to do this?
You need to know WHAT frames do you want to extract. For example:
extract 20 frames in regular interval from the video clip
extract frames at 15 seconds interval
extract frames at keyframes (scene changes)
I guess that you don't have to use as3 to extract frames, but can also create the script in some other language. Central piece to frame extraction could be ffmpeg, as described in this article.
If it is as3 solution i would do following
- make a loader which loads your fla/flv
- add enter frame event listener to it and on each frame draw loader object to buffer, if you ever done any loading and drawing, this will probably take you 10-20 minutes to set up.
This is pretty much the only straigt-forward solution if you're dealing with code-based animations, videos can be handled in different and easier ways i guess.
You will face the challenge of saving the output tho. Flash player can save images on your computer, however only by prompting you to save the file. You will need to use functions available only in Air player if you want to save anything without prompts.