dcsimg
A Flash Developer Resource Site

Page 2 of 2 FirstFirst 12
Results 21 to 26 of 26

Thread: Flash creating a JPG or PNG dynamically?

  1. #21
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    I don't even know what you're asking.

    You already said you have a bunch of layers that you want to save as a single image. Assuming that those layers have a common DisplayObjectContainer ancestor which contains nothing you don't want drawn into the final image, just draw that ancestor. If you don't have such a common display ancestor, then how ARE the layers set up?

  2. #22
    Junior Member
    Join Date
    Mar 2010
    Posts
    13
    Alright thanks it took me a minute DUH LOL

    Put the multiple changeable images into a single movie clip and then use the that single movie clip as the jpeg or png set the height and width values to match and there is my image!

    It works thank you so much sry for being so dense LOL!

    Now if I can get this to transfer to paypal that is oging to be a whole new issue! Any suggestions?

  3. #23
    Junior Member
    Join Date
    Mar 2010
    Posts
    13
    No its just I already have the program done with all the layers done separately they are not placed into a common DisplayObjectContainer


    so to make it work I will have to select all of the images used and then convert them into a movieclip and give that a instance name I was wanting to avoid that because I will have to go through the script and change my code to reflect the new one:

    image1
    image2
    image3

    ect....

    will all have to be changed to

    newmovieclip.image1
    newmovieclip.image2
    newmovieclip.image3


    unless there is a better way
    But I figure I will do that to make it work.

  4. #24
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    You could just declare local variables to take their place.

    Code:
    var image1:MovieClip = newmovieclip.image1;
    var image2:MovieClip = newmovieclip.image2;
    var image3:MovieClip = newmovieclip.image3;
    Then subsequent code can remain unchanged.

    Also, it is possible to just draw the root into the bitmapdata, but you'll have to construct an appropriate matrix and clipRect to pass to the draw method. I don't recall the exact meanings of those right now, but you can use them to draw only a portion of the drawable.
    See the livedocs for more details:
    http://help.adobe.com/en_US/AS3LCR/F...tml#draw%28%29

  5. #25
    Junior Member
    Join Date
    Mar 2010
    Posts
    13
    LOL NO even better

    I am going to add a form at the end for the customer to fill out contact info wile having there custom image finished at the left hand side
    Then I will just have the code to this:

    import com.adobe.images.PNGEncoder;

    //saveit is a save button added to the document.//
    saveit.addEventListener(MouseEvent.CLICK,saveStill );

    function saveStill (e:MouseEvent):void{
    var bmp:BitmapData = new BitmapData(stage.width, stage.height, true, 0x00000000);
    bmp.draw(stage);
    var bytes:ByteArray = PNGEncoder.encode(bmp);
    var fr:FileReference = new FileReference();
    fr.save(bytes, "sticker.png");
    }


    LOL I tested it and it works

    Even better I don't have create a ton variables to pass along to pay pal, just the price and product name, the image can be passed though a php script (I HOPE) then ff to my email after payment, in the email I will the completed image and the customers contact info all saved as single screen shot of the finished app!

  6. #26
    Junior Member
    Join Date
    Mar 2010
    Posts
    13

    can this be transfered via p just email

    paypal can not transfer the completed image, I figured I would have it sent separately via a email link, or tie it in with a php script, but everything I found will only allow text.

    I am assuming:
    var bmp:BitmapData = new BitmapData(stage.width, stage.height, true, 0x00000000);
    bmp.draw(stage);
    var bytes:ByteArray = PNGEncoder.encode(bmp);
    var fr:FileReference = new FileReference();
    fr.save(bytes, "sticker.png");
    }


    That "bytes" is the variable holding the image data could this alone be sent
    and if it can how everything I have found is just sending text from froms nothing about sending images.

    Thanks

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center