Skip to main content
Inspiring
December 27, 2015
Question

Urgent - Export movieclip as swf

  • December 27, 2015
  • 1 reply
  • 985 views

Hi All,

I need a help from you. Im creating a application in flash. That application will have some objects (Ex: box, circle etc..) in the right side of the stage and the user can drag and drop them on the dedicated place (Movieclip) and they can get the output as swf in their desktop by clicking a btn. Is this possible in flash actionscript 3.0 or AIR or any other plug-ins?

I tried this --> "AS3SWF" class from claus/as3swf · GitHub‌, but its gives the output of full stage. But I need only particular movieclip on the stage should become a swf (with animation if has).

Please suggest me.

(Sorry I don't know flex).

Thanks,

Rajaguru.V

This topic has been closed for replies.

1 reply

Inspiring
December 27, 2015

Can you show the functions you're using to read, write and export the stage contents?

RajaguruVAuthor
Inspiring
December 28, 2015

Hi Nezarov,

Thanks for your reply. The below code was I tried.

import com.codeazur.as3swf.SWF;

  
var swf:SWF = new SWF(mySwfMc.loaderInfo.bytes); (I placed my MC name here. I don't load any external swf. I tried without loader info also.)

  
var ba:ByteArray = new ByteArray();
  swf
.publish(ba);

  
var C:ByteArray = new ByteArray();
  C
.position = 0;
  C
.writeBytes(ba);
  
var f:FileReference = new FileReference  ;

  f
.save(C,"demo.swf");

Inspiring
December 29, 2015

Hi Nezarov,


Thanks a lot for your help.


I tried the code you given. As you said Its gives me a particular movieclip as swf. But, it generate only one shape inside that particular mc as static(have multiple shapes in that mc). It ignores the animation inside that mc.


Actual app will work like this.

1. User will select a image from his sys by click on the browse btn and that image will be displayed in a container and will select the fadeIn checkbox

2. User will select a audio from his sys by click on the browse btn and will click add btn to add that audio

3. User will type the text on the container

4. User will click on the generate button and the generated swf should save in his local system

5. The generated swf should contain the image with fadein effect, audio and the text


Is this possible in flash using as3swf or any other code? Please help me.


Thanks,

Rajaguru.V



Hi, Unfortunately you cannot, because the items you're loading cannot be embedded in the main file, and the class you're using to publish .swf file, doesn't work with loaded or external items, it only reads the stage data and the embedded data (library data) + the code.

I've tried to create a preloader to load the ".swf maker" and send variables from the main preloader to the swfMaker.swf, that doesn't work also! the variables works in runtime but when I publish the demo file I get the origin values.