Class Definitions
The software entities defined by the FancyPants JavaScript API are categorized and presented in the following subsections.
Terminology used in document:
Construction method, or constructor, refers to any method from the Fp class that returns an object of any type. For example, fp.animator(), fp.timer(), fp.image(), fp.text(). The Fp methods “animator”, “timer”, “image”, “text” are constructors of the corresponding type of objects.
Object's construction parameter refers to the input parameter of a constructor that returns only the type of FpObject (or its subtype). For example, in the call to
fp.image({size:{w:300}, file:”img.png”})
, the{size:{w:300}, file:”img.png”}
is the object's construction parameter.Field refers to a field within a JavaScript table, or structure. In the example from (2) above, “size” and “name” are fields in object's construction parameter, while “w” is a field within the “size” table.
Property refers to the predefined property of an object, they are listed in each of the class definition subsections. Property can be retrieved via
get()
method, or by treating them as class variables and retrieve them asobj.xxx
, they can only be modified via theset()
method however, and updating a property throughobj.xxx
syntax is invalid. Not all properties are readable and writable, some are read-only, while some are write-only, please refer to the relevant section for detail.
Unless the document explicitly specifies:
Most of the fields in object's construction parameters or in the table passed to a function are optional. The class documentation will specify if a field is mandatory.
The default value of the fields in object's construction parameters is 0 (or false, null, depending on the data type). For example, in the call to
fp.image({coord:{y:300}})
, notice we have left out the “x” field for the “coord” table, this will result inx = 0
, and image will be placed at(0, 300)
.The default value of the fields when modifying a property is the object's current value of that particular property. For example, assuming we have an “img” variable which is a FpImage object, in the call to
img.set(“coord”, {x:100})
, we will only be changing the value of “x” to 100, while keeping the “y” untouched.
Fp Class
Extends: none
An instance of this class must be obtained to perform any UI operations using the FancyPants library.
Constructor
The constructor of the Fp class takes no argument.
If running in the browser environment the use:
<object name="fancypants" type="application/fancypants-plugin" width="720" height="360">
</object>
<script>
fp = document.fancypants;
</script>
If running in the standalone environment use the global API fp_init()
to acquire an instance of FancyPants class as follows:
fp = fp_init();
Class Variables
The following class variables are read-only and can be retrieved by fp.w
or fp.h
.
Variable Name | Type | Description |
---|---|---|
h | integer | Height of FancyPants canvas, this is determined by the FP_EMULATE environment variable |
w | integer | Width of FancyPants canvas, this is determined by the FP_EMULATE environment variable |
Properties
None
Events
None
General Methods
Method Name: begin
- Description: Begins the FancyPants main loop
- Environment: For the standalone envitronment only
Method Name: get
- Description: Gets the property value
- Return Type: Property specific type
- Input Parameters:
propertyName: string
- Examples:
Get the on-screen size of an object
var size = obj.get("size");
Method Name: set
- Description: Sets the value of a property
- Input Parameters:
The propertyValue is specific to the property.propertyName: string, propertyValue: value
- Examples:
// Se the object size to be 100x200 obj.set("size", { w: 100, h: 200 });
// Get the x and y coordinates of an object and change them var coord = obj.get("coord"); var x = coord.x; var y = coord.y; // Move the object 10% to the right x *= 1.1; obj.set( "coord", { x: x } });
Method Name: set
- Description: Sets multiple properties. “propertyName” is the name of the property listed in the Properties section, “propertyValue” is the value to be set. The type of the “propertyValue” is dependent on the associated properties, please refer to Properties section for details
- Input Parameters:
The propertyValue is specific to the property.{ propertyName: string, propertyValue: value, propertyName: string, propertyValue: value, ... }
Method Name: toString
- Description: Returns the string “Fp” indicating that the object is a type of Fp class
- Return Type: string
Method Name: quit
- Description: Exit the FancyPants main loop (returns from begin).
- Environment: This method is only available in the standalone environment.
Periodic events
Method Name | Input Parameters | Return Type | Description |
---|---|---|---|
animator | callback: function | FpAnimator | |
idler | callback: function | FpIdler | |
job | callback: function | FpJob | |
timer | interval: double, callback : function |
FpTimer |
Object construction
The <object parameters>
notation below represents a list of generic object parameters. These are the parameters that are passed into the object()
method, and the very same parameters can be specified during the construction of almost all FancyPants objects as most objects inherit from FpObject.
Method Name: container
- Description: Creates a container object
- Return Type: FpContainer
- Input Parameters:
{ <object parameters> }
Method Name: image
- Description: Creates an image object
- Return Type: FpImage
- Input Parameters:
{ <object parameters> file: string, url: string, theme_image: string, border: { left: integer, top: integer, right: integer, bottom: integer }, tile: { x: integer, y: integer, w: integer, h: integer }, }
Method Name: layout
- Description: Creates a layout object. For a list of orientations please refer to the Constants section.
- Return Type: FpLayout
- Input Parameters:
{ <object parameters> orientation: string }
Method Name: media
- Description: Creates a media object. For a list of states please refer to the Constants section.
- Return Type: FpMedia
- Input Parameters:
{ <object parameters> demuxer: string decoder: string file: string url: string videoLayer: integer keepAspect: bool loop: bool mute: bool speed: double state: string volume: integer tile: { x: integer y: integer w: integer h: integer } }
Method Name: object
- Description: Creates an object based on a list of properties.
- For a list of object types please refer to the Constants section.
- The type is only valid (and mandatory) when caller creates an object via
fp.object()
method call, the type will be ignored for all other calls such asfp.image()
,fp.text()
. - The default visible is true.
- As the default size is 0 for all objects, it is reminded to have the size specified either during object constrution or later through the
set()
method. - The default color of any object in FancyPants is white (ie. r=g=b=a=255), however the color can be changed using the
color
property. - When specifying the color property during constructor call, if not all of the r,g,b channels are specified, the missing channel will be set to 0, the alpha will default to 255 if not specified. This allows caller to pass in
{r:255}
for red, for example. - The “premul” boolean indicates whether if the r,g,b,a values have been premultiplied. When color values are premultipled, the values of r,g,b must be less than or equals to alpha. “premul” is false by default, allowing developer to pass r,g,b,a within the range of 0~255 without worry about premultiplication.
- Return Type: FpObject
- Input Parameters:
{ type: string layer: short coord: { x: integer y: integer } size: { w: integer h: integer } visible: bool color: { r: integer g: integer b: integer a: integer premul: bool } clip: FpRectangle name: string focus: bool skipEvent: bool repeatEvent: bool }
Method Name: rectangle
- Description: Creates a rectangle object
- Return Type: FpRectangle
- Input Parameters:
{ <object parameters> }
Method Name: text
- Description: Creates a text object. For a list of text styles and effects please refer to the Constants section.
- Return Type: FpText
- Input Parameters:
{ <object parameters> text: string style: string textEffect: string glowColor: { r: integer g: integer b: integer a: integer premul: bool } glow2Color: { r: integer g: integer b: integer a: integer premul: bool } shadowColor: { r: integer g: integer b: integer a: integer premul: bool } outlineColor: { r: integer g: integer b: integer a: integer premul: bool } }
Widget Construction
Method Name: button
- Description: Creates a button object
- bgThemeImageKey is the theme key of the button background image (refer to image:imageThemeByKey)
- For a list of text styles please refer to the Constants section.
- Sensitive activates or deactivates the button
- Return Type: FpButton
- Input Parameters:
{ <object parameters> text: string bgThemeImageKey:string textStyle: string sensitive: bool }
Method Name: calendar
- Description: Creates a calendar object. The “timestamp” parameter is the standard UNIX timestamp and is optional. The year/month/day parameters supersede the seconds if present.
- Return Type: FpCalendar
- Input Parameters:
{ <object parameters> date: { year: integer month: integer day: integer timestamp: integer } }
Method Name: checkbox
- Description: Creates a checkbox. Please refer to the Constants section for a list of text styles.
- Return Type: FpCheckbox
- Input Parameters:
{ <object parameters> checked: bool style: string text: string }
Method Name: cube
- Description: Creates a cube object.
- angle direction: “snap”, “left”, “right”
- tilt direction (from positive x-axis): “snap”, “up”, “down”
- Both “deg” and “direction” parameters are mandatory if the corresponding “angle” or “tilt” is present.
- “rotationDuration” is the time (in seconds) the animation to the target rotation degree will take. Must be strictly positive.
- Only the first 6 valid FpObject in “faces” parameter will be accepted, once all 6 faces are added, subsequent FpObject will be ignored.
- The order to which face the object will be added to is as follows: Front, Right, Back, Left, Top, Bottom.
- Please refer to the Constants section for a list of orientations.
- Return Type: FpCube
- Input Parameters:
{ <object parameters> angle: { deg: double direction: string } tilt: { deg: double direction: string } faces: FpObject[6] depth: integer rotationDuration: double orientation: string perspective: { coord: { x: integer y: integer z: integer } } }
Method Name: filebrowser
- Description: Creates a file browser widget.
- IMPORTANT: Function returns “null” if the path cannot be found.
- “filter” is a comma separated string indicating the type(s) of files that can be displayed in file browser.
- “traversal” indicates whether if user can traverse to different folders.
- Please refer to Constants section for a list of filters and traversal modes.
- Return Type: FpFilebrowser
- Input Parameters:
{ <object parameters> filter: string path: string traversal: string }
Method Name: flip
- Description: Creates a flip widget.
- Both “front” and “back” are mandatory parameters. In the case when application needs to flip a single object, one may pass in the same object for both “front” and “back”.
- “showboth” is a parameter indicating whether if both objects should be rendered at the same time. This parameter is set to “false” by default, and setting it to “true” is useful in the case when one of the object is semi-transparent, allowing user to see through to the back object.
- Return Type: FpFlip
- Input Parameters:
{ <object parameters> front: FpObject back: FpObject angle: { deg: double direction: string } depth: integer showboth: bool }
Method Name: keyboard
- Description: Creates a keyboard widget. Please note that the keyboard widget requires a text entry to be focused in order to have effect.
- Return Type: FpKeyboard
- Input Parameters:
{ <object parameters> }
Method Name: multiselect
- Description: Create a multiselect widget
- Return Type: FpMultiselect
- Input Parameters:
{ <object parameters> opened: bool alignment: string items: string[] selItem: string maxHeight: integer }
Method Name: progressbar
- Description: Create a progressbar widget For a list of orientations please refer to the Constants section.
- Return Type: FpProgressbar
- Input Parameters:
{ <object parameters> orientation: string max: double value: double }
Method Name: scrollbar
- Description: Creates a scrollbar widget. Please refer to Constants section for a list of appear modes for horizontal and vertical scrollbars.
- Return Type: FpScrollbar
- Input Parameters:
{ <object parameters> target: FpObject hAppear: string vAppear: string scrollPos: { x: integer y: integer } kinetic: bool fading: bool }
Method Name: scrolllist
- Description: Creates a scroll list. Please refer to Constants section for a list of orientation, appear modes for horizontal and vertical scrollbars, and scroll modes.
- Return Type: FpScrolllist
- Input Parameters:
{ <object parameters> objs: FpObject[] hAppear: string vAppear: string kinetic: bool orientation: string offset: integer padding: integer scroll: string }
Method Name: slider
- Description: Creates a slider.
- Return Type: FpSlider
- Input Parameters:
{ <object parameters> orientation:string max: double value: double }
Method Name: textarea
- Description: Creates a text area.
- For a list of alignments, see constant section.
- For a list of textStyles, see constant section.
- Return Type: FpTextarea
- Input Parameters:
{ <object parameters> editable: bool alignment: string text: string textStyle: string lineSpacing: integer }
Method Name: textentry
- Description: Creates a text entry.
- Return Type: FpTextentry
- Input Parameters:
{ <object parameters> text: string selStart: integer selEnd: integer maxLength: integer cursorPos: integer editable: bool password: bool cursorBlink: bool }
Theme
Method Name: changeTheme
- Description: Change to the theme passed, if available in the theme path
- Input Parameters:
name: string
FpAnimator Class
Extends: none
Constructor
FpAnimator is constructed through the animator() method from Fp as shown in sample code below:
var fp = fp_init();
animator = fp.animator(function() {
return false;
});
Setting animator = null
would stop animator after garbage collection, which will stop the callback from being called. One may use animator.stop()
or return false
in callback to stop an FpAnimator before garbage collection.
Properties
None
Events
None
Methods
Method Name | Input Parameters | Return Type | Description |
---|---|---|---|
restart | |||
stop | |||
toString | string | Returns the string “FpAnimator” |
FpIdler Class
Extends: none
Constructor
FpIdler is constructed through the idler() method from Fp as shown in sample code below:
var fp = fp_init();
idler = fp.idler(function() {
return false;
});
Setting idler = null
would stop FpIdler after garbage collection, which will stop the callback from being called. One may use idler.stop() or return false in callback to stop an FpIdler before garbage collection.
Properties
None
Events
None
Methods
Method Name | Input Parameters | Return Type | Description |
---|---|---|---|
stop | |||
toString | string | Returns the string “FpIdler” |
FpJob Class
Extends: none
Constructor
FpJob is constructed through the job() method from Fp as shown in sample code below:
var fp = fp_init();
job = fp.job(function() {
return false;
});
Setting job = null
would stop FpJob after garbage collection, which will stop the callback from being called. One may use job.stop() or return false in callback to stop an FpJob before garbage collection.
Properties
None
Events
None
Methods
Method Name | Input Parameters | Return Type | Description |
---|---|---|---|
stop | |||
toString | string | Returns the string “FpJob” |
FpTimer Class
Extends: none
Constructor
FpTimer is constructed through the timer() method from Fp as shown in sample code below:
var fp = fp_init();
timer = fp.timer(1.0, function() {
return false;
});
Setting timer = null
would stop FpTimer after garbage collection, which will stop the callback from being called. One may use timer.stop()
or return false
in callback to stop an FpTimer before garbage collection.
Properties
Property Name | Type Type | Description |
---|---|---|
interval | double | Changes in timer interval will take effect immediately, ie. next timer callback will be triggered at the “interval” second after calling FpTimer.set() . |
Events
None
Methods
Method Name: get
- Description: Get the property value
- Return Type: Property specific type
- Input Parameters:
propName: string
Method Name: restart
- Description: Restart the timer
Method Name: stop
- Description: Stop the timer
Method Name: set
- Description: Set the value of the property
- Input Parameters:
propName: string, propValue: property type
Method Name: set
- Description: Set the value of the property. This method allows multiple properties to be set through a single call. “propName” is the name of the property listed in the Properties section above, while the “propValue” is the value to be set. The type of the “propValue” is dependent on the associated properties, please refer to Properties section for details.. stop
- Return Type:
- Input Parameters:
{ propName: propValue, propName: propValue, ... }
Method Name: toString
- Description: Returns the string “FpTimer { interval: X sec” where X is replaced by the value of interval property.
- Return Type: string
FpObject Class
Extends: none
This is the base class of all FancyPants objects except for Fp, FpAnimator, FpIdler, FpJob, and FpTimer. Every properties, events, methods defined in this class are applicable for all objects constructed from Fp class except for the ones mentioned above.
Constructor
FpObject instances are constructed through object/widget construction methods from Fp.
Properties
The properties can be retrieved and modified using the get()
and set()
methods. Properties can also be retrieved by treating them as class variables and accessible through obj.xxx
syntax.
Property Name: clip
- Type: FpRectangle
Property Name: color
- Type:
{ r: integer g: integer b: integer a: integer premul: bool }
- Description:
- Please note that if not all of the r,g,b channels are specified, instead of replacing the missing channels with 0, the current object's color will be used instead. For example, if the object's current color is
{r: 255, g:0, b:0, a:255}
, by specifyingobj.set(“color”, {g:255})
, we're essentially modifying the green channel to a value of 255, resuling with{r:255, g:255, b:0, a:255}
. - “premul” boolean indicates whether if the r,g,b,a values have been premultiplied. When color values are premultipled, the values of r,g,b must be less than or equals to alpha. “premul” is false by default, allowing developer to pass r,g,b,a within the range of 0~255 without worry about premultiplication.
- As FancyPants uses premultiplied color internally for its performance benefit, the retrieved color through
FpObject.get(“color”)
will always have its premul set to true. - The impact of this is that the r,g,b information could be lost when alpha is reduced, so when alpha channel is restored, the values of r,g,b will not come back to its original values.
- Please note that if not all of the r,g,b channels are specified, instead of replacing the missing channels with 0, the current object's color will be used instead. For example, if the object's current color is
Property Name: coord
- Type:
{ x: integer y: integer }
Property Name: focus
- Type: bool
Property Name: layer
- Type: short
Property Name: name
- Type: string
Property Name: repeatEvent
- Type: bool
Property Name: perspective
- Type:
{ coord: { x: integer y: integer z: integer } }
Property Name: rotation
- Type:
{ angle: double center: { x: integer y: integer } relative: bool }
- Description:
- Write-only property.
- Unit of angle is in degrees.
- “relative” can be used to indicate whether the rotation is to be applied relative to the last angle of rotation. For example, if an object has rotated 45 degrees, and rotation property is applied again with an angle of 5 degrees and “relative” set to true, the result will be that the object is further rotated by 5 degrees, resulting in 50 degrees rotation in total.
- Setting “relative” to false would make the rotation to begin from original position.
Property Name: rotation3d
- Type:
{ angles: { x: double y: double z: double } center: { x: integer y: integer z: integer } relative: bool }
- Description:
- Write-only property.
- Unit of angle is in degrees.
- “relative” can be used to indicate whether the rotation is to be applied relative to the last angle of rotation. For example, if an object has rotated 45 degrees, and rotation3d property is applied again with an angle of 5 degrees and “relative” set to true, the result will be that the object is further rotated by 5 degrees, resulting in 50 degrees rotation in total.
- Setting “relative” to false would make the rotation to begin from original position.
Property Name: size
- Type:
{ w: integer h: integer }
- Description: The width and height of this object
Property Name: skipEvent
- Type: bool
- Description: Set to
true
if events are to be ignored by this object andfalse
otherwise
Property Name: type
- Type: string
- Description:
- Read-only property.
- Please refer to the Constants section.
Property Name: visible
- Type: bool
- Description: Set to
true
if this object is visible andfalse
otherwise
Events
Events on objects can be registered using the addEventListener()
method.
Event Name: mouseIn
Definition of event info parameter in callback:
{
pos:
{
x: int
y: int
}
buttons: int
timestamp: int
}
“buttons” is a bit mask where:
- 0x01: left button
- 0x02: middle button
- 0x04: right button
Event Name: mouseOut
Definition of event info parameter in callback:
Same as mouseIn.
Event Name: mouseDown
Definition of event info parameter in callback:
{
pos:
{
x: int
y: int
}
button: int
timestamp: int
}
“button” is a number indicating which button has pressed:
- 0x01: left button
- 0x02: middle button
- 0x03: right button
Event Name: mouseUp
Definition of event info parameter in callback:
same as mouseDown
Event Name: mouseMove
Definition of event info parameter in callback:
{
pos:
{
x: int
y: int
}
prev:
{
x: int
y: int
}
buttons: int
timestamp: int
}
“buttons” is a bit mask where:
- 0x01: left button
- 0x02: middle button
- 0x04: right button
Event Name: mouseWheel
Definition of event info parameter in callback:
{
pos:
{
x: int
y: int
}
z: int
direction: int
timestamp: int
}
Value of “z”:
- -1: vertical wheel up
- 1: vertical wheel down
Event Name: free
Definition of event info parameter in callback:
This event indicates that the object has been deleted by the FancyPants, most likely due to the deletion of its parenting container. Application should remove reference on this object as any subsequent access will be invalid.
Event Name: keyDown
Definition of event info parameter in callback:
{
key: string
logicalKey: string
string: string
compose: string
timestamp: int
}
Following explanation assumes SHIFT has been held down and 1 is pressed
- “key”: name of the physical key pressed as on keyboard. In this example,
key = “1”
- “logicalKey”: the logical key. In this case,
logicalKey = “exclam”
- “string”: UTF8 text of the visible string. In this case,
string = “!”
- “compose”: UTF8 text of the visible string in case the keystroke has modified a string in middle of being composed. (it would replace the previous one)
Event Name: keyUp
Definition of event info parameter in callback:
same as keyDown.
Event Name: focusIn
Definition of event info parameter in callback:
Event Name: focusOut
Definition of event info parameter in callback:
Event Name: show
Definition of event info parameter in callback:
Event Name: hide
Definition of event info parameter in callback:
Event Name: move
Definition of event info parameter in callback:
{
pos:
{
x: int
y: int
}
prev:
{
x: int
y: int
}
}
Event Name: resize
Definition of event info parameter in callback:
{
size:
{
w: int
yh: int
}
prev:
{
w: int
h: int
}
}
Event Name: restack
Definition of event info parameter in callback:
Event Name: imagePreloaded
Definition of event info parameter in callback:
Event Name: clipChange
Definition of event info parameter in callback:
{
isclipper: bool
clipee: FpObject
old: FpObject
current: FpObject
}
This event indicates that the clip of a clipee object has been changed. If this event is registered on the clip object, it too will receive the same event when a clipee has been added to it.
- “isclipper”: indicates whether the object receiving this event is a clipper or a clipee.
- “clipee”: the clipee object which its clip has changed.
- “old”: the old clipper object (ie. old clip)
- “current”: the current clipper object
Consider the following example:
clip1 = fp.rectangle(...);
clip2 = fp.rectangle(...);
img = fp.image(...);
//
img.set(“clip”, clip1);
//
img.addEventListener(“clip”, function(ev) {..});
clip1.addEventListener(“clip”, function(ev) {..});
clip2.addEventListener(“clip”, function(ev) {..});
Now, when we execute following statement:
img.set(“clip”, clip2);
img's clipChange event data:
isclipper = false
clipee = img
old = clip1
current = clip2
clip2's clipChange event data:
isclipper = true
clipee = img
old = clip1
current = clip2
clip1 will not be receiving the clipChange event.
General Methods
Method name: addEventListener
Input parameters:
- evt: string
- callback: function
Description:
- Please refer to the Events section above for a list of supported events.
- Callback is in the form of:
void callback(event_info)
- The “event_info” is event dependent, please refer to the Events section above for detail
Method name: addKeyGrab
Input parameters:
- key: string,
- exclusive: bool
Return type: bool
Description:
- This function allows the object to receive the key event without being focused.
- Please refer to the Constants section for a list of key names.
- “exclusive” is an optional parameter (default is
false
) indicating whether if other object can still receive this particular key event. Setting “exclusive” totrue
means only the current can receive such event and no other objects can, setting it tofalse
allows all objects (who have also grabbed the same key) to receive the key event. - Function returns true if key was successfully grabbed, false otherwise.
Method name: get
Input parameters:
- propName: string
Return type:
- property specific type
Description:
Gets the property value, or simply treat the properties like class variables and retrieve by obj.xxx syntax
.
Method name: reflect
Description:
Adds the reflection effect on the object.
Method name: removeEventListener
Input parameters:
- evt: string,
- callback: function
Description:
In the case of missing “callback” parameter, this function removes all listeners from the specified event.
Method name: removeKeyGrab
Input parameters:
- key: string
Method name: ripple
Description:
Adds the ripple effect on the object.
Method name: set
Input parameters:
- propName: string,
- propValue: property type
Description:
Sets the value of the property.
Method name: set
Input parameters:
{
propName: propValue,
propName: propValue,
...
}
Description:
This method allows multiple properties to be set through a single call. “propName” is the name of the property listed in the Properties section above, while the “propValue” is the value to be set. The type of the “propValue” is dependent on the associated properties, please refer to Properties section for details..
For example:
obj.set({
coord:{x:10},
size: {w: 100, h: 200},
focus: true
});
Method name: stackAbove
Input parameters:
- obj: FpObject
Method name: stackBelow
Input parameters:
- obj: FpObject
Method name: stackBottom
Method name: stackTop
Method name: toString
Return type:
- string
Description:
Returns the concrete class name of the object, with the value of the “name” property appended if available.
Effects
Method name: boing
Input parameters
{
osc: double
b: double
a: double
w: double
callback: function
}
Description
- There can only be 1 boing effect in progress at any one time, calling this method before the end of the first boing effect will ignored.
- Boing effect cannot be stopped manually, the program must wait for the effect to finish.
- Callback function is an optional parameter which will be triggered when the current boing effect has stopped.
- Callback is in the form of:
void callback(reason)
Where “reason” is a text string and it will be set to “done” indicating the end of effect.
Method name: bounce
Input parameters
{
stop: bool
callback: function
}
Description
- The bounce effect can be called for multiple times, causing the object to be re-bounced everytime it is called.
- Unlike other effects, when “stop” is set to
true
, the bounce will stop at the end of current bounce cycle instead of jumping to the end position. As there could be a short delay between the time when “stop” is called, to the time when effect is fully stopped, the callback is an indication when the effect is fully stopped. - In the case when “stop” parameter is specified along with other parameters, the bounce effect will be stopped and other parameters will be ignored.
- Callback function is an optional parameter which will be triggered when the current bounce effect has stopped.
- Callback is in the form of:
void callback(reason)
Where “reason” is a text string and it will be set to “done” indicating the end of effect. - Please note that if a callback function is specified for both starting and stopping the bounce effect, the first callback will be discarded and only the latter one will be invoked.
Example
// Start bouncing
obj.bounce({callback: func1});
// Stop bouncing
obj.bounce({callback: func2});
// Only “func2” will be invoked when the bounce effect stopped.
Method name: colorEffect
Input parameters
{
list:
[
{
effect: string
param: string
},
{
effect: string
param: string
},
...
],
callback: function
}
Description
- Please refer to the Constants section for a list of color effects.
- The callback is a mandatory parameter and will be triggered with a new FpImage object that is * the result of the sequence of color effects.
- Callback is in the form of:
void callback(reason, img)
Where “reason” is a text string and it will be set to “done” to indicate the completion of effect, the “img” parameter holds result of the color effect in a new FpImage object. - WARNING: In the case when list is not a valid array, or contains an invalid effect name, this effect will be aborted and the callback will not be triggered.
Method name: fade
Input parameters
{
stop: bool
fadeIn: bool
callback: function
}
Description
- “fadeIn” parameter is used to specify whether if a fade-in (true) or fade-out (false) effect is used.
- In the case when “stop” parameter is specified along with other parameters, the fade effect will be stopped and other parameters will be ignored.
- Callback function is an optional parameter which will be triggered when the current fade effect has ended or aborted due to another call to
fade()
. - Callback is in the form of:
void callback(reason)
Where “reason” is a text string and it can be either “done” to indicate the completion of effect (either at the end of fade effect or explicitly stopped by caller), or “abort” indicating the effect has been aborted by a second call to fade().
Method name: fly
Input parameters
{
dest :
{
x: integer
y: integer
}
speed: integer
rotations :
{
x: integer
y: integer
z: integer
}
callback: function
}
Description
- The previous fly effect will be aborted when applying this effect on the same object multiple times, result in the change of fly path to the new parameters specified.
- The rotations parameter indicates the number of rotation to perform on the given axis.
- Callback function is an optional parameter which will be triggered when the current fade effect has ended or aborted due to another call to fade().
- Callback is in the form of:
void callback(reason)
Where “reason” is a text string and it can be either “done” to indicate the completion of effect, or “abort” indicating the effect has been aborted by a second call tofly()
.
Method name: follow
Input parameters
{
src: FpObject
top: integer
left: integer
right: integer
bottom: integer
}
Method name: moveto
Input parameters
{
dest :
{
x: integer
y: integer
}
accel: bool
callback: function
}
Description
- The previous moveto effect will be aborted when applying this effect on the same object multiple times, result in the change of path to the new parameters specified.
- Callback function is an optional parameter which will be triggered when the current moveto effect has ended or aborted due to another call to
moveto()
. - Callback is in the form of:
void callback(reason)
Where “reason” is a text string and it can be either “done” to indicate the completion of effect, or “abort” indicating the effect has been aborted by a second call tomoveto()
or if the object's “coord” property has been updated.
Method name: shaderEffect
Input parameters
{
stop: bool
effect: string
args: <shader dependent arguments>
}
If effect = “ripple”:
args =
{
center_x: double
center_y: double
}
// center_x/y has range of 0~1 indicating the width/height of object.
If effect = “peel”:
args =
{
tess_col: integer
tess_row: integer
}
Description
- This method applies the OpenGL shader effect on the object.
- The “effect” parameter describes the shader effect to use, please refer to the Constants section for a list of shader effects.
- There are 3 ways to stop the shader effect:
- set “stop” as
true
, or - omit the “effect” parameter, or
- pass in the “effect” as an empty string.
- set “stop” as
- All other parameters will be ignored when effect is to be stopped.
- “args” is an optional parameter allowing caller to adjust the parameters of the corresponding shader. When “args” is not specified or if any of the parameters within “args” is missing, the default value will be used instead.
Method name: shaderEffect
Input parameters
effect: string
Description
- This method is a shorthand for the
shaderEffect({})
above, it allows application to specify which shader effect to apply, as this method does not include “args” parameter, the default shader parameters will be used instead. - To stop the effect, please pass in an empty string for “effect” or simply call this method without any parameter.
- The list of effects is identical to the shaderEffect({}) above, please refer to the Constants section for a list of shader effects.
Method name: stars
Input parameters
{
stop: bool
}
Description
There is only 1 instance of the stars effect, calling stars()
multiple times will be ignored.
“stop” can be use to stop the stars effect if needed.
Method name: transform
Input parameters
{
newCoord :
{
x: integer
y: integer
}
newSize :
{
w: integer
h: integer
}
newColor :
{
r: integer
g: integer
b: integer
a: integer
premul: bool
}
callback: function
}
Description
- The previous transform effect will be aborted when applying this effect on the same object multiple times, result in the change of transformation to the new parameters specified.
- Callback function is an optional parameter which will be triggered when the current transform effect has ended or aborted due to another call to
transform()
. - Callback is in the form of:
void callback(reason)
Where “reason” is a text string and it can be either “done” to indicate the completion of effect, or “abort” indicating the effect has been aborted by a second call totransform()
.
Method name: typer
Input parameters
{
stop: bool
callback: function
}
Description
- This effect applies to FpText object only.
- There can only be 1 typer effect in progress at any one time, calling this method before the end of the first typer effect will be ignored.
- In the case when “stop” parameter is specified along with other parameters, the fade effect will be stopped and other parameters will be ignored.
- Callback function is an optional parameter which will be triggered when the current typer effect has stopped.
- Callback is in the form of:
void callback(reason)
Where “reason” is a text string and it will be set to “done” indicating the end of effect or if the effect has been explicitly stopped by application.
Method name: vacuum
Input parameters
{
tl :
{
x: integer
y: integer
}
tr :
{
x: integer
y: integer
}
bl :
{
x: integer
y: integer
}
br :
{
x: integer
y: integer
}
tlTime: integer
trTime: integer
blTime: integer
brTime: integer
callback: function
}
Description
- tl: Top Left
- tr: Top Right
- bl: Bottom Left
- br: Bottom Right
- The previous vacuum effect will be aborted when applying this effect on the same object multiple times, result in the change of geometry to the new parameters specified.
- Callback function is an optional parameter which will be triggered when the current vacuum effect has ended or aborted due to another call to
vacuum()
. - Callback is in the form of:
void callback(reason)
Where “reason” is a text string and it can be either “done” to indicate the completion of effect, or “abort” indicating the effect has been aborted by a second call tovacuum()
.
FpRectangle Class
Extends: FpObject
Constructor
FpRectangle instance is constructed through object/widget construction methods from Fp.
Properties
Properties of this class are inherited from FpObject, please refer to the list of properties supported by FpObject for details.
Events
Events supported by this class are inherited from FpObject, please refer to the list of events supported by FpObject for details.
Methods
This section defines the FpRectangle specific methods, please refer to FpObject methods page for list of methods supported in parent class.
Method Name | Input Parameters | Return Type | Description |
---|---|---|---|
getClipees | FpObject[] |
Returns null if no clipees. |
FpText Class
Extends: FpObject
Constructor
FpText instance is constructed through object/widget construction methods from Fp.
Properties
Properties supported by this class are ones inherited from FpObject and the ones listed in the table below. Please use get()
and set()
methods as defined by FpObject to retrieve and modify these properties. Properties can also be retrieved by treating them as class variables and accessible through obj.xxx
syntax.
Property Name | Type | Description |
---|---|---|
text | string | |
textEffect | string | Please refere to Constants section for a list of text effects. |
style | string | Please refere to Constants section for a list of text styles. The values aren't limited to the list of constant. They retrieve the properties from the table located in the metrics file of the current theme name font_[the string] |
glowColor | { r: integer, g: integer, b: integer, a: integer, premul: bool } |
set only |
glow2Color | same | set only |
shadowColor | same | set only |
outlineColor | same | set only |
Events
Events supported by this class are inherited from FpObject, please refer to the list of events supported by FpObject for details.
Methods
Please refer to FpObject methods page for list of methods supported in parent class.
FpContainer Class
Extends: FpObject
Constructor
FpContainer instance is constructed through object/widget construction methods from Fp.
Properties
Properties of this class are inherited from FpObject, please refer to the list of properties supported by FpObject for details.
Events
Events supported by this class are inherited from FpObject, please refer to the list of events supported by FpObject for details.
Methods
This section defines the FpContainer specific methods, please refer to FpObject methods page for list of methods supported in parent class.
Method Name | Input Parameters | Description |
---|---|---|
add | obj: FpObject, x: int, y: int |
x & y are optional parameters, indicating the offset of into the container object where the child should be added. |
add | obj: FpObject, { x: int, y: int } |
Same as add(obj, x, y) above). The x & y parameters are optional in this method also. |
remove | obj: FpObject |
FpImage Class
Extends: FpObject
Constructor
FpImage instance is constructed through object/widget construction methods from Fp.
Properties
Properties supported by this class are ones inherited from FpObject and the ones listed in the table below. Please use get()
and set()
methods as defined by FpObject to retrieve and modify these properties. Properties can also be retrieved by treating them as class variables and accessible through obj.xxx
syntax.
Property Name: border
Type
{
left: integer,
top: integer,
right: intger,
bottom: integer
}
Property Name: file
Type
string
Property Name: nativeSize
Type
{
w: integer,
h: integer
}
Description
Read-only property
Property Name: tile
Type
{
x: integer,
y: integer,
w: integer,
h: integer
}
Description
- Normally the image is scaled to the size of the image object, in order to make the image tiled in the image object, one simply needs to change the dimension of image by using the “tile” property.
- x,y represent the coordinate in image that the object should start to display (ie. the top-left corner).
- w,h scales the image to the specified size. If the size is smaller than the size of image object, the remaining space in the object will be filled with this image of the same dimension to achieve the tile effect.
Property Name: url
Type
FpImage.get()
returns “string”.FpImage.set()
accepts one of following:- string
- the following table:
{ loc: string, done_cb: function }
Description
- “done_cb” is an optional parameter that will be triggered when the image is loaded.
- In the case when
set()
is called with a single string instead of a structure, this call is identical with the structure form except done_cb has been ignored. - The format of the location string must be a standard URL.
- Callback is in the form of:
void callback(succeed)
Where “succeed” is a boolean indicating whether if the image was successfully loaded.
Property Name: theme_image
Type
string
Description
The string passed into the constructor is a key to the metrics file. The key can be either a variable in the metrics file as follows:
var string = { file: “filename_of_image.png” }
To key can also be a function in the metrics file as follows:
function string(data) {
print(“Hi”);
// set image properties
data.themeImageByFile(“filename_of_image.png”);
}
Events
Events supported by this class are inherited from FpObject, please refer to the list of events supported by FpObject for details.
Methods
This section defines the FpImage specific methods, please refer to FpObject methods page for list of methods supported in parent class.
Method Name | Input Parameters | Description |
---|---|---|
preload | ||
preloadAbort | ||
themeImageByKey | string | Looks in the current theme metrics file for a variable name as the string passed. If the variable is a function, the function gets executed. if the variable is a table, the image loads its properties from the table entries (file, border...). The theme metric file is $FP_THEMEPATH/currenttheme/metrics.fpj |
themeImageByFile | string | Does the equivalent of a file set but prepending the passed string with “currenttheme/images/” where currenttheme is the full path of the current theme. The current theme is located in $FP_THEMEPATH/currenttheme/ . |
FpLayout Class
Extends: FpObject
Constructor
FpLayout instance is constructed through object/widget construction methods from Fp.
Properties
Properties supported by this class are ones inherited from FpObject and the ones listed in the table below. Please use get()
and set()
methods as defined by FpObject to retrieve and modify these properties. Properties can also be retrieved by treating them as class variables and accessible through obj.xxx
syntax.
Property Name | Type | Description |
---|---|---|
orientation | string | Please refer to Constants section for a list of orientations. |
Events
Events supported by this class are inherited from FpObject, please refer to the list of events supported by FpObject for details.
Methods
This section defines the FpLayout specific methods, please refer to FpObject methods page for list of methods supported in parent class.
Method Name | Input Parameters | Description |
---|---|---|
add | obj: FpObject, offset: integer, padding: integer |
“obj” is a mandatory parameter while all others are optional. |
add | obj: FpObject, mode: string, offset: integer, padding: integer |
“obj” is a mandatory parameter while all others are optional. Please refer to Constants section for a list of layout child modes. |
add | obj: FpObject, { mode: string, offset: integer, padding: integer } |
“obj” is a mandatory parameter while all others are optional. Please refer to Constants section for a list of layout child modes. |
remove | obj: FpObject |
FpMedia Class
Extends: FpObject
Constructor
FpMedia instance is constructed through object/widget construction methods from Fp.
Properties
Properties supported by this class are ones inherited from FpObject and the ones listed in the table below. Please use get()
and set()
methods as defined by FpObject to retrieve and modify these properties. Properties can also be retrieved by treating them as class variables and accessible through obj.xxx
syntax.
Property Name file
Type
string
Property Name duration
Type
double
Description
Read-only property.
Property Name elapsed
Type
double
Description
Read-only property.
Property Name keepAspect
Type
bool
Property Name loop
Type
bool
Property Name mute
Type
bool
Property Name: nativeSize
Type
{
w: integer
h: integer
}
Description
Read-only property.
Property Name: speed
Type
double
Description
- Write-only property.
- -2, -4, -8, -16, -32: fast reverse playback at multiple of normal reverse playback speed.
- -1.0~0.0: reverse slow motion playback. The speed is the fraction of the normal reverse playback speed.
- 0.0: still picture.
- 0.0~1.0: slow motion playback. The speed is the fraction of the normal playback speed.
- 1.0: playback at normal speed.
- 2, 4, 8, 16, 32: fast forward at multiple of normal playback speed.
Property Name: state
Type
string
Description
- Please refer to Constants section for a list of media states.
- Please note that the state “buffering” is a state that could be returned by
FpMedia.get(“state”)
, but it is not a state that can eb set byFpMedia.set(“state”)
.
Property Name: tile
Type
{
x: integer
y: integer
w: integer
h: integer
}
Description
- Normally the image is scaled to the size of the image object, in order to make the image tiled in the image object, one simply needs to change the dimension of image by using the “tile” property.
- x,y represent the coordinate in image that the object should start to display (ie. the top-left corner).
- w,h scales the image to the specified size. If the size is smaller than the size of image object, the remaining space in the object will be filled with this image of the same dimension to achieve the tile effect.
Property Name: url
Type
string
Property Name: videoLayer
Type
integer
Description
Write-only property.
Property Name: volume
Type
integer
Description
0 ~ 100
Events
There are two types of events supported by FpMedia: the events inherited from FpObject, and FpMedia specific events. For details on FpObject events, please refer to FpObject section. Following table defines a list of events specific to FpMedia, which can only be registered using the FpMedia.addMediaEventListener()
method.
Event String | Description |
---|---|
ready | |
meta | |
error | The “extra” parameter in the callback specifies the error text. Please refer to the Constants section for a list of error strings. |
end | |
bufferStart | |
bufferFilled | |
bufferData | The “extra” parameter in the callback specifies the buffer percentage (0 ~ 100). |
Methods
This section defines the FpMedia specific methods, please refer to FpObject methods page for list of methods supported in parent class.
Method Name | Input Parameters | Return Type | Description |
---|---|---|---|
addMediaEventListener | callback: function |
Caller does not need to specify the type of media event to add, caller only needs to specify a callback to receive and handle all types of media events. Callback is in the form of:void callback(event_string, extra) |
|
imageAttach | img: FpImage |
Output the video onto an image object as well. | |
imageDetach | img: FpImage |
||
open | bool | ||
pause | bool | ||
play | bool | ||
removeMediaEventListener | callback: function |
In the case of missing “callback” parameter, this function removes all media event listeners. | |
seek | offset: double , whence: string |
bool | Please refer to the Constants section for a list of whence values. “whence” is an optional parameter and has a default value of “set”. |
stop | bool |
FpTextentry Class
Extends: FpObject
Constructor
FpTextentry instance is constructed through object/widget construction methods from Fp.
Properties
Properties supported by this class are ones inherited from FpObject and the ones listed in the table below. Please use get()
and set()
methods as defined by FpObject to retrieve and modify these properties. Properties can also be retrieved by treating them as class variables and accessible through obj.xxx
syntax.
Property Name | Type | Description |
---|---|---|
cursorBlink | bool | |
alignment | string | See Constant |
cursorPos | integer | |
editable | bool | |
maxLength | integer | |
password | bool | |
selEnd | integer | |
selStart | integer | |
selText | string | getter only, not setter |
selTextLength | integer | getter only |
text | string | |
textLength | integer | getter only, not setter |
Events
Events supported by this class are inherited from FpObject, please refer to the list of events supported by FpObject for details.
Event Name | Definiton of “event_info” Parameter in Callback |
---|---|
enter | User press enter. text passed as first parameter to the handler. |
Methods
Please refer to FpObject methods page for list of methods supported in parent class.
FpCheckbox Class
Extends: FpObject
Constructor
FpCheckbox instance is constructed through object/widget construction methods from Fp.
Properties
Properties supported by this class are ones inherited from FpObject and the ones listed in the table below. Please use get()
and set()
methods as defined by FpObject to retrieve and modify these properties. Properties can also be retrieved by treating them as class variables and accessible through obj.xxx
syntax.
Property Name | Type | Description |
---|---|---|
checked | bool | |
text | string | |
style | string | Please refer to the Constants section for a list of text styles. |
Events
Events supported by this class are ones inherited from FpObject and the ones listed in the table below. Please use addEventListener()
method as defined by FpObject to register the event listener for both of these types of events.
Event name | Definiton of “event_info” Parameter in Callback |
---|---|
change | “event_info” will be a bool value indicating whether if the checkbox is checked. true means checked, false means unchecked. |
Methods
This section defines the FpCheckbox specific methods, please refer to FpObject methods page for list of methods supported in parent class.
Method Name | Input Parameters | Return Type | Description |
---|---|---|---|
toggle | bool | Toggle the checkbox between checked and unchecked states. Function returns the state of checkbox after it's being toggled. true means checked, false means unchecked. |
FpProgressbar Class
Extends: FpObject
Constructor
FpProgressbar instance is constructed through object/widget construction methods from Fp.
Properties
Properties supported by this class are ones inherited from FpObject and the ones listed in the table below. Please use get()
and set()
methods as defined by FpObject to retrieve and modify these properties. Properties can also be retrieved by treating them as class variables and accessible through obj.xxx
syntax.
Property Name | Type | Description |
---|---|---|
orientation | string | Please refer to the Constants section for a list of orientations. |
max | double | |
value | double |
Events
Events supported by this class are inherited from FpObject, please refer to the list of events supported by FpObject for details.
Methods
Pease refer to FpObject methods page for list of methods supported in parent class.
FpCalendar Class
Extends: FpObject
Constructor
FpCalendar instance is constructed through object/widget construction methods from Fp.
Properties
Properties supported by this class are ones inherited from FpObject and the ones listed in the table below. Please use get()
and set()
methods as defined by FpObject to retrieve and modify these properties. Properties can also be retrieved by treating them as class variables and accessible through obj.xxx
syntax.
Property Name: date
Type
{
year: integer
month: integer
day: integer
timestamp: integer
}
Description
- For the
set()
method, the “timestamp” parameter is the standard UNIX timestamp and is optional when set. The year/month/day parameters supersede the timestamp if present. - For the
get()
method, the “timestamp” parameter will always be filled along with year/month/day parameters.
Events
Events supported by this class are ones inherited from FpObject and the ones listed in the table below. Please use addEventListener() method as defined by FpObject to register the event listener for both of these types of events.
Event name | Definiton of “event_info” Parameter in Callback |
---|---|
change | Triggered when the selected date of the calendar has been changed. The passed date (see type above) contains the new date. |
Methods
Please refer to FpObject methods page for list of methods supported in parent class.
FpButton Class
Extends: FpObject
Constructor
FpButton instance is constructed through object/widget construction methods from Fp.
Properties
Properties supported by this class are ones inherited from FpObject and the ones listed in the table below. Please use get()
and set()
methods as defined by FpObject to retrieve and modify these properties. Properties can also be retrieved by treating them as class variables and accessible through obj.xxx
syntax.
Property Name | Type | Description |
---|---|---|
text | string | Label of the button |
bgThemeImageKey | string | Button background image theme key (refer to FpImage:imageThemeByKey) |
textStyle | string | Please refer to the Constants section for a list of text styles. |
sensitive | bool |
Events
Events supported by this class are ones inherited from FpObject and the ones listed in the table below. Please use addEventListener()
method as defined by FpObject to register the event listener for both of these types of events.
Event name | Definiton of “event_info” Parameter in Callback |
---|---|
click | Triggered when the button is clicked. |
Methods
Please refer to FpObject methods page for list of methods supported in parent class.
FpCube Class
Extends: FpObject
Constructor
FpCube instance is constructed through object/widget construction methods from Fp.
Properties
Properties supported by this class are ones inherited from FpObject and the ones listed in the table below. Please use get()
and set()
methods as defined by FpObject to retrieve and modify these properties. Properties can also be retrieved by treating them as class variables and accessible through obj.xxx
syntax.
Property Name: angle
Type
{
deg: double
direction: string
}
Description
Both the “deg” and “direction” are mandatory parameter, the “direction” can be one of “snap”, “left”, "right”.
Property Name: rotationDuration
Type
double
Description
The number of seconds for the cube to animate to the target rotation degree.
Property Name: depth
Type
integer
Property Name: orientation
Type
string
Description
Please refer to the Constants section for a list of orientations.
Property Name: perspective
Type
{
coord :
{
x: integer
y: integer
z: integer
}
}
Property Name: tilt
Type
{
deg: double
direction: string
}
Description
Both the “deg” and “direction” are mandatory parameter, the “direction” can be one of “snap”, “up”, "down”.
Events
Events supported by this class are ones inherited from FpObject and the ones listed in the table below. Please use addEventListener() method as defined by FpObject to register the event listener for both of these types of events.
Event name | Definiton of “event_info” Parameter in Callback |
---|---|
animate | “event_info” will be a bool value indicating whether if the cube animation is in progress or has ended. true means animating, false means animation stopped. |
Methods
This section defines the FpCube specific methods, please refer to FpObject methods page for list of methods supported in parent class.
Method Name | Input Parameters | Return Type | Description |
---|---|---|---|
add | face: FpObject |
bool | Up to 6 objects can be added to the cube, each object represents a face on the cube. Once all 6 faces have been added (including the faces added through FpCube constructor call), any subsequent objects will be ignored. The order to which face the object will be added to is as follows: Front, Right, Back, Left, Top, Bottom. Function returns “true” indicating the object was successfully added, “false” otherwise. |
FpFlip Class
Extends: FpObject
Constructor
FpFlip instance is constructed through object/widget construction methods from Fp.
Properties
Properties supported by this class are ones inherited from FpObject and the ones listed in the table below. Please use get()
and set()
methods as defined by FpObject to retrieve and modify these properties. Properties can also be retrieved by treating them as class variables and accessible through obj.xxx
syntax.
Property Name: angle
Type
{
deg: double
direction: string
}
Description
- Write-only property. Both “deg” and “direction” are mandatory.
- Please refer to the Constants section for a list of directions.
Property Name: depth
Type
integer
Property Name: showboth
Type
bool
Events
Events supported by this class are inherited from FpObject, please refer to the list of events supported by FpObject for details.
Methods
Please refer to FpObject methods page for list of methods supported in parent class.
FpKeyboard Class
Extends: FpObject
FpKeyboard is a widget that displays a virtual keyboard on screen, allowing user to enter text to the FpTextentry widget as the keys are clicked on. As such, Fpkeyboard only responds to mouse input, and require a FpTextentry to be created and focused in order to have any effect.
Constructor
FpKeyboard instance is constructed through object/widget construction methods from Fp.
Properties
Properties of this class are inherited from FpObject, please refer to the list of properties supported by FpObject for details.
Events
Events supported by this class are inherited from FpObject, please refer to the list of events supported by FpObject for details.
Methods
Please refer to FpObject methods page for list of methods supported in parent class.
FpTextarea Class
Extends: FpObject
Constructor
FpTextarea instance is constructed through object/widget construction methods from Fp.
Properties
Properties of this class are inherited from FpObject, please refer to the list of properties supported by FpObject for details. Properties can also be retrieved by treating them as class variables and accessible through obj.xxx
syntax.
Property Name | Type | Description |
---|---|---|
cursorPos | integer | |
editable | bool | |
alignment | string | See Constant |
text | string | |
textHeight | integer | get() only, text height, in pixel |
textStyle | string | set() only, For a list of text styles please refer to the Constants section. |
lineSpacing | integer | set() only Number of pixels between lines |
Events
Events supported by this class are inherited from FpObject, please refer to the list of events supported by FpObject for details.
Methods
Please refer to FpObject methods page for list of methods supported in parent class.
FpSlider Class
Extends: FpObject
Constructor
FpSlider instance is constructed through object/widget construction methods from Fp.
Properties
Properties supported by this class are ones inherited from FpObject and the ones listed in the table below. Please use get()
and set()
methods as defined by FpObject to retrieve and modify these properties. Properties can also be retrieved by treating them as class variables and accessible through obj.xxx
syntax.
Property Name | Type | Description |
---|---|---|
max | double | |
value | double |
Events
Events supported by this class are ones inherited from FpObject and the ones listed in the table below. Please use addEventListener()
method as defined by FpObject to register the event listener for both of these types of events.
Event Name | Definiton of “event_info” Parameter in Callback |
---|---|
change | Triggered when the position of the slider bar has been changed. The new value property is passed. |
Methods
Please refer to FpObject methods page for list of methods supported in parent class.
FpFilebrowser Class
Extends: FpObject
Constructor
FpFilebrowser instance is constructed through object/widget construction methods from Fp.
Properties
Properties supported by this class are ones inherited from FpObject and the ones listed in the table below. Please use get()
and set()
methods as defined by FpObject to retrieve and modify these properties. Properties can also be retrieved by treating them as class variables and accessible through obj.xxx
syntax.
Property Name: content
Type
[
{
name: string
folder: bool
playlist: bool
size: double
date: string
thumbnail: string
},
{
name: string
folder: bool
playlist: bool
size: double
date: string
thumbnail: string
},
...
]
Description
Read-only property.
Property Name: filter
Type
string
Description
- “filter” is a comma separated string indicating the type(s) of files that can be displayed in file browser.
- The value can be set to an empty string to clear all filters, likewise, the
get()
could also return an empty string. - Please refer to the Constants section for a list of values for filter.
Property Name: path
Type
string
Description
Setting this property will not trigger the “change” event callback.
Property Name: traversal
Type
string
Description
- “traversal” indicates whether if user can traverse to different folders.
- Please refer to the Constants section for a list of values for traversal.
Events
Events supported by this class are ones inherited from FpObject and the ones listed in the table below. Please use addEventListener() method as defined by FpObject to register the event listener for both of these types of events.
Event Name | Definiton of “event_info” Parameter in Callback |
---|---|
change | Event callback is triggered when user changes a directory within file browser, the callback is not triggered when “path” property is changed. “event_info” will be the path of the directory that the file browser is changing to. |
select | Event callback is triggered when user select an item in file browser. “event_info” will be the name of the item (file or folder) that is being selected in the file browser. |
Methods
Please refer to FpObject methods page for list of methods supported in parent class.
FpMultiselect Class
Extends: FpObject
Constructor
FpMultiselect instance is constructed through object/widget construction methods from Fp.
Properties
Properties supported by this class are ones inherited from FpObject and the ones listed in the table below. Please use get()
and set()
methods as defined by FpObject to retrieve and modify these properties. Properties can also be retrieved by treating them as class variables and accessible through obj.xxx
syntax.
Property Name | Type | Description |
---|---|---|
opened | bool | |
selItem | string | |
alignment | string | set() only, See Constant |
openable | boolean | set() only |
maxHeight | integer | set() only, Maximum height of the list of items. |
Events
Events supported by this class are ones inherited from FpObject and the ones listed in the table below. Please use addEventListener()
method as defined by FpObject to register the event listener for both of these types of events.
Event Name | Definiton of “event_info” Parameter in Callback |
---|---|
select | Triggered when the selected item has changed. The new selItem: string is passed. |
Methods
This section defines the FpMultiselect specific methods, please refer to FpObject methods page for list of methods supported in parent class.
Method Name | Input Parameters | Return Type | Description |
---|---|---|---|
add | item: string |
Add the item to the list of items | |
add | items: string[] |
Add the items to the list of items | |
clear | clear the list of items |
FpScrolllist Class
Extends: FpObject
Constructor
FpScrolllist instance is constructed through object/widget construction methods from Fp.
Properties
Properties supported by this class are ones inherited from FpObject and the ones listed in the table below. Please use get()
and set()
methods as defined by FpObject to retrieve and modify these properties. Properties can also be retrieved by treating them as class variables and accessible through obj.xxx
syntax.
Property Name | Type | Description |
---|---|---|
hAppear | string | Please refer to Constants section for a list of appear modes for horizontal and vertical scrollbars. |
kinetic | bool | |
orientation | string | Please refer to the Constants section for a list of orientations. |
offset | integer | |
padding | integer | |
selIndex | integer | Read-only property. -1 if no object is selected. |
selObject | FpObject | Use get() to retrieve the currently selected object, null if no object is selected.Use set() to set focus on the object. |
scroll | string | Please refer to Constants section for a list of scroll modes. |
vAppear | string | Please refer to Constants section for a list of appear modes for horizontal and vertical scrollbars. |
Events
Events supported by this class are ones inherited from FpObject and the ones listed in the table below. Please use addEventListener() method as defined by FpObject to register the event listener for both of these types of events.
Event Name | Definiton of “event_info” Parameter in Callback |
---|---|
select | “event_info” will be a FpObject indicating the object that has been selected in the scroll list. |
Methods
This section defines the FpScrolllist specific methods, please refer to FpObject methods page for list of methods supported in parent class.
Method Name | Input Parameters | Return Type | Description |
---|---|---|---|
add | obj: FpObject |
||
clear | |||
remove | obj: FpObject |
FpScrollbar Class
Extends: FpObject
Constructor
FpScrollbar instance is constructed through object/widget construction methods from Fp.
Properties
Properties supported by this class are ones inherited from FpObject and the ones listed in the table below. Please use get()
and set()
methods as defined by FpObject to retrieve and modify these properties. Properties can also be retrieved by treating them as class variables and accessible through obj.xxx
syntax.
Property Name: fading
Type
bool
Property Name: hAppear
Type
string
Description
Please refer to Constants section for a list of appear modes for horizontal and vertical scrollbar.
Property Name: kinetic
Type
bool
Property Name: scrollPos
Type
{
x: integer
y: integer
}
Property Name: target
Type
obj: FpObject
Description
Value can be null to unset the object in scrollbar.
Property Name: vAppear
Type
string
Description
Please refer to Constants section for a list of appear modes for horizontal and vertical scrollbar.
Events
Events supported by this class are inherited from FpObject, please refer to the list of events supported by FpObject for details.
Methods
Please refer to FpObject methods page for list of methods supported in parent class.
Back to main - Copyright © 2015 Fluffy Spider Techologies - http://fluffyspider.com