|
-
July 17th, 2001, 11:53 AM
#1
Flash animation as ActiveX control in MFC?
Greetings.
How do I make my flash animation as part of my MFC program?
I tried inserting an ActiveX control(Shockwave Flash) in my dialog and set the movie URL and base URL to "animation.swf", the animation is in the same folder as the program. However the animation does not shows, right-clicking on the control shows "Movie is not loaded".
What are the things that I have to set?
Advanced thanks for any help rendered.
-
August 2nd, 2001, 07:25 PM
#2
Flash help
If you want to access al the Flash functions then you should put some code into your dialog *.cpp /*.h file.
Like this.
// In CBlaBlaDlg header file
#include "shockwaveflash.h"
//
// In CBlaBlaDlg implementation file *.Cpp
BOOL CBlaBlaDlg ::OnInitDialog()
{
CDialog::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
//--------------------------------------------------------------------------
// "IDC_SHOCKWAVEFLASH1" is here the name for the flash control in your dialog.
CShockwaveFlash* pFlashBox =
static_cast<CShockwaveFlash*>(GetDlgItem(IDC_SHOCKWAVEFLASH1));
pFlashBox->SetBackgroundColor(0xC0C0C0);
pFlashBox->LoadMovie(1,"Flashtest.swf");
pFlashBox->SetMenu(false); // It's not gone entirely.
//--------------------------------------------------------------------------
return TRUE; // return TRUE unless you set the focus to a control
}
I hope the little info helps
Gr, David Smulders
/* Regards, David Smulders */
-
August 2nd, 2001, 08:46 PM
#3
Re: Flash help
Or the whole path is an option [file:///C:\\Flashtest.swf]
/*Gr, David Smulders*/
/* Regards, David Smulders */
-
August 4th, 2001, 07:57 PM
#4
Re: Flash (correct) help
This is the correct code:
// *.h
#include "shockwaveflash.h"
//
CString m_nStartPath;
CString m_nStartPathFi;
char StartPath[MAXBUFF_DIR_LENGTH];
//
#define MAXBUFF_DIR_LENGTH 1024
//*.cpp
// -------------- GetCurrentDirectory -----------------------------
GetCurrentDirectory(MAXBUFF_DIR_LENGTH, StartPath);
m_nStartPath = StartPath;
if (m_nStartPath.Right(1) == "\\")
{
m_nStartPathFi = m_nStartPath;
}
else
{
m_nStartPathFi = (m_nStartPath + "\\");
}
// SetWindowText(m_nStartPathFi); // test
// -------------- Flash Control -----------------------------
CShockwaveFlash* pFlashBox =
static_cast<CShockwaveFlash*>(GetDlgItem(IDC_FLASH));
CString FileString ="file:///";
CString m_SwfString ="Flashtest.swf";
CString UrlString = FileString + m_nStartPathFi + m_SwfString;
pFlashBox-> SetMovie(UrlString);
SetWindowText(UrlString); // test
// -------------- Flash Setting's -----------------------------
pFlashBox->Play();
pFlashBox->SetMenu(false); // It's not gone entirely.
pFlashBox->SetBackgroundColor(0x00CC00);
// --------------------------------------------------------------
/*Gr, David Smulders*/
/* Regards, David Smulders */
-
August 5th, 2001, 01:00 AM
#5
Re: Flash (correct) help
Hi, is there any way to grab a frame or save a .swf file using the active X control?
-
August 5th, 2001, 11:02 AM
#6
Re: Flash (correct) help
I believe the only way to write an swf file is to use a library like the one on this page.
http://openswf.org/
/*Gr, David Smulders*/
/* Regards, David Smulders */
-
November 22nd, 2001, 05:07 PM
#7
Re: Flash control problems
I can successfully play a Flash Movie using this code, but I can't control it. That is subsequent calls like:
pFlashBox->Stop();
pFlashBox->Rewind();
do nothing.
Do you have any ideas?
Thanks,
--Rudy
-
November 23rd, 2001, 12:37 PM
#8
Re: Flash control problems
Hi,
If you get the error C2065: 'pFlashBox' : undeclared identifier then there are some lines missing in your code I think.
And if you can use the classWizard you can do it like this m_FlashCtrl.Stop();
If this sample code doesn’t work for you, post some lines of you’re source code so I can look at it.
void CFlashDlg::OnButton1()
{
CShockwaveFlash* pFlashBox =
static_cast<CShockwaveFlash*>(GetDlgItem(IDC_FLASH));
pFlashBox->Stop();
// m_FlashCtrl.Stop(); // Put this Line in your *.h file
// ShockwaveFlash m_TestFlash;
}
/*Gr, David Smulders*/
/* Regards, David Smulders */
-
February 4th, 2002, 04:19 AM
#9
Re: Flash (correct) help
hi,I can't find "shockwaveflash.h" ,but I found an activex control named
CShockwaveCtrl,however,I use it for playing swf,after calling the function"play",Nothing had happend.why?
Thank
-
February 4th, 2002, 06:15 AM
#10
Re: Flash (correct) help (flash5ocx.zip)
Hi, I have put a sample at this link.
I’ll hope it helps.
http://www.dinaric.org/software/cpp/flash5ocx.zip
/*Gr, David Smulders*/
/* Regards, David Smulders */
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|