Osp::Ui::Controls::Flash Class Reference

This class defines common behavior for a Flash control. More...

Inheritance diagram for Osp::Ui::Controls::Flash:

Osp::Ui::Control Osp::Base::Object

List of all members.

Public Member Functions

void AddFlashEventListener (const Osp::Ui::IFlashEventListener &listener)
result Construct (const Osp::Graphics::Rectangle &rect, FlashStyle style, const Osp::Base::String &localFilePath, const Osp::Base::String &urlFilePath=L"")
result EnterText (const Osp::Base::String &text)
 Flash (void)
virtual Osp::Graphics::Color GetBackgroundColor (void) const
FlashQuality GetQuality (void) const
FlashRepeatMode GetRepeatMode (void) const
FlashStatus GetStatus (void) const
int GetVolume (void) const
bool IsSoundEnabled (void) const
void Pause (void)
void Play (void)
void RemoveFlashEventListener (const Osp::Ui::IFlashEventListener &listener)
void Resume (void)
void SendDataEventToActionScript (const Osp::Base::String &actionScriptListener, const Osp::Base::Collection::IList &dataValueList)
void SendDataToActionScript (const Osp::Base::String &data)
virtual void SetBackgroundColor (const Osp::Graphics::Color &color)
void SetQuality (FlashQuality quality)
void SetRepeatMode (FlashRepeatMode repeatMode)
void SetSoundEnabled (bool enable)
result SetVolume (int volume)
void Stop (void)
virtual ~Flash (void)


Detailed Description

The Flash class can be used to play a Flash Lite contents embedded in the application. The application can interact with the Flash movie via FSCommand2.

Flash class supports

Example:

This is a simple UI application which uses a Flash control for movie playback.

// Sample Code for FlashSample.h
#include <FUi.h>
#include <FBase.h>
#include <FGraphics.h>

class FlashSample :
    public Osp::Ui::Controls::Form,
    public Osp::Ui::IFlashEventListener
{
public:
    FlashSample(void)
    :__pFlash(null){}

    virtual result OnInitializing(void);
    void ConstructFlash(Osp::Base::String& fileName, Osp::Base::String& fileUrl);

public:
    virtual void OnFlashDataReceived(const Osp::Ui::Control& source, const Osp::Base::Collection::IList& paramList);
    virtual void OnFlashDataReturned(const Osp::Ui::Control& source, const Osp::Base::Collection::IList& paramList);
    virtual void OnFlashTextEntered(const Osp::Ui::Control& source, Osp::Ui::FlashTextInputMode inputMode, const Osp::Base::String& defaultText, int limitTextLength);
    virtual void OnFlashLayoutChanged(const Osp::Ui::Control& source, Osp::Ui::FlashLayoutStyle layoutStyle);

private:
    Osp::Ui::Controls::Flash *__pFlash;
};

// Sample Code for FlashSample.cpp
#include "FlashSample.h"

using namespace Osp::Base;
using namespace Osp::Graphics;
using namespace Osp::Ui;
using namespace Osp::Ui::Controls;

result
FlashSample::OnInitializing(void)
{
    result r = E_SUCCESS;

    String fileName(L"/Res/{Flash Contents File}");
    // For Remote Streaming
    //String fileUrl(L"http://{Server URL}/{Flash Contents File}");

    // Create a Flash Control
    __pFlash = new Flash();

    return r;
}

void
FlashSample::ConstructFlash(String& fileName, String& fileUrl)
{
    Rectangle bounds = GetBounds();

    if (!fileUrl.GetLength())
        // Local Flash Contents
        __pFlash->Construct(bounds, FLASH_STYLE_PLAY_WITHOUT_FOCUS, fileName);
    else
        // The .SWF file, which embeds .FLV for streaming needs to be placed on the local path as well as the URL.
        __pFlash->Construct(bounds, FLASH_STYLE_PLAY_WITHOUT_FOCUS, fileName, fileUrl);

    __pFlash->AddFlashEventListener(*this);

    // Add a Flash to the Form
    AddControl(*__pFlash);

    // Display the Form
    Draw();
    Show();

    // Play a Flash
    __pFlash->Play();
}

// Implement an IFlashEventListener
void
FlashSample::OnFlashDataReceived(const Osp::Ui::Control& source, const Osp::Base::Collection::IList& paramList)
{
    // Todo:
}
void
FlashSample::OnFlashDataReturned(const Osp::Ui::Control& source, const Osp::Base::Collection::IList& paramList)
{
    // Todo:
}

void
FlashSample::OnFlashTextEntered(const Osp::Ui::Control& source, Osp::Ui::FlashTextInputMode inputMode, const Osp::Base::String& defaultText, int limitTextLength)
{
    // Todo:
}

void
FlashSample::OnFlashLayoutChanged(const Osp::Ui::Control& source, Osp::Ui::FlashLayoutStyle layoutStyle)
{
    // Todo:
}

Constructor & Destructor Documentation

Osp::Ui::Controls::Flash::Flash ( void   ) 

This is the default constructor for this class.

virtual Osp::Ui::Controls::Flash::~Flash ( void   )  [virtual]

This is the destructor for this class.


Member Function Documentation

void Osp::Ui::Controls::Flash::AddFlashEventListener ( const Osp::Ui::IFlashEventListener listener  ) 

Adds a listener instance.
The added listener can listen to events on the given event dispatcher's context when they are fired.

Parameters:
[in] listener The listener to add

result Osp::Ui::Controls::Flash::Construct ( const Osp::Graphics::Rectangle rect,
FlashStyle  style,
const Osp::Base::String localFilePath,
const Osp::Base::String urlFilePath = L"" 
)

Initializes an instance of Flash with the specified rectangular region, style, and file paths.

Returns:
An error code
Parameters:
[in] rect The (X,Y) coordinates of the top left of the created window
The width and height of the window
[in] style The style of the flash object
[in] localFilePath The local file path into this flash object
[in] urlFilePath The url file path for remote streaming
Exceptions:
E_SUCCESS The method was successful.
E_OUT_OF_MEMORY Insufficient memory.
E_INVALID_STATE This instance has already been constructed.
E_INVALID_ARG A specified input parameter is invalid.
E_NETWORK_FAILED The network is unavailable.
E_SYSTEM A system error occurred.
Remarks:
A control is fully usable only after it has been added to a container, therefore some methods may fail if used earlier.

result Osp::Ui::Controls::Flash::EnterText ( const Osp::Base::String text  ) 

Enters the text into an input text field.

Parameters:
[in] text The text block to enter
Exceptions:
E_SUCCESS The method was successful.
E_SYSTEM A system error occurred.

virtual Osp::Graphics::Color Osp::Ui::Controls::Flash::GetBackgroundColor ( void   )  const [virtual]

Gets the background color of the current instance of Flash.

Returns:
The background color

FlashQuality Osp::Ui::Controls::Flash::GetQuality ( void   )  const

Gets the quality of a flash animation.

Returns:
The quality of the flash animation

FlashRepeatMode Osp::Ui::Controls::Flash::GetRepeatMode ( void   )  const

Gets the repeat mode of a flash animation.

Returns:
The repeat mode of the flash animation

FlashStatus Osp::Ui::Controls::Flash::GetStatus ( void   )  const

Gets the playing status of a flash animation.

Returns:
The playing status of the flash animation

int Osp::Ui::Controls::Flash::GetVolume ( void   )  const

Gets the volume of the current instance of Flash.

Returns:
An Integer value representing the current volume level. Range of this return value is 0 to 99.

bool Osp::Ui::Controls::Flash::IsSoundEnabled ( void   )  const

Checks whether sound is enabled or not.

Returns:
true, if sound is enabled
false, otherwise

void Osp::Ui::Controls::Flash::Pause ( void   ) 

Pauses a flash animation.

void Osp::Ui::Controls::Flash::Play ( void   ) 

Plays a Flash animation. Only one Flash file can be played at a time.

void Osp::Ui::Controls::Flash::RemoveFlashEventListener ( const Osp::Ui::IFlashEventListener listener  ) 

Removes a listener instance.
The removed listener cannot listen to events when they are fired.

Parameters:
[in] listener The listener to remove

void Osp::Ui::Controls::Flash::Resume ( void   ) 

Resumes a flash animation.

void Osp::Ui::Controls::Flash::SendDataEventToActionScript ( const Osp::Base::String actionScriptListener,
const Osp::Base::Collection::IList dataValueList 
)

Sends data to the action script when the action script receives the specified event from application.

Parameters:
[in] actionScriptListener The name of the specified event
[in] dataValueList A list of data

void Osp::Ui::Controls::Flash::SendDataToActionScript ( const Osp::Base::String data  ) 

Sends data to the action script in a flash animation.

Parameters:
[in] data The data to be sent to the action script

virtual void Osp::Ui::Controls::Flash::SetBackgroundColor ( const Osp::Graphics::Color color  )  [virtual]

Sets the background color of the Flash.

Parameters:
[in] color The normal background color

void Osp::Ui::Controls::Flash::SetQuality ( FlashQuality  quality  ) 

Sets the quality of a flash animation.

Parameters:
[in] quality The quality of the flash animation

void Osp::Ui::Controls::Flash::SetRepeatMode ( FlashRepeatMode  repeatMode  ) 

Sets the repeat mode of a flash animation.

Parameters:
[in] repeatMode The repeat mode of the flash animation

void Osp::Ui::Controls::Flash::SetSoundEnabled ( bool  enable  ) 

Sets whether to enable sound or not.

Parameters:
[in] enable A bool value to decide whether to enable sound or not

result Osp::Ui::Controls::Flash::SetVolume ( int  volume  ) 

Sets the volume of the current instance of Flash. Range of volume is 0 to 99.

Parameters:
[in] volume The new value of volume.
Exceptions:
E_SUCCESS The method was successful.
E_OUT_OF_RANGE The specified volume is out of range.
E_INVALID_STATE This method is invalid for the current state of this instance.

void Osp::Ui::Controls::Flash::Stop ( void   ) 

Stops a flash animation.


The documentation for this class was generated from the following file:

Copyright© 2010 Samsung Electronics Co., Ltd. All rights reserved.