Hi everyone!!
i´m 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
Printable View
Hi everyone!!
i´m 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
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
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"
https://i.imgur.com/9mOothZ.png
and finsfreeworld@hotmail.com is his email thanks a lot.
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. 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.
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:
with this new part:PHP Code:
var bd:BitmapData=new BitmapData(screenBounds.width,screenBounds.height, true, 0x00000000);
bd.draw(stage);
-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 startPHP Code:
var bd:BitmapData=new BitmapData(200,200, true, 0x00000000);
var m1:Matrix = new Matrix(1,0,0,1,-mc.x,-mc.y);
bd.draw(stage,m1);
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
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
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 filesystemPHP 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.CLICK, f2_ClickToGoToAndStopAtFrame);
function f2_ClickToGoToAndStopAtFrame(event:MouseEvent):void
{
A2.gotoAndStop("c_alum");
A2.visible = true;
SaveImage()
}
MovieClip(sp2.content).botaoGaudi.addEventListener(MouseEvent.CLICK, f2_ClickToGoToAndStopAtFrame_1);
function f2_ClickToGoToAndStopAtFrame_1(event:MouseEvent):void
{
A2.gotoAndStop("c_gaudi");
A2.visible = true;
SaveImage()
}
MovieClip(sp2.content).botaoPraga.addEventListener(MouseEvent.CLICK, f2_ClickToGoToAndStopAtFrame_2);
function f2_ClickToGoToAndStopAtFrame_2(event:MouseEvent):void
{
A2.gotoAndStop("c_praga");
A2.visible = true;
SaveImage()
}
MovieClip(sp2.content).botaoViena.addEventListener(MouseEvent.CLICK, f2_ClickToGoToAndStopAtFrame_3);
function f2_ClickToGoToAndStopAtFrame_3(event:MouseEvent):void
{
A2.gotoAndStop("c_viena");
A2.visible = true;
SaveImage()
}
MovieClip(sp2.content).botaoMontblanc.addEventListener(MouseEvent.CLICK, f2_ClickToGoToAndStopAtFrame_4);
function f2_ClickToGoToAndStopAtFrame_4(event:MouseEvent):void
{
A2.gotoAndStop("c_montblanc");
A2.visible = true;
SaveImage()
}
MovieClip(sp2.content).botaoCaju.addEventListener(MouseEvent.CLICK, f2_ClickToGoToAndStopAtFrame_5);
function f2_ClickToGoToAndStopAtFrame_5(event:MouseEvent):void
{
A2.gotoAndStop("c_caju");
A2.visible = true;
SaveImage()
}
MovieClip(sp2.content).botaoMoscu.addEventListener(MouseEvent.CLICK, f2_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(f, FileMode.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.height, true, 0x00000000);
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);
}
Ok. i´ll try and let you know.... thanks, so much.
if i want to scroll only in Vertical? delete al "x" references?