Page 1 of 1
How to reload the same swf file and play again?
Posted: Mon May 24, 2010 3:48 am
by doubletw
Hi Sir,
I use FlashMethod_LoadMovie() to load a swf file, and then the swf file will send a FS-Command to f_in_box__form automatically.
After executing FlashMethod_LoadMovie() and getting the FS-Command, I can receive the FS-Command again if I execute FlashMethod_LoadMovie() to load another duplicate swf file.
However, after executing FlashMethod_LoadMovie() and getting the FS-Command, if I try to call FlashMethod_LoadMovie() to load the same swf file again, the FS-Command is not received by f_in_box__form.
How do I load the same swf file and let the same swf file restart again?
Thanks a lot!!
Posted: Mon May 24, 2010 3:42 pm
by Softanics
Thank you for your question.
Within a handler of the FSCommand, create a timer with a small period.
In the timer handler put .FlashMethod_LoadMovie() and clear the timer.
Thank you.
Posted: Tue May 25, 2010 5:31 am
by doubletw
Hi Sir,
I try to use code to explain my question.
public ref class Form1 : public f_in_box__lib::f_in_box__form
{
public:
Form1(void)
{
InitializeComponent();
this->timer1->Interval = 2000;
this->timer1->Tick += gcnew EventHandler(this, &Form1::TimerEventProcessor);
this->OnFSCommand += gcnew f_in_box__lib::f_in_box__form::OnFSCommandEventHandler(this, &Form1::MainForm_OnFSCommand);
this->FlashMethod_LoadMovie(0, "C:\\a.swf");
}
System::Void MainForm_OnFSCommand(System::Object^ sender, System::String^ command, System::String^ args)
{
if(command == "Init")
this->timer1->Enabled = true;
}
void TimerEventProcessor(Object^ myObject, EventArgs^ myEventArgs)
{
this->timer1->Enabled = false;
System::Windows::Forms::MessageBox::Show("a");
this->FlashMethod_LoadMovie(0, "C:\\a.swf");
}
}
MessageBox only shows one time.
It means that FlashMethod_LoadMovie doesn't work if using FlashMethod_LoadMovie to load a.swf again.
If I use FlashMethod_LoadMovie to load a.swf's duplicate, MessageBox can show two times.
It seems that FlashMethod_LoadMovie is only working when loading different flash file.
How do I load the same flash file again and let FlashMethod_LoadMovie work?
Thanks a lot!!
Posted: Tue May 25, 2010 7:01 am
by Softanics
Hello,
What if to change the code a little:
Code: Select all
void TimerEventProcessor(Object^ myObject, EventArgs^ myEventArgs)
{
this->timer1->Enabled = false;
System::Windows::Forms::MessageBox::Show("a");
this->FlashMethod_LoadMovie(0, "__none__");
this->FlashMethod_LoadMovie(0, "C:\\a.swf");
}
Please check it.
Thank you.
Posted: Tue May 25, 2010 8:23 am
by doubletw
It works.
Thank you very much!!