Flash Gallery | Flash Templates | Flash Menu | Flash Design | Flash Audio & Video

flash page flip

Actionscript 3.0 video tutorials

+ Reply to Thread
Page 1 of 8
1 2 3 ... LastLast
Results 1 to 10 of 78

Thread: SWF to PNG with Actionscript 3.0 - ByteArray class

  1. #1
    Administrator Living At The FlepStudio! Flep is on a distinguished road
    Join Date
    Jul 2007
    Posts
    5,452
    Rep Power
    8

    SWF to PNG with Actionscript 3.0 - ByteArray class

    amazing Flash templates
    Greetings to all!

    Today, I am proud of this very interesting article.
    Not that the other ones are not interesting but this one beats them all from my point of view.

    Have you ever thought on how to extract an image of format .png from a SWF?

    With Actionscript 2.0, I personally had done it for an application using the BitmapData class and the library GD of PHP. It was certainly not very performing but it was the only way to do it at the time.

    With Actionscript 3.0, we have the ByteArray class available that allows us to script a BitmapData into a ByteArray.
    As my knowledge of binary programming are not sufficient to realise all of it on my own, I found on the web a script from Adobe, which scripts a BitmapData and returns a ByteArray.
    I then realised that the ByteArray was not ready to be passed to a server side script and so I asked help to a friend of mine, an engineer named Daniele Lazzara of OrigamiStudio.it with a real virtue in informatics and a big passion for Flash. He used a codification created by Steve Webster & dynamicflash.com to convert the ByteArray to a String and implemented a PHP script to complete the job.
    Finally, I implemented a call to the PHP script from Flash and?it works wonderfully!

    Read more

    The result:






    The main steps of Main.as, the Document Class of this project are as follow:

    Properties
    a BitmapData
    private var bitmap_data:BitmapData;
    a ByteArray
    private var byte_array:ByteArray;
    I instance the Adobe PNGEncoder class
    var encoding:PNGEncoder;
    I create a new BitmapData
    bitmap_data=new BitmapData(stage.stageWidth,stage.stageHeight,fals e,0xDEDEDE);
    Using the method ?draw? of the BitmapData, I take a ?screenshot? of the MovieClip that realise the drawing
    bitmap_data.draw(clip);
    I assign to my ByteArray a value returned by the method ?encode? of the Adobe PNGEncoder class, passing to it the BitmapData
    byte_array=PNGEncoder.encode(bitmap_data);
    I create a String variable and assign to it the value returned by the static method ?encodeByteArray? of the Base64 class by Steve Webster, passing to it the ByteArray
    var encoded:String=Base64.encodeByteArray(byte_array);
    By now, you should understand easily the rest as I send the data to the PHP script
    var variables:URLVariables=new URLVariables();
    variables.png=encoded;
    var richiesta:URLRequest=new URLRequest();
    richiesta.url='http://www.flepstudio.org/swf/mix/SWF_to_PNG/prova2.php';
    richiesta.method=URLRequestMethod.POST;
    richiesta.data=variables;
    var loader:URLLoader=new URLLoader();
    loader.dataFormat=URLLoaderDataFormat.BINARY;

    Source files:
    Attached Files

  2. #2
    Junior Member Settled In darylmata is on a distinguished road
    Join Date
    Oct 2007
    Posts
    15
    Rep Power
    0

    Re: SWF to PNG with Actionscript 3.0 - ByteArray class

    I upload the files just like they came on the folder and i doesn't work, I'd already try with others tutorials and it's the same result, I just want to know what am I missing?


    It's really important for me to get this done, I have Flash CS3, I changed the links that came on the main.as, don't know what else to do.

    daryl.mat@hotmail.com
    Last edited by darylmata; 14-10-07 at 04:29. Reason: http://www.paginasprodigy.com/darylmata/SWF_to_PNG_eng/main_eng.swf

  3. #3
    Administrator Living At The FlepStudio! Flep is on a distinguished road
    Join Date
    Jul 2007
    Posts
    5,452
    Rep Power
    8

    Re: SWF to PNG with Actionscript 3.0 - ByteArray class

    Hi,
    did you chmod to 777 the php script ?

  4. #4
    Junior Member Settled In darylmata is on a distinguished road
    Join Date
    Oct 2007
    Posts
    15
    Rep Power
    0

    Re: SWF to PNG with Actionscript 3.0 - ByteArray class

    I appreciate your time... I'm very frustrated...

    uhmm.. no I din't move anything on the php..

    I've been working on flash for almost 6 years on my own or by tutorials.

    This is my first time with php.

    Well actually my third, the first one was for the Flash MP3 Playlist and the second one was for the Send an eMail on Flash.

  5. #5
    Administrator Living At The FlepStudio! Flep is on a distinguished road
    Join Date
    Jul 2007
    Posts
    5,452
    Rep Power
    8

    Re: SWF to PNG with Actionscript 3.0 - ByteArray class

    Hi
    I meant if you set to 777 the permissions of sendMail.php

  6. #6
    Junior Member Settled In darylmata is on a distinguished road
    Join Date
    Oct 2007
    Posts
    15
    Rep Power
    0

    Re: SWF to PNG with Actionscript 3.0 - ByteArray class

    yes.. sorry

    I've change the mode to 777 on the php from the ftp, still it's not working

    i tryed on Html kit and on Flash FXP

    i was working on it right now

  7. #7
    Junior Member Settled In darylmata is on a distinguished road
    Join Date
    Oct 2007
    Posts
    15
    Rep Power
    0

    Re: SWF to PNG with Actionscript 3.0 - ByteArray class

    i'm worried that the files aren't well linked, do I place them exactly just how are on the compress folder?

    Do I need a folder named "images" or is the same that is on the adobe folder?

  8. #8
    Junior Member Settled In darylmata is on a distinguished road
    Join Date
    Oct 2007
    Posts
    15
    Rep Power
    0

    Re: SWF to PNG with Actionscript 3.0 - ByteArray class


  9. #9
    Administrator Living At The FlepStudio! Flep is on a distinguished road
    Join Date
    Jul 2007
    Posts
    5,452
    Rep Power
    8

    Re: SWF to PNG with Actionscript 3.0 - ByteArray class

    Ok,
    now you need a folder with name ' images ' ( into SWF_to_PNG_eng ) and chmod 777 it.

    PS: you don't need to upload the ' com ' folder '.

  10. #10
    Junior Member Settled In darylmata is on a distinguished road
    Join Date
    Oct 2007
    Posts
    15
    Rep Power
    0

    Re: SWF to PNG with Actionscript 3.0 - ByteArray class

    got it... I've created the folder and set the properties and erased the "com" folder

+ Reply to Thread
Page 1 of 8
1 2 3 ... LastLast

Similar Threads

  1. Replies: 12
    Last Post: 25-11-09, 08:36
  2. Date class of Actionscript 3.0
    By Flep in forum Tutorials
    Replies: 0
    Last Post: 15-10-09, 07:19
  3. Timer class of Actionscript 3.0
    By Flep in forum Tutorials
    Replies: 6
    Last Post: 21-02-09, 00:59
  4. Using PrintJob class of Actionscript 3.0
    By Flep in forum Tutorials
    Replies: 0
    Last Post: 19-11-08, 06:12
  5. CheckEmail Class - Actionscript 3.0
    By Flep in forum Tutorials
    Replies: 9
    Last Post: 19-12-07, 08:03

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Optimization by vBSEO