Friday, April 2, 2010

Crash on deleting FlashActiveX...

In my VC application, there is a FlashActiveX player area inside which i am loadng a swf.This swf file contains a FLVPlayback component to load flv files.


This is the code i have used for loading the FLVLoader.swf inside the flash activeX window.


CShockwaveFlash *m_pFlashPlayer;

m_pFlashPlayer = new CShockwaveFlash();
m_pFlashPlayer-%26gt;Create(
_T( ''ABS'' ),
WS_CHILD,
CRect( 200, 0, 320, 240 ),
this,
4001 );
CString strSWF;
strSWF = ''D:\\FLVLoader.swf'';
m_pFlashPlayer-%26gt;LoadMovie( 0, strSWF );


Below given is code i have used for deleting Flash activex window.


if(m_pFlashPlayer != NULL)
{
CString strTemp = _T('''');
?strTemp.Format( ''%26lt;invoke name= \''UNINITIALIZE\'' returntype=\''xml\''%26gt;%26lt;/invoke%26gt;'' );
?m_pFlashPlayer-%26gt;CallFunction( strTemp );//This will call a function UNINITIALIZE in my .as (i have used ExternalInterface to achieve this)

?delete m_pFlashPlayer;
?m_pFlashPlayer = NULL;
}

Below given is AS3.0 code i have used for loading flv in FLVPLayback


public?var m_flvPlayer:FLVPlayback;

m_flvPlayer=new FLVPlayback();

addChild(m_flvPlayer);

m_flvPlayer.autoPlay = true;

m_flvPlayer.source = ''d:\\Filename.flv'';


//code attached to UNINITIALIZE function



m_flvPlayer.stop();
m_flvPlayer.autoRewind = true;?
removeChild(m_flvPlayer);
m_flvPlayer=null;





Everything works fine until latest Flash10 activeX is installed on machine.But now when delete m_pFlashPlayer;
is executed this cause a crash in FLASH10B.OCX.


Below given is assertion Failure getting from VC application


---------------------------
Microsoft Visual C++ Debug Library
---------------------------
Debug Error!

Program: ...are\MFC\SampleD.exe
Module:
File: i386\chkesp.c
Line: 42

The value of ESP was not properly saved across a function call.?This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.


Also 'codejoke' for supporting office 2000 style?is installed in my machine .


If i mask the line

m_flvPlayer.source = ''d:\\Filename.flv'';


the crash will not occur.

No comments:

Post a Comment