dcsimg
A Flash Developer Resource Site

Results 1 to 13 of 13
  1. #1
    Junior Member
    Join Date
    Mar 2018
    Posts
    8

    SnapShot button in flash as3 ( animateCC), how to...

    Hi everyone!!

    im new in AS3 and Animate CC.
    Please, someone can tell me how a create/code a button to take a snapshot of the entire stage and save in to Camera Roll (android/iOS)?

    Thanks a Lot

  2. #2
    Senior Member Alloy Bacon's Avatar
    Join Date
    Apr 2011
    Posts
    920
    ok so the script is here its pretty fast I posted it as screenshot.rar here https://rpguy.weebly.com/ , I remember angelhdz from this forum gave it to me and I wrote a app for it, for pc it saves to \Documents\Images\8bit_1.png I am pretty sure you can find it saved on your phone storage if not let me know.

    The com folder should always be in the same directory as your publishing fla to compile

    If you want to share for that script since it takes a lot of skill to make the encoder you should send it to fruitbeard's paypal, you can find his link here: http://board.flashkit.com/board/show...51#post4332051
    My 3D browser based flash demo, you can draw on the wall and it saves forever: https://spark.adobe.com/page/oXRKzNxeb9p1t/

  3. #3
    Junior Member
    Join Date
    Mar 2018
    Posts
    8
    Quote Originally Posted by Alloy Bacon View Post
    ok so the script is here its pretty fast I posted it as screenshot.rar here https://rpguy.weebly.com/ , I remember angelhdz from this forum gave it to me and I wrote a app for it, for pc it saves to \Documents\Images\8bit_1.png I am pretty sure you can find it saved on your phone storage if not let me know.

    The com folder should always be in the same directory as your publishing fla to compile

    If you want to share for that script since it takes a lot of skill to make the encoder you should send it to fruitbeard's paypal, you can find his link here: http://board.flashkit.com/board/show...51#post4332051

    Hi, Alloy. Thanks for the quick return.

    I opened the .FLA file, put a circle on the stage, ran the emulator ... but nothing happens. saved in the image folder. (workspace).

    Thanks

    ah!
    whats fruitbeard's paypal account?

    Hugs

  4. #4
    Senior Member Alloy Bacon's Avatar
    Join Date
    Apr 2011
    Posts
    920
    If you don't have this checked, it wont work on your phone, if you do, you can find it in Images on internal storage for a start.
    As for desktop it should be saving here when you click that save button on the stage I think I left it down there below the stage

    "C:\Users\Q\Documents\Images\8_bit_1.png"



    and finsfreeworld@hotmail.com is his email thanks a lot.
    My 3D browser based flash demo, you can draw on the wall and it saves forever: https://spark.adobe.com/page/oXRKzNxeb9p1t/

  5. #5
    Senior Member Alloy Bacon's Avatar
    Join Date
    Apr 2011
    Posts
    920
    I uploaded a new version:
    https://rpguy.weebly.com/

    This one gets the fullscreen, and doesn't stretch the stage on your phone.

    The screenBounds object gives you the size of the stage like, screenBounds.width and screenBounds.height

    if you are going to use screenBounds on desktop (not mobile) I would just change screenbounds to:
    screenBounds.width=stage.stageWidth;
    screenBounds.height=stage.stageHeight;
    My 3D browser based flash demo, you can draw on the wall and it saves forever: https://spark.adobe.com/page/oXRKzNxeb9p1t/

  6. #6
    Junior Member
    Join Date
    Mar 2018
    Posts
    8
    Quote Originally Posted by Alloy Bacon View Post
    I uploaded a new version:
    https://rpguy.weebly.com/

    This one gets the fullscreen, and doesn't stretch the stage on your phone.

    The screenBounds object gives you the size of the stage like, screenBounds.width and screenBounds.height

    if you are going to use screenBounds on desktop (not mobile) I would just change screenbounds to:
    screenBounds.width=stage.stageWidth;
    screenBounds.height=stage.stageHeight;
    Ok. ill try...

    Thx a lot

  7. #7
    Junior Member
    Join Date
    Mar 2018
    Posts
    8
    Ok. works great!!!! Thx.
    But I could not implement it in my project. here is the link, can you try? (Request) https://www.dropbox.com/s/j1sx3r3iqm...-2-18.rar?dl=0.
    another question: can I save on the camera roll or Documents / Images ... a specific image on the stage? example: this project is an interactive catalog. When you click or touch the product thumbnail, it shows as a pop-up window. I think it will be a good idea to save this image (broad view) to share at some point in social media, what do you think?
    Do you have a paypall account? i will send to you some gratification, for your time.

  8. #8
    Senior Member Alloy Bacon's Avatar
    Join Date
    Apr 2011
    Posts
    920
    Well you didn't add any screen shot buttons but if you are dealing with a whole image and you want to just snip the region inside of it up to a point replace:
    PHP Code:
    var bd:BitmapData=new BitmapData(screenBounds.width,screenBounds.heighttrue0x00000000);
    bd.draw(stage); 
    with this new part:
    PHP Code:
    var bd:BitmapData=new BitmapData(200,200true0x00000000);
    var 
    m1:Matrix = new Matrix(1,0,0,1,-mc.x,-mc.y);
    bd.draw(stage,m1); 
    -mc.x and -mc.y with a negative being the starting x and y of the snip and where it says 200,200 that's width and height from the matrix -x and -y start
    My 3D browser based flash demo, you can draw on the wall and it saves forever: https://spark.adobe.com/page/oXRKzNxeb9p1t/

  9. #9
    Senior Member Alloy Bacon's Avatar
    Join Date
    Apr 2011
    Posts
    920
    and if you want your scrollpane to scroll like a proper phone fling I have source here: https://www.youtube.com/watch?v=DSo_x1fnuo4
    My 3D browser based flash demo, you can draw on the wall and it saves forever: https://spark.adobe.com/page/oXRKzNxeb9p1t/

  10. #10
    Senior Member Alloy Bacon's Avatar
    Join Date
    Apr 2011
    Posts
    920
    ok change all of your base layer code to this and everytime you click a thumbnail it saves a new image of the stage:
    make sure the com folder I gave you is in the same place as .fla and target the player for air not for flashplayer
    and my paypal is crystalskate@gmail.com
    PHP Code:
    sp.source MC;
    sp.setSize(180,650);
    sp.visible false;



    MovieClip(sp.content).botaoClose.addEventListener(MouseEvent.CLICK,f2_ClickToHide_1);

    function 
    f2_ClickToHide_1(event:MouseEvent):void
    {
        
    sp.visible false;
    }


    MovieClip(sp.content).f_gaudiB.addEventListener(MouseEvent.CLICK,f1_ClickToGoToAndStopAtFrame_2);

    function 
    f1_ClickToGoToAndStopAtFrame_2(event:MouseEvent):void
    {
        
    A1.gotoAndStop("frente_gaudi");
        
    A1.visible true;
    SaveImage()
    }

    MovieClip(sp.content).f_praga.addEventListener(MouseEvent.CLICK,f1_ClickToGoToAndStopAtFrame_4);

    function 
    f1_ClickToGoToAndStopAtFrame_4(event:MouseEvent):void
    {
        
    A1.gotoAndStop("f_praga");
        
    A1.visible true;
    SaveImage()
    }

    MovieClip(sp.content).f_viena.addEventListener(MouseEvent.CLICK,f1_ClickToGoToAndStopAtFrame_5);

    function 
    f1_ClickToGoToAndStopAtFrame_5(event:MouseEvent):void
    {
        
    A1.gotoAndStop("f_viena");
        
    A1.visible true;
    SaveImage()
    }

    MovieClip(sp.content).f_montblanc.addEventListener(MouseEvent.CLICK,f1_ClickToGoToAndStopAtFrame_6);

    function 
    f1_ClickToGoToAndStopAtFrame_6(event:MouseEvent):void
    {
        
    A1.gotoAndStop("f_montblanc");
        
    A1.visible true;
    SaveImage()
    }

    MovieClip(sp.content).f_caju.addEventListener(MouseEvent.CLICK,f1_ClickToGoToAndStopAtFrame_7);

    function 
    f1_ClickToGoToAndStopAtFrame_7(event:MouseEvent):void
    {
        
    A1.gotoAndStop("f_caju");
        
    A1.visible true;
    SaveImage()
    }

    MovieClip(sp.content).f_moscu.addEventListener(MouseEvent.CLICK,f1_ClickToGoToAndStopAtFrame_8);

    function 
    f1_ClickToGoToAndStopAtFrame_8(event:MouseEvent):void
    {
        
    A1.gotoAndStop("f_moscu");
        
    A1.visible true;
    SaveImage()
    }

    // inicio codigo area2//

    sp2.source MC2;
    sp2.setSize(180,650);
    sp2.visible false;

    MovieClip(sp2.content).botaoClose.addEventListener(MouseEvent.CLICK,f2_ClickToHide_2);

    function 
    f2_ClickToHide_2(event:MouseEvent):void
    {
        
    sp2.visible false;
    }



    MovieClip(sp2.content).botaoAlum.addEventListener(MouseEvent.CLICKf2_ClickToGoToAndStopAtFrame);


    function 
    f2_ClickToGoToAndStopAtFrame(event:MouseEvent):void
    {
        
    A2.gotoAndStop("c_alum");
        
    A2.visible true;
        
    SaveImage()
    }


    MovieClip(sp2.content).botaoGaudi.addEventListener(MouseEvent.CLICKf2_ClickToGoToAndStopAtFrame_1);


    function 
    f2_ClickToGoToAndStopAtFrame_1(event:MouseEvent):void
    {
        
    A2.gotoAndStop("c_gaudi");
        
    A2.visible true;
        
    SaveImage()
    }

    MovieClip(sp2.content).botaoPraga.addEventListener(MouseEvent.CLICKf2_ClickToGoToAndStopAtFrame_2);


    function 
    f2_ClickToGoToAndStopAtFrame_2(event:MouseEvent):void
    {
        
    A2.gotoAndStop("c_praga");
        
    A2.visible true;
        
    SaveImage()
    }

    MovieClip(sp2.content).botaoViena.addEventListener(MouseEvent.CLICKf2_ClickToGoToAndStopAtFrame_3);


    function 
    f2_ClickToGoToAndStopAtFrame_3(event:MouseEvent):void
    {
        
    A2.gotoAndStop("c_viena");
        
    A2.visible true;
        
    SaveImage()
    }

    MovieClip(sp2.content).botaoMontblanc.addEventListener(MouseEvent.CLICKf2_ClickToGoToAndStopAtFrame_4);


    function 
    f2_ClickToGoToAndStopAtFrame_4(event:MouseEvent):void
    {
        
    A2.gotoAndStop("c_montblanc");
        
    A2.visible true;
        
    SaveImage()
    }

    MovieClip(sp2.content).botaoCaju.addEventListener(MouseEvent.CLICKf2_ClickToGoToAndStopAtFrame_5);


    function 
    f2_ClickToGoToAndStopAtFrame_5(event:MouseEvent):void
    {
        
    A2.gotoAndStop("c_caju");
        
    A2.visible true;
        
    SaveImage()
    }

    MovieClip(sp2.content).botaoMoscu.addEventListener(MouseEvent.CLICKf2_ClickToGoToAndStopAtFrame_6);


    function 
    f2_ClickToGoToAndStopAtFrame_6(event:MouseEvent):void
    {
        
    A2.gotoAndStop("c_moscu");
        
    A2.visible true;
        
    SaveImage()
    }






    import com.adobe.images.PNGEncoder;
    import flash.net.FileReference;
    import flash.utils.ByteArray;
    import flash.display.IBitmapDrawable;
    import flash.filesystem.File;
    import flash.net.*;
    import flash.filesystem.FileMode;
    import flash.filesystem.FileStream;
    var 
    screenBounds:Rectangle Screen.mainScreen.visibleBounds;



    stage.scaleMode StageScaleMode.NO_SCALE;
    stage.align StageAlign.TOP_LEFT;
    var 
    fr:FileReference = new FileReference();
    var 
    FileName:URLLoader;
    var 
    f:File = new File();
    var 
    Count:int;
    var 
    fs:FileStream;

    function 
    SaveImage(){                
    FileName=new URLLoader();
    FileName.dataFormat=URLLoaderDataFormat.VARIABLES;
    f=File.documentsDirectory;
    f=f.resolvePath("preferences.txt");
    if(
    f.exists){
    FileName.load(new URLRequest(f.url))
    FileName.addEventListener("complete"Complete)
    }else{
    Count=0;
    Save(Count);
    }
    }
    function 
    Complete(e:Event):void{
    Count e.target.data.count
    Save
    (Count);
    }
    function 
    IncreaseCount(e:Event):void{
    Count++;
    fs = new FileStream();
    fs.open(fFileMode.WRITE);
    fs.writeUTFBytes("count="+Count)
    fs.close();
    }
    function 
    Save(a:int):void{
    var 
    ba:ByteArray=new ByteArray(); 

    var 
    bd:BitmapData=new BitmapData(screenBounds.width,screenBounds.heighttrue0x00000000);
    var 
    m1:Matrix = new Matrix(1,0,0,1,-0,-0);
    bd.draw(stage,m1);


    ba PNGEncoder.encode(bd);
    var 
    fs2:FileStream=new FileStream();
    var 
    file:File=File.documentsDirectory.resolvePath("Images/" "8bit_" Count ".png");
    fs2.open(file,FileMode.WRITE);
    fs2.writeBytes(ba);
    fs2.close();
    fs2.openAsync(file,FileMode.READ);
    fs2.addEventListener(Event.COMPLETE,IncreaseCount);

    if you feel its to laggy on the app for a fullscreen shot just ask me to make the screenshot work better but the screenshot would than take like 3 seconds instead of 1 to get to the filesystem
    Last edited by Alloy Bacon; 03-05-2018 at 07:05 PM.
    My 3D browser based flash demo, you can draw on the wall and it saves forever: https://spark.adobe.com/page/oXRKzNxeb9p1t/

  11. #11
    Junior Member
    Join Date
    Mar 2018
    Posts
    8
    Ok. ill try and let you know.... thanks, so much.

  12. #12
    Junior Member
    Join Date
    Mar 2018
    Posts
    8
    if i want to scroll only in Vertical? delete al "x" references?

  13. #13
    Junior Member
    Join Date
    Mar 2018
    Posts
    8
    Quote Originally Posted by lzanlorenzi View Post
    if i want to scroll only in Vertical? delete al "x" references?
    Forget it.... just disable "X" in scrollPane parameters.

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

×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.