SwishMax4 saving stage to bitmapdata
A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: SwishMax4 saving stage to bitmapdata

  1. #1
    Junior Member
    Join Date
    Feb 2013
    Posts
    3

    SwishMax4 saving stage to bitmapdata

    It's been a few years since i've swished or actionscripted with MM. Maybe one of you pros can help me
    connect the dots. I need to save my stage to jpg image. I'm able to pass a block to php script
    to save image to the server, but i can't seem to set my stage/scene view to the BitmapData.

    I have an application where users are building a design layout and I need to save the work to the
    server once they click the save button.

    How do I assign the stage/active scene to the BitmapData? I'm using Max4.



    function CreateSnapClick() {
    //create block on scene
    Bitmap_Data = flash.display.BitmapData;
    img_object_1 = new Bitmap_Data(715, 328, false, 0x78A240);
    img_object_1.draw();

    //add stage and img_object_1 to snapshot
    myShoot.attachBitmap(img_object_1, 1);
    myShoot._x = 0;
    myShoot._y = 0;

    }

    function SaveSnapClick() {

    var snap = img_object_1;

    var pixels:Array = new Array();
    var w:Number = 715;
    var h:Number = 328;

    trace("Dimensione X:" + w + " Dimensione Y:" + h);

    for (var a = 0; a < w; a++) {
    for (var b = 0; b < h; b++) {
    var tmp = snap.getPixel(a, b).toString(16);
    pixels.push(tmp);
    }
    }
    trace("Size: " + pixels.length );

    var output:LoadVars = new LoadVars();

    output.img = pixels.toString();
    output.height = h;
    output.width = w;
    output.Submit = 1;
    output.onLoad = function (success) {
    if(success) {
    trace("Success");
    } else {
    trace("Failure");
    }
    }

    fscommand("postData", h + "|" + w + "|" + output.img);

    output.send("save.php?page", "_self" , "POST");
    }


    Example
    http://www.renewman.com/savesnap/index.html
    Source
    http://www.renewman.com/savesnap/savesnap.swi

  2. #2

  3. #3
    Junior Member
    Join Date
    Feb 2013
    Posts
    3
    Its nice to finally be dialoging with someone on my issue...swishzone.com and swithtalk.com have not approved my user in over a week. what gives?

    Anyway...your save as example is nice, however...what I am trying to do is capture they entire stage which has many clips on it...i have built a designer where folks can move objects around the screen. I want them to be able to click a button to save it to, for either email or link to server that is emailed to a sales person.

    http://molymfg.com/portals/82/design...ydesigner.html

    Thanks Wolf for responding, I've seen your help posts all over zone and talk...

  4. #4
    Junior Member
    Join Date
    Feb 2013
    Posts
    3
    this example does exactly what i'm hoping to achieve.

    http://www.swishtalk.com/showthread.php?t=50704

    pass image to php, save to server, include link to file with other form data from like name, email, phone, etc.

    This camera swish app creates a bitmap object from the camera connection...i want to set the bitmapdata object to the visible cast members on the stage.

  5. #5

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