Question on the IFlashPlayer_LoadURL & IFlashPlayer_LoadURL | developer.brewmp.com Question on the IFlashPlayer_LoadURL & IFlashPlayer_LoadURL | developer.brewmp.com

Developer

Question on the IFlashPlayer_LoadURL & IFlashPlayer_LoadURL

I use the IFlashPlayer_LoadURL to load a flash in my app when the point is down, just like:

case EVT_POINTER_DOWN:

if ( pMe->bIsFlashShowing == FALSE)
{
(void)IFlashPlayer_LoadURL(pMe->piFlashPlayer, SWF_MOVIE_FILE);

}

return TRUE;

fscommand("ExitFlashCast" is used in last frame of the flash to indicate the flash is finishing.

when the flash finishes , I use IFlashPlayer_UnLoad to unload this flash :

if (IFlashPlayer_Event_Exit == (IFlashPlayer_Event_Exit & event))
{
pMe->bIsFlashShowing =FALSE;
IFlashPlayer_Unload(pMe->piFlashPlayer);

}

the code makes flash playback again when your mouse is pressed, however, the simulator crashes after you have about 20-30 point -down continuously.

Do you know why this happen?

Can you please provide us with some details about your .swf? How many frames, framerate, etc.
Also, what are you doing with the pointer up event? And do you only call IFlashPlayer_HandleEvent() if bIsFlashShowing == TRUE?
Thanks,
Mike

Can you please provide us with some details about your .swf? How many frames, framerate, etc.
Also, what are you doing with the pointer up event? And do you only call IFlashPlayer_HandleEvent() if bIsFlashShowing == TRUE?
Thanks,
Mike

The swf has 27 frames, with 24 fps, in which the last frame is labeled with "fscommand("ExitFlashCast");".
IFlashPlayer_HandleEvent is invoked in the app handle event method:
if (pMe->piFlashPlayer != NULL )
{
IFlashPlayer_HandleEvent(pMe->piFlashPlayer,eCode,wParam,dwParam,NULL);

Note: there is no difference between having
bIsFlashShowing == TRUE or not
I has done nothing in the app handle event method for the pointer up event.
Only the pointer down event is done to load the flash file.

The swf has 27 frames, with 24 fps, in which the last frame is labeled with "fscommand("ExitFlashCast");".
IFlashPlayer_HandleEvent is invoked in the app handle event method:
if (pMe->piFlashPlayer != NULL )
{
IFlashPlayer_HandleEvent(pMe->piFlashPlayer,eCode,wParam,dwParam,NULL);

Note: there is no difference between having
bIsFlashShowing == TRUE or not
I has done nothing in the app handle event method for the pointer up event.
Only the pointer down event is done to load the flash file.

OK, we will try to duplicate this. In the mean time, can you please provide some more information about your use case? Is there a particular reason you don't just restart the player on each key down event (as opposed to reloading the .swf)?
Also, what version of the SDK are you using?
Thanks,
Mike

OK, we will try to duplicate this. In the mean time, can you please provide some more information about your use case? Is there a particular reason you don't just restart the player on each key down event (as opposed to reloading the .swf)?
Also, what version of the SDK are you using?
Thanks,
Mike

Hi, Mike.
Indeed, I had tried restart the player,but failed,that's why I'd like to reload the flash.
I restart the player like this:
////////////////////////////////////////////
case EVT_POINTER_DOWN:
if ( pMe->bIsFlashShowing == FALSE && pMe->bIsFlashLoaded == FALSE)
{
//Load the flash
(void)IFlashPlayer_LoadURL(pMe->piFlashPlayer, SWF_MOVIE_FILE);
}
if (pMe->bIsFlashShowing == FALSE && pMe->bIsFlashLoaded == TRUE)
{
//Replay the flash when the swf has been loaded
(void)IFlashPlayer_Play(pMe->piFlashPlayer);
}
return TRUE;
////////////////////////////////////////////
if (IFlashPlayer_Event_LoadComplete == (IFlashPlayer_Event_LoadComplete & event))
{
pMe->bIsFlashLoaded = TRUE;
pMe->bIsFlashShowing =TRUE;
(void)IFlashPlayer_Play(pMe->piFlashPlayer);
}
if (IFlashPlayer_Event_Exit == (IFlashPlayer_Event_Exit & event))
{
pMe->bIsFlashShowing =FALSE;
}
The code can make the flash playback only once, it won't show for the second pointer down event.

Hi, Mike.
Indeed, I had tried restart the player,but failed,that's why I'd like to reload the flash.
I restart the player like this:
////////////////////////////////////////////
case EVT_POINTER_DOWN:
if ( pMe->bIsFlashShowing == FALSE && pMe->bIsFlashLoaded == FALSE)
{
//Load the flash
(void)IFlashPlayer_LoadURL(pMe->piFlashPlayer, SWF_MOVIE_FILE);
}
if (pMe->bIsFlashShowing == FALSE && pMe->bIsFlashLoaded == TRUE)
{
//Replay the flash when the swf has been loaded
(void)IFlashPlayer_Play(pMe->piFlashPlayer);
}
return TRUE;
////////////////////////////////////////////
if (IFlashPlayer_Event_LoadComplete == (IFlashPlayer_Event_LoadComplete & event))
{
pMe->bIsFlashLoaded = TRUE;
pMe->bIsFlashShowing =TRUE;
(void)IFlashPlayer_Play(pMe->piFlashPlayer);
}
if (IFlashPlayer_Event_Exit == (IFlashPlayer_Event_Exit & event))
{
pMe->bIsFlashShowing =FALSE;
}
The code can make the flash playback only once, it won't show for the second pointer down event.

I has noticed that fscommand("ExitFlashCast") is used in the last frame of the flash.
It seems that the "ExitFlashCase" couldn't be used if you want to repaly the flash again.
so my question is: is there some other action script statement (expect "ExitFlashCase" ) to let the app know the last frame is finished.
or should I use the action script extension to send this information to app indirectly?

I has noticed that fscommand("ExitFlashCast") is used in the last frame of the flash.
It seems that the "ExitFlashCase" couldn't be used if you want to repaly the flash again.
so my question is: is there some other action script statement (expect "ExitFlashCase" ) to let the app know the last frame is finished.
or should I use the action script extension to send this information to app indirectly?

The "ExitFlashCast" event would internally shut down the player, so doing another IFlashPlayer_Play() would probably not work.
Taking a step back, what is the overall goal of your app? It sounds like you want to play a .swf on every mouse click. If this is the case, how about just loading the .swf and letting the .swf handle the mouse click - when it receives the down event, it does a GotoAndPlay(1) to start playing from the beginning. Your C code would need to make sure to deliver the event to the .swf only when needed.
Would something like this work?
Mike

The "ExitFlashCast" event would internally shut down the player, so doing another IFlashPlayer_Play() would probably not work.
Taking a step back, what is the overall goal of your app? It sounds like you want to play a .swf on every mouse click. If this is the case, how about just loading the .swf and letting the .swf handle the mouse click - when it receives the down event, it does a GotoAndPlay(1) to start playing from the beginning. Your C code would need to make sure to deliver the event to the .swf only when needed.
Would something like this work?
Mike

thanks for your solution, I will try it.

thanks for your solution, I will try it.