Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 15-03-2004
Avatar de yusnerqui
yusnerqui yusnerqui is offline
Miembro
 
Registrado: mar 2004
Ubicación: Cuba
Posts: 679
Poder: 21
yusnerqui Va por buen camino
Question SWF en mis aplicaciones

Hola a todos.

Estoy usando Delphi 5 y me gustaría poder incluir películas de flash (swf) en mis aplicaciones. He tratado con un ActivX que trae el propio Flash pero al mover mi aplicación a otras máquinas no me funciona, incluso llevándome con ella el ActivX y poniéndolo en el mísmo directorio.
Les agradecería que si conocen el modo de solucionar mi problema me ayudaran.
Gracias a todos

Saludos Yusnerqui
Responder Con Cita
  #2  
Antiguo 15-03-2004
Avatar de marcoszorrilla
marcoszorrilla marcoszorrilla is offline
Capo
 
Registrado: may 2003
Ubicación: Cantabria - España
Posts: 11.221
Poder: 10
marcoszorrilla Va por buen camino
Mírate esta información, creo que el problema es que no registras el OCX:

Código:
To make use of SWF files in your Delphi application you should have the swf plugin installed then follow these steps: 

Um SWF-Dateien in einer Delphi-Applikation gebrauchen zu können, muss  das SWF-Plugin installiert sein. 

                    {English} 

                    In the Delphi IDE 

                    - click on "Component", "Import ActiveX Control" 

                    - chose "Shockwave Flash" and click on "install". 

                    Now you have a TShockwaveFlash component in your IDE on the ActiveX
                    tabsheet. 

                    Place the TShockwaveFlash Component onto your form, resize it as needed but 
                    for now do not assign a movie to it. 

                    You will need to register the ocx file if it is not installed on the  target computer. So you should have a resource file with 

                    - the swflash.ocx and your Flash ( *.swf) file. 

                    - Copy swflash.ocx (from i.e. windows\system32\macromed\flash) and your custom swf file to your project path. 

                    - Create a textfile with a code like this: 

                    SHOCKWAVEFILE RCDATA yourfile.swf 

                    SHOCKWAVEOCX RCDATA swflash.ocx 

                    (Where yourfile.swf is your swf-file) 

                    - Save this file as flash.rc 

                    - Goto Commandline, change to your project dir and enter the line: 

                    "Brcc32 -r flash.rc" 

                    - Now you have your new resource as flash.res file 

                    {Deutsch} 


                    In der Delphi IDE: 

                    - Im Menü Komponente, "ActiveX importieren" anklicken. 

                    - Dann "Shockwave Flash" auswählen und "Installieren..." anklicken. 

                    Jetzt ist die TShockwaveFlash unter dem ActiveX Register zu finden. 

                    Plaziere nun eine TShockwaveFlash Komponente auf einer form und passe die 

                    evtl. die Grösse an. Noch kein "Movie" laden! 

                    Wenn auf einem anderen Computer swflash.ocx nicht installiert ist, muss 

                    sie dort noch installiert werden. Dazu machen wir eine Ressource-Datei 

                    welche die swflash.ocx und die eigene Flash ( *.swf )-Datei enthält. 

                    - Kopiere zuerst die swflash.ocx (von z.B windows\system32\macromed\flash) 

                    und die eigene Flash Datei (.sfw) in dein Projekte-Verzeichnis. 

                    - Erstelle eine Textdatei mit folgenden zwei Zeilen: 

                    SHOCKWAVEFILE RCDATA yourfile.swf 

                    SHOCKWAVEOCX RCDATA swflash.ocx 

                    (Wobei yourfile.swf die eigene Flash-Datei ist) 

                    - Speichere die Datei als flash.rc 

                    - Starte den MS-DOS Promt (Command.com), wechsle ins dein
                    Projekte-Verzeichnis 

                    und gib folgende Zeile ein: 

                    Brcc32 -r flash.rc 

                    - Jetzt hat es automatisch die flash.res Datei erstellt. 


                    {************************************************************} 


                    uses ShockwaveFlashObjects_TLB; // will be used automatically 
                    {...} 

                    implementation 

                    {$R *.DFM} 
                    {$R flash.res} // your new created resource 
                    {...} 

                    procedure TForm1.FormCreate(Sender: TObject); 
                    var 
                      SystemDir : array[0..MAX_PATH] of Char; 
                      SWFDir, AppDir: String; 
                      Fres: TResourceStream; 
                      Ffile: TFileStream; 
                    begin 
                        GetSystemDirectory(@SystemDir,MAX_PATH); 
                        SWFDir := SystemDir+'\macromed\flash\'; 
                        GetDir(0,AppDir); // Get current directory 

                        //check whether the sw-flash ocx is already installed 
                        if fileexists(SWFDir+'swflash.ocx')=false then begin 
                            //create directories if needed and extract file from resource. 
                            {$i-} //compiler directive to suppress i/o error messages 
                            MkDir(SystemDir+'\macromed'); 
                            MKDir(SystemDir+'\macromed\flash'); 
                            {$i+} 
                            Fres := TResourceStream.Create(0,'SHOCKWAVEOCX',RT_RCDATA); 
                            Ffile := TFileStream.Create(SWFDir+'swflash.ocx',fmCreate); 
                            Ffile.CopyFrom(Fres,Fres.Size); 
                            Fres.Free; 
                            Ffile.Free; 

                            //register ocx (simple but useful) 
                            winexec(PChar('regsvr32 /s '+SWFDir+'swflash.ocx'),SW_HIDE); 
                        end; 
                        // extract ShockwaveFile from resource to application directory 
                        Fres := TResourceStream.Create(0,'SHOCKWAVEFILE',RT_RCDATA); 
                        Ffile := TFileStream.Create('flashmovie.swf',fmCreate); 
                        Ffile.CopyFrom(Fres,Fres.Size); 
                        Fres.Free; 
                        Ffile.Free; 

                        //Assign the extracted swf file to your TShockwaveFlash object 
                        FlashMovie.Movie := AppDir+'\flashmovie.swf'; 
                    end;

Un Saludo.
__________________
Guía de Estilo de los Foros
Cita:
- Ça c'est la caisse. Le mouton que tu veux est dedans.
Responder Con Cita
  #3  
Antiguo 15-03-2004
Avatar de yusnerqui
yusnerqui yusnerqui is offline
Miembro
 
Registrado: mar 2004
Ubicación: Cuba
Posts: 679
Poder: 21
yusnerqui Va por buen camino
Exclamation Muchas gracias

Te agradesco mucho la información
Pero no me queda claro lo del archivo de recurso. Como crearlo quiero decir, nunca he trabajado con ellos y veo que me está haciendo falta.
Si me pudieras ayudar.
Tengo entendido que existen Software para crearlos. Conoces donde pudiera vajar alguno

Gracias y perdona la torpeza

Saludos Yusnerqui
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro


La franja horaria es GMT +2. Ahora son las 10:18:08.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi