[Component] Using Shockwave Flash ActiveX in RichView

Demos, code samples. Only questions related to the existing topics are allowed here.
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

[Component] Using Shockwave Flash ActiveX in RichView

Post by Sergey Tkachenko »

Using Shockwave Flash ActiveX in RichView.
You can play SWF movies just in RichView documents, save/load them in RVF, export to HTML.

Download
http://www.trichview.com/support/files/rvswf.zip
and read readme.txt
shmp
Posts: 140
Joined: Sun Aug 28, 2005 10:19 am
Location: Sabah, Malaysia.
Contact:

Post by shmp »

Sergey, is this a latest demo?
Pieter E.
Posts: 835
Joined: Sun Aug 28, 2005 9:34 am

Using Shockwave Flash ActiveX in RichView (C++) ??

Post by Pieter E. »

Dear Sergey,

Do you have a sample in C++ for 'Using Shockwave Flash ActiveX in RichView'

Thanks.

Pieter E.
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

It's rather old, but I think it's up to date.

About C++Builder.
I believe the only way to use it in C++Builder is to rewrite it completely in C++. It's because this component uses DCU file generated on the ActiveX import, but C++Builder does not generate it.

I tried to create a component for C++Builder, but it does not work for some reason.
I uploaded it to http://www.trichview.com/support/files/ ... ashCPP.zip

Install "ShockwaveFlash" control (C++Builder will create ShockwaveFlashObjects_OCX cpp and h), then install this file.
2 new components will be installed:
TMyShockwaveFlash (the component translated from pascal)
TMyShockwaveFlashTest (test, the component inherited from TShockwaveFlash without new methods, fields and properties).
I tried to place TMyShockwaveFlash* swf on form and to call
swf->LoadFlash("somefile.swf");
swf->InitFlash();
swf->Play();
The program is crashed inside InitFlash(), on the line
Movie = FTmpFileName;
I tried to assign it simply as
swf->Movie = "somefile.swf";
but it crashed again. Movie is inherited from TShockwaveFlash, I did not modify it.

At the same time, assigning Movie of TMyShockwaveFlashTest works properly.

May be C++Builder experts can help here.
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Pieter E.
Posts: 835
Joined: Sun Aug 28, 2005 9:34 am

Post by Pieter E. »

Dear Sergey,

I've tried the sourcecode for handling TMyShockwaveFlash in C++ without any success. I'd like to try it using another method. I found a way to handle TShockwaveFlash, TMediaPlayer and QuickTime without errors in TRichViewEdit. (Drag&Drop, Stretching, Resizing, Playing, Stopping, etc). Still I can't figure out how to save the files to RVF.

Is it possible to create a stream from a file and save it to RVF? If so, should I use OnSaveComponentToFile or OnSaveItemToFile?

Could you please inform me?

Thanks,

Pieter E.
shmp
Posts: 140
Joined: Sun Aug 28, 2005 10:19 am
Location: Sabah, Malaysia.
Contact:

Post by shmp »

There is a good and bad side of TMyShockwaveFlash. If the swf reads other files, example text, the flash in rve will be blank. This is because rve is reading the swf directly into the memory without considering the other file that the swf is dependng. There are other methods that can be used for loading swf even with TMyShockwaveFlash but they must be used carefully.

What do you mean by saving the files to RVF? The swf? :shock:
Guest

Post by Guest »

@shmp: I'd like to save the SWF (flash file) in the RVF (RichView file). It would be perfect for my application. Because it only handles RichView documents. I hope it isn't bad for the performance of my application.
Pieter E.
Posts: 835
Joined: Sun Aug 28, 2005 9:34 am

Post by Pieter E. »

Sorry, I'm the 'Guest' this time. :D (I didn't login)
shmp
Posts: 140
Joined: Sun Aug 28, 2005 10:19 am
Location: Sabah, Malaysia.
Contact:

Post by shmp »

I would advice against doing that because it will slow down the process of RichView reading the file. You can, on the other hand, save the swf file into the same directory as your rvf, which is simpler to do. swf is not component and so it cannot be included in the rvf file without altering richview source code. I have tried that and I found it was just too slow. Perhaps there is another way that I did no see.

Good luck.
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Components are saved in RVF files together with all their published properties. Well, a flash movie or another binary data cannot be a real published property, but they can be saved and loaded in a fake property defined in the component's DefineProperties method (it must be overriden in your component). In this method, call Filer.DefineBinaryProperty method specifiyng your component's methods for reading and writing this property. A good example can be found in this TMyShockwaveFlash component: a flash file is saved in 'FlashMovie' fake property.

So, if you want to save some file with your component, do it as it was implemented in TMyShockwaveFlash.
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

shmp, in TMyShockwaveFlash, a new movie must be loaded using LoadFlash method.
shmp
Posts: 140
Joined: Sun Aug 28, 2005 10:19 am
Location: Sabah, Malaysia.
Contact:

Post by shmp »

Hi Sergey,

Can't I cheat a bit by assigning swf.Movie := ... instead? :(

The swf.LoadFlash will load the flash but without any supporting files. Say there is a text box in the swf and the text should be read while the swf file is placed in RichView, but the text is never read nor displayed in the swf text-box. It is always empty. The swf.InitFlash does not allow the reading of the text through a stream. Is there any other method to allow the swf to read its own assigned files?

Unless there is a command for reading the text after or just before the AddControlEx..., LoadFlash does not allow the swf to read supporting files.

Any suggestion here?

Henry
shmp
Posts: 140
Joined: Sun Aug 28, 2005 10:19 am
Location: Sabah, Malaysia.
Contact:

Post by shmp »

Or most likely, swf do not know where the text filles are since it is working through a stream?

Henry.
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Yes, this component assumes that flash movies do not require additional data, or they know from where to get them regardless of the movie location.

LoadFlash loads the movie into the internal stream (which can be saved in RVF file). When playing (InitFlash), it creates a temporal flash file in temporal directory, and plays it.
If you need to play a file from the specific location instead of stream, of course, use standard TShockwaveFlash.
Post Reply