How to create a new swf on the server from a moviclip in current swf - actionscript-3

I have a movieClip on the stage with a loaded swf playing animation and sound. I want to export the movieclip to swf. I thought I would be able to do something similar to the jpeg export?.
The main swf and the one being loaded in to be copied are on the same server.
I've searched about but I have not come across anything that outlines what needs to be done.
Any chance of a bit more in-depth explanation as to how to accomplish this?
I did have one post on here already about where someone had a similar question but the moders felt a need to delete it :(

There's a library called Ming which might suit your needs.
Also, as serverside swf generation is not trivial, do you really need it? If you need a dynamic swf, you could also create a template and create the content using flashvars in combination with a serverside language like PHP.

Related

Is it possible to compile a FLA using mxmlc?

Let me give you a little explanation of what I'm trying to do first. I'm working on a new AS3 based architecture and I'm trying to fix some issues I had in the past with AS2. Each screen has its own FLA, and multiple screens reference certain components; a Button for example. The problem occurs when something in Button changes. Every single screen that uses Button has to be republished or else it has a chance that it won't pick up the change due to how Flash class definitions work: The first Button definition that loads at runtime is the one that everything uses. So if a screen using the old Button loads first then everything will be using the old definition and things will break. It can take an hour or more to figure out which FLA needs to be exported to fix it since there are so many and the connection between them isn't always obvious. So as you can see, this is a major time sink that needs to be fixed.
I've learned that in AS2 you can use an exclude.xml file to exclude class definitions from the SWF when the FLA is published. In this way, I figured out an architecture I can set up where there is a Shell SWF that is the only place where the Button class is defined. Shell then loads in all of the other screens that all have Button excluded so that they only pick up the Shell version. This makes sure that if anything in Button changes, the only thing that needs to be republished is the Shell and then everything else picks up the change at runtime.
This is all well and good, except that when using AS3 the exclude.xml file no longer works. Because of this I've turned to MXMLC, which can mimic the exclude.xml functionality by using the -link-report compiler option to build the exclude.xml when compiling the Shell SWF, and then pass that XML to -load-externs on every other screen to exclude everything that is built by the Shell. The only way I've found to do this is by publishing everything as a SWC from Flash and then using -include-libraries to build the SWF from the SWC along with the -load-externs to exclude everything I don't want to be there. This does the trick just fine, except that publishing as a SWC does not include anything defined on the timeline or, more specifically, the stage. A lot of design work is done on the timeline in Flash by layering on the different parts and dropping in named MovieClips all over the place that are then referenced in ActionScript, but the SWC doesn't pick up any of this information as far as I can tell.
So now we come to my question. Is there some way to compile all of the information in a FLA using MXMLC so that I can exclude everything while still being able to design out everything on the timeline/stage?
I sent an email to Grant Skinner and he basically said the only way he knew of to do excludes with AS3 was with RSL or SWC. He wasn't entirely sure which method worked since it had been a long time, so I don't have a definitive answer. I spent a while trying to figure it out using SWCs, but I didn't really get any decent results from it so I'm giving up for now.
The important part to note is that it is indeed impossible to run MXMLC to build a FLA. Or at least if it is possible, it requires very complex knowledge that not many people know.

Cause of flv corruption in AIR output?

I have a fairly complex AIR project which is compiling a lot of movieclips together using timelinemax and finally outputting the whole thing as an .flv using https://github.com/zeropointnine/leelib/tree/master/src/leelib/util/flvEncoder
I am getting corruption of the flv when certain videos are added to the timeline (all videos are embedded in movieclips in an external .swc). Here's what the corruption looks like:
It looks as if the second video I add is being somehow combined with the first and going all crazy. But the two movieclips containing these videos are never on the stage at the same time, they are added one by one when their part of the main timeline is reached, and removed afterwards. This works in all other cases, and the corruption does not happen with certain videos. I am creating all the flvs for embedding myself, in After Effects, and exporting them all with identical settings.
Can anyone shed any light on what might be causing this? Sorry not to post any code, but there is just so much, I wouldn't know where to start, and I feel like this probably isn't a code problem?
Thanks!
Well, the answer seems to be: don't load in video files from an external .swc. I moved all the movieclips containing video into my main .flv and the corruption is gone. I don't understand it, but I'll take it.

Create video movie from dynamic content

I have an application (actionscript) that displayes a slideshow from dynamic content written in xml. The slideshow runs in flashplayer. Now i have been asked to display the content as a video file format. Is it possible to do such a thing?
Thanks
To answer Your Question,
If I understand you correctly, and you want to create either timeline or scripted animation, and have as3 record what appears, then the answer is Yes.
Below is a great example:
http://www.zeropointnine.com/blog/updated-flv-encoder-alchem/
Really, all you have to do is to make all your actions and child animations happen inside a single Sprite or MovieClip, and then after every frame, copy the pixels from that object as it appears for that frame, and store those pixel in a ByteArray or even a Vector array of BitmapData.
That being said, once you have the data you will need to learn about encoding; yet, there are a ton of libraries out there that can help you avoid having learn a file spec and make an encoder from scratch.
Hope this helps.

Actionscript guru puzzle

Can someone suggest a workaround to the following problem:
I want to make an application that will create an area on stage that will be filled with images. Firstly, the images have to be 'saved' on an array. The problem for me is that I want this to be quite generic. I mean, according to a configuration file(?) or some constants(?), one build of the application may result to an SWF that will create a Rectangle area on stage filled with some graphics from virtual folder 1, while another build of the same application may result to one rectangle area and one triangle area each one filled with graphics from virtual folder 1, and folder 2 respectively.
I have stuck here sometime now. Can you suggest a workaround to this?
I'm not sure I completely understand your question, but I've been creating a somewhat similar application in AS3 which reads from a text-file using a URLLoader, and then parses that text to figure out which images to display on screen. It's quite easy to do basic parsing using the built in String library methods. Would this technique work for your problem?

AS3 - can't interact with swf file after loaded in

So I have this interactive swf file that I loaded externally as a background, everything's fine, but it's just not interactive anymore, I can't click on it. I googled this problem for a really long time and couldn't find an answer, I've tried the normal Flash way, and also using this library CASAlib, still couldnt find a solution. Does anyone know how to make this work? Thanks.
Cheers,
Christine
May be the objects on the foreground are preventing the background SWF from getting any mouse actions. It's hard to say anything without seeing the code.
What is the ActionScript version of loader and loaded content? If it's 2 and 3 it will hapen as you say. If all is set to as3 it will work. Remeber about sandbox restrictions.