How to export image from swf with ActionScript3/PHP?

后端 未结 2 1593
我寻月下人不归
我寻月下人不归 2021-01-15 20:10

i have another piece for more advanced guys than me ;)

I am developing a simple flash application to create your own coat of arms. When finished creating, it would b

相关标签:
2条回答
  • 2021-01-15 20:31

    This seems to be a popular question lately. So I don't completely reiterate all that information, instructions for saving the image data, once you've obtained that as BitmapData, are here:

    How can I send a ByteArray (from Flash) and some form data to php?

    But, first, to get the image data, you'll need to pull it out of whatever MovieClip/Sprite, whatever you have it in. To do this, you simply do:

    var myBitmapData:BitmapData = new BitmapData(desiredWidth, desiredHeight, isTransparent, backgroundColor); myBitmapData.draw(mcToBeSavedToImage);

    Where mcToBeSavedToImage is the movieclip you want to turn into an image. The BitmapData reference is here, if you need it - it has other examples: http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/BitmapData.html

    Hope that helps!

    0 讨论(0)
  • 2021-01-15 20:34

    First, draw the image (Sprite or MovieClip, etc) into a BitmapData:

    var b: BitmapData = new BitmapData(640, 480, false, 0xffffffff); 
    b.draw(mcToBeSaved);
    

    Then, use e.g. as3corelib to encode the BitmapData into PNG or JPG files.

    var ba: ByteArray = PNGEncoder.encode(b);
    

    Then, for Flash 10, you can immediately get the user to save the image to a file, using FileReference's save method.

    0 讨论(0)
提交回复
热议问题