Page 1 of 1

printing

Posted: Sun Jun 26, 2005 3:52 pm
by kimb
Hello,

How can I send a actionscript command to a swf movie from Delphi? E.g. I want to use print(); to print some flash frames.

kimb

Posted: Tue Jun 28, 2005 1:27 pm
by Softanics
Thank you for your questions.

Printing step-by-step:

1. Create Printing.swf:

Code: Select all

print("", "bmax");


2. Create printing_movie.rc:

Code: Select all

Printing SWF "printing.swf"


3. Make printing_movie.res:

Code: Select all

BRCC32 printing_movie.rc


4. Add the following code to printing:

Code: Select all

{$R 'res\printing_movie.res'}
   
var
  ResourceStream: TResourceStream;
begin
  ResourceStream := TResourceStream.Create(0, 'Printing', 'SWF');
  FlashPlayerControl1.LoadMovieFromStream(1 { level 1 - just for example } , ResourceStream);
  ResourceStream.Free;
end;

Posted: Tue Jun 28, 2005 1:38 pm
by Guest
Hmm, thanks, not really what i was after though.

The Macromedia swf player can print any SWF file, I want to do something like that.

Is there no way to tell flashplayercontrol to print a SWF frame like the MM player can?

kimb

Posted: Tue Jun 28, 2005 2:21 pm
by Softanics
I don't know another way - only loading additional movie into FlashPlayerControl. The problem is Print Method is not exported by Flash.

Posted: Tue Jun 28, 2005 2:27 pm
by Guest
I just reread what you suggested, yes that will do for now, thanks.

It would be cooler if there was a neater solution, but i suppose if the control doesn't export any print functions there's nothing you can do.

Kimb

Posted: Tue Nov 01, 2005 2:10 pm
by Pete
I have been looking at ways to print a frame from a movie from Delphi.
The best print quality is by using the ActionScript printjob class. This works fine if the movie has no mask layers. If mask layers are present then FlashPlayerControl just ignores them.
I've posted some sample code here:
http://www.focuseducational.com/petes_s ... hprint.zip
that shows this.

The only other solution I can find is to copy the frame as a bitmap and print this, but obviously the quality is not so good when the bitmap is stretched onto the printer. (this does have the advantage that I can implement a print preview). The other problem is that the whole flashplayercontrol window is copied, which can make for a lot of wasted space.

Has anyone got any ideas on this?

Pete

Posted: Wed Nov 30, 2005 9:42 pm
by kimb
Hmm, can't help with the mask layers but I worked out how to print multiple images using the download example. Basically the 'framenumber' parameter in addpage() doesn't seem to work, you need to print each page as a seperate movie clip to print more than one page in one go.

Make some movie clips named 'mc1' 'mc2' 'mc3' 'mc4' in Pete's download.

Then alter his actionscript so that it says

Code: Select all

function DoPrint(){
var pj = new PrintJob();
  if (pj.start()){   
  pj.addPage("mc1");
  pj.addPage("mc2");
  pj.addPage("mc3");
  pj.addPage("mc4");
  pj.send();
  }
 delete pj;
}


It should print out all 4 images on 4 pages without the print dialog popping up on every page. Problem now is that this is static, I need to load these pages dynamically from a resource dll.

So.. does anyone know how to dynamically change a movie clip's contents using streams? e.g. I have 400 single frame swf files in a resource dll. I want to queue up an arbitrary selection of them and print them all off in one go.

I will post if If/when I work out a way to do it... any assistance is cool though.

kimb