printing

F-IN-BOX for Delphi / Builder C++ / VCL
kimb

printing

Postby kimb » Sun Jun 26, 2005 3:52 pm

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

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Tue Jun 28, 2005 1:27 pm

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;
Best regards, Artem A. Razin,
F-IN-BOX support
Ask your question here: http://www.f-in-box.com/support.html

Guest

Postby Guest » Tue Jun 28, 2005 1:38 pm

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

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Tue Jun 28, 2005 2:21 pm

I don't know another way - only loading additional movie into FlashPlayerControl. The problem is Print Method is not exported by Flash.
Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html

Guest

Postby Guest » Tue Jun 28, 2005 2:27 pm

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

Pete
Posts: 16
Joined: Fri Sep 30, 2005 10:54 am

Postby Pete » Tue Nov 01, 2005 2:10 pm

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

kimb
Posts: 4
Joined: Mon Nov 28, 2005 12:18 pm

Postby kimb » Wed Nov 30, 2005 9:42 pm

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


Return to “Delphi / Builder / VCL Edition”

Who is online

Users browsing this forum: No registered users and 19 guests

cron