flashComponet help


#1

the animation is not visible
sound if it works.

code FlashComponent.h

#ifndef __JUCE_FLASHCOMPONENT__
#define __JUCE_FLASHCOMPONENT__
//[Headers]     -- You can add your own extra header files here --
#include "../JuceLibraryCode/JuceHeader.h"
//[/Headers]
namespace ShockwaveFlashObjects { struct IShockwaveFlash; }//{D27CDB6C-AE6D-11CF-96B8-444553540000}

class FlashComponent : public ActiveXControlComponent
{
public:
	FlashComponent();
	virtual ~FlashComponent();

	void parentHierarchyChanged();
	void visibilityChanged();
	void paint (Graphics& g);
	void mouseDown(const juce::MouseEvent &e);

	void createControlIfNeeded();
	bool isControlCreated();

	void  flashLoad(String filename);
	void flashPlay();
	void flashStop();
	void flashRewind();
	void flashGotoFrame(long frameNum);
	void flashSetLoop(bool shouldLoop);
	long flashPlayerVersion();
private:
	String moviePath;
	ShockwaveFlashObjects::IShockwaveFlash* flashInterface;
};
#endif

code FlashComponent.cpp

#if _WIN32

#ifdef _MSC_VER
  #pragma warning (disable: 4514)
#endif

#include <windows.h>
#import "PROGID:ShockwaveFlash.ShockwaveFlash" named_guids
#include "FlashComponent.h"
//==============================================================================
FlashComponent::FlashComponent()
{
	flashInterface = 0;
}

FlashComponent::~FlashComponent()
{
	flashInterface->Release();
    deleteControl();
}

//==============================================================================
void FlashComponent::createControlIfNeeded()
{
	bool _isCreated = isControlCreated();
	bool _isShowing = isShowing();
	if(_isShowing && !_isCreated)
	{
		const IID swfIID = __uuidof(ShockwaveFlashObjects::ShockwaveFlash);

		if (createControl( &swfIID )) 
		{
			const IID swf_intIID = __uuidof(ShockwaveFlashObjects::IShockwaveFlash);
            flashInterface = (ShockwaveFlashObjects::IShockwaveFlash*)queryInterface ( &swf_intIID );

			if(flashInterface)
			{

				IViewObjectEx*    view=0; 
				flashInterface->QueryInterface(__uuidof(IViewObjectEx),(void **)&view);
				}
		}
	}
}

bool FlashComponent::isControlCreated()
{
    return isControlOpen();
}


void FlashComponent::parentHierarchyChanged()
{
    createControlIfNeeded();
	ActiveXControlComponent::parentHierarchyChanged();
}

void FlashComponent::visibilityChanged()
{
    createControlIfNeeded();
	ActiveXControlComponent::visibilityChanged();
}

void FlashComponent::paint (Graphics& g)
{
    if (! isControlCreated())
		g.fillAll (Colours::blue);
}

void FlashComponent::flashLoad(String filename)
{
	moviePath = filename;
	flashInterface->Stop();
	if(isControlCreated())
	{
		const wchar_t *pth = (const wchar_t *)moviePath;
		flashInterface->PutMovie(pth);
               //flashInterface->PutMovie(L"C:\\Producto.swf");
               flashInterface->Play();		
	}
}

void FlashComponent::flashPlay()
{
	if(flashInterface)
		flashInterface->Play();
}

void FlashComponent::flashStop()
{
	if(flashInterface)
		flashInterface->Stop();
}

void FlashComponent::flashRewind()
{
	if(flashInterface)
		flashInterface->Rewind();
}

void FlashComponent::flashGotoFrame(long frameNum)
{
	flashInterface->raw_GotoFrame(frameNum);
}

void FlashComponent::flashSetLoop(bool shouldLoop)
{
	flashInterface->PutLoop(shouldLoop);
}

long FlashComponent::flashPlayerVersion(){
	return (flashInterface->FlashVersion() & 0x00FF0000) / 65536;
}
void FlashComponent::mouseDown(const juce::MouseEvent &e)
{
	//createControlIfNeeded();

}


#endif