convert swf to exe, make flash application, flash to exe, make flash screensaver, swf to exe, swf to mp3
 
Products: SWFKit Pro, SWFKit, SWFKit Express | SWFKit Online | SWFSnd | SWFImg | SWFGen | 123FlashChat | MingX
  Home > Products > SWF Kit Series > The advantage of FFish scripting language > Section II
Overview Features Comparison Samples Download Buy Now Tutorials Documentation
 
The Advantage of FFish Scripting Language
II. Enjoy the FFish Script programming

// Action script code
// The "prompt" command displays a message box with the "ok" and "cancel" button
// If the "ok" button is pressed, the command sets the Action Script variable "ret" to true
// Otherwise, the variable "ret" will be set to false

fscommand("prompt", "Please choose, Ok or Cancel, ret");

if (ret)
{

do thing 1

}
else
{

do thing 2

}

[ffish script implementation]

// FFish Script code

var ret = Dialogs.msgBox("Please choose", "Ok or Cancel", 1);
if (ret == 1)
{

do thing 1

}
else
{

do thing 2

}

Unfortunately, the fscommand implement won't work every time. Action Script doesn't call fscommands synchronously. That is to say, when it reaches

if (ret)
{

do thing 1

}
else
{

do thing 2

},

the fscommand may not have been handled yet. You have to poll the value the variable "ret" in Action script, don't call the following code until the fscommand returns. Or you can add the "do things" code in a callback function that will be called when the fscommand returns. THAT IS TO SAY, IN THIS CASE, FSCOMMANDS CANNOT WORK IN A FLUENT WAY. YOU MUST ADD SOME MEANS TO CHECK IF THE FSCOMMANDS HAVE BEEN FINISHED SUCCESSFULLY.

// Action script code
// The "prompt" command displays a message box with the "ok" and "cancel" button
// If the "ok" button is pressed, the command sets the Action Script variable "ret" to true
// Otherwise, the variable "ret" will be set to false

// Frame 1
var ret = "undefined";
fscommand("prompt", "Please choose, Ok or Cancel, ret");

// Frame 2
// Blank

// Frame 3
if (ret == "undefined") gotoAndPlay(2);

// Frame 4
if (ret)
{

do thing 1

}
else
{

do thing 2

}

FFish Script is an integrated programming language so you don't need to make your code run in such a tortuous way. The above example is so simple, can you imagine the trouble in a big program needs complex database accessing?
Next Section

 

Link to us

Contact us

Feel free to link to us!
We appreciate it!

support@swfkit.com
sales@swfkit.com
info@swfkit.com

Bookmark our site Tell a friend, Win a CD Flash Chat in China