I am using the following method to save the image:
private function captureImg(comp:UIComponent, name:String):void {
var imageSnap:ImageSnapshot = ImageSnapshot.captureImage(comp);
var imageByteArray:ByteArray = imageSnap.data as ByteArray;
imgSave.saveImage(imageByteArray, name+"-img.png");
}
imgSave is a RemoteObject java class. The problem is that the flex app which
runs this
code never gets launched on the server. When I try to launch it from java with
a runtime
exec and the URL, it never launches, presumably because it is running in a
browser and
the server is headless. That's why I am considering reconfiguring flex to run
headless or
converting it into an AIR app.
--- In [email protected], "Igor Costa" <[EMAIL PROTECTED]> wrote:
>
> actually not need air app to do that, You can use the bytearray to encode
> the image and send to your java to save that each time or in meanwhile you
> need.
>
> Regards
> Igor
>
> On Mon, Jun 2, 2008 at 4:50 PM, netdeep <[EMAIL PROTECTED]> wrote:
>
> > I am trying to run flex as an image generator on the server. Since my
> > server is headless, the
> > feedback I am getting is that it is bad practice to run flex in the browser
> > for a background
> > app.
> >
> > Here's what the program does in a nutshell:
> >
> > The server launches my java app. It reads a list of report definitions from
> > the data base. For
> > each report, it spawns a thread. Each thread launches my Flex application
> > in the browser.
> > Flex draws the data in charts. Each time data is pushed to the flex
> > application from the java
> > server side, Flex calls a remote java method to save it's image to a file.
> > This file sits in a
> > directory where it can be viewed in a regular old html page.
> >
> > The problem is really the automated aspect. I want to have this chart
> > generated every few
> > minutes as a .png file. It works perfectly fine on my localhost machine,
> > but the server
> > deployment is so far not working. We have firefox installed on the server.
> > Is there no way to
> > launch it as a background process to draw these images? Should I turn this
> > into an AIR app
> > (I've never done anything with AIR up to this point) to make it run more
> > easily in the
> > background?
> >
> >
> >
>
>
>
> --
> ----------------------------
> Igor Costa
> www.igorcosta.com
> www.igorcosta.org
>