FLIQ - Fast, Light, Interactive and Quick |
![]() |
Introduction |
FLIQ is a simple toolkit that allows you to rapidly prototype UI designs from images without learning a lot of JavaScript or HTML. The basic idea is that an application is represented by a series of pages. Each page has a background image that defines most of the content of your user interface. The idea that you are creating sketches either with pencil, PowerPoint or some other drawing tool and then putting limited interaction over the top of those sketches so that you can try out your ideas. The goal is not quality implementations but quick conversion of design ideas into something someone can play with a give a response.
Once one has a set of page images, FLIQ will allow you to place various controls over the tops of these images. Each type of control has a mechanism for calling JavaScript functions to perform operations. In many prototyping cases the JavaScript will simply flip to another page. Warning: FLIQ is only known to work with Firefox browsers. Everything except "draggable" works on Android. It is known not to work with Internet Explorer. |
|
FLIQ page template |
A FLIQ application is just a web page that you put on your web site. The following is the basic template from which a FLIQ application is built.
Copy the code from this template and put it in an HTML file. Remove the text that says "your code goes here". That is where you will add JavaScript function calls that will set up your pages and the controls on those pages. |
|
Function summary |
FLIQ provides several functions to create pages and to set up controls within those pages. These functions are described in detail farther on in this document.
|
|
makePage |
makePage( pageName, imageURL )
This will create a new page that is known to FLIQ. You need to create a page before you can add controlls to that page.
Examples:
|
|
gotoPage |
gotoPage( pageName )
This instructs FLIQ to present a particular page and all of its controls. The page must have previously been created using makePage() and must already have all of its controls before gotoPage(). In your main script area (where the "your code goes here" was removed) the last thing after setting up pages and their controls should be a call to gotoPage() to tell FLIQ the first page to be displayed to the user. In simple prototypes, the only actions that controls perform is to go to other pages that display different sketches of what will happen when some item is selected.
Example:
|
|
clickRegion |
clickRegion( pageName, clickId, left, top, right, bottom, clickAction )
Click regions are the simplest form of control in FLIQ. A click region simply defines a rectangular area on a page image and associates a clickAction with that area. Whenever a user clicks or touches within that rectangular area, the clickAction is performed.
Example 1: Example 2:makePage("homePage","HomePage.png"); makePage("page1","FirstPage.png"); makePage("page2", "SecondPage.png"); clickRegion("homePage","gotoPage1",10,10,100,100, function() { gotoPage('page1'); } ); clickRegion("homePage","gotoPage2",10,110,100,210, function() { gotoPage('page2'); } ); makePage("homePage","HomePage.png"); makePage("page1","FirstPage.png"); makePage("page2", "SecondPage.png"); function gotoPage1() { gotoPage("page1"); } function gotoPage2() { gotoPage("page2"); } clickRegion("homePage","gotoPage1",10,10,100,100, gotoPage1); clickRegion("homePage","gotoPage2",10,110,100,210, gotoPage2); |
|
Region editor |
Click regions and all of the other controls are placed by their left,top,right, and bottom coordinates. Getting these coordinates correct for a particular background image can be a problem. For this region we created the FLIQClickableEditor. This web page will allow you to load a page image and give the page name. It will then allow you to draw rectangular areas on top of that image and will generate the JavaScript code for the various controls with the page name and rectangle bounds already filled in. The instructions are on the editor's web page. This will greatly simplify your construction of page controls.
FLIQClickableEditor |
|
Button |
button( pageName, buttonId, left, top, right, bottom, label, clickAction ) button( pageName, buttonId, left, top, right, bottom, label, clickAction, properties ) A button provides a more active object to click on than a passive click region. A button can change its shape, color or other appearance when the mouse passes over it and when it is clicked. This makes it appear much more interactive. A button can also have a label. A button is defined by three images: idleImage, rolloverImage and the activeImage. Defining these three images is how the button shows an active appearance. When there is no mouse activity on the button the idleImage is displayed. When the mouse is over the button, the rolloverImage is displayed. When the mouse button is pressed on the button then the activeImage is displayed. Each of these images is scaled to fit inside of the rectangle defined for your button. Buttons are not only defined by the parameters of the call, but there are also some properties that control the display of buttons. Putting all of the properties as parameters would make the button() function very unwieldly.
Button propertiesAs described above, much of the description of a button are in the properties. There is a global JavaScript variable called "buttonDefaults". Its declaration is shown below. var buttonDefaults = { idleImage:"DefaultIdle.png", rolloverImage:"DefaultRoll.png", activeImage:"DefaultActive.png", labelLeft:"10px", labelTop:"5px", textFont:"verdana", textColor:"black", textSize:"medium", textStyle:"normal", textWeight:"normal" }; One way to set properties for buttons is to change the values in "buttonDefaults". For example "buttonDefaults.textColor=red;" would change the color of the label to red. It would be common to change the idleImage, rolloverImage and activeImage to your own images to style buttons in your unique way. When button() is called it uses the values in "buttonDefaults" to set up the button. You can then change the defaults before the next button() call. A common thing to do is to set all of your style information into buttonDefaults and then repeatedly call button() at different locations with different labels and clickActions. This would give you a uniform styling throughout. Another way to set button properties is to provide your own properties object and pass it to button() as the last parameter. A properties object is declared exactly like you see for buttonDefaults. Suppose you have two styles for buttons: a normalButton, and a hotButton. These can be defined in two different variables and then when a button is created you pass the correct styling for that button. When you provide your own properties you don't need to define all of them. The button() function will use the buttonDefaults values for any properties that you don't define.
|
|
draggable |
draggable( pageName, draggableId, left, top, right, bottom, label, dropAction ) draggable( pageName, draggableId, left, top, right, bottom, label, dropAction, dragAction, properties ) The draggable control behaves very much like a button and uses all of the same properties. The big different is that the user can drag this button around the screen. This can be used to simulate a variety of interactive techniques to convey a feel of the user interface.
Examples: draggable("myPage","drag",10,10,100,40,"drag me", function() { alert("dragged"); }This example will create a button-like object called "drag" and will allow the user to drag it anywhere on the page. When the mouse goes up, the messages "dragged" will pop up as an alert. draggable("myPage","slider",10,10,40,40,"", function() { sliderStopped(getTop("slider")); }, function(id,mx,my) { setLeft("slider",10); // prevents the slider from moving horizontally if (getTop("slider")<10) setTop("slider",10); // prevents the slider from moving above 10 if (getTop("slider")>300) setTop("slider",300); // prevents the slider from moving below 300 }, { idleImage:"sliderIdle.jpg", rolloverImage:"sliderRoll.jpg", activeImage:"sliderActive.jpg" } );This example is more complex. When the draggable is dropped the function sliderStopped will be called. It is assumed that you have defined sliderStopped somewhere else in your javaScript code. Every time the object is moved the dragAction is called. In this example the dragAction function is using the location control functions to keep the slider on the same axis and withing bounds. This would be useful when using a draggable to simulate some kind of slider. |
|
textField |
textField( pageName, fieldId, left, top, right, bottom, hint, changeAction ) textField( pageName, fieldId, left, top, right, bottom, hint, changeAction, properties ) A textField control allows users to type a single line of text. This is useful for various type-in boxes or other forms kinds of interactions. The labels for your forms go in the page's background image, but this control allows you to perform actual interaction with the text.
The text field uses slightly different properties from button and draggable. The defaults for thes properties are defined in the textDefaults variable and are declared as follows: var textDefaults = { textFont:"verdana", textColor:"black", textSize:"medium", textStyle:"normal", textWeight:"normal" }; As with buttons and draggables these properties can be set before the call to textField(). These properties can also be declared in variables and supplied in the properties parameter.
There are two helper functions that can provide access to text field contents from outside of the field's change action. For example a page might provide two number fields and a destination field. When a button is pressed the button will get a number from each of the two number fields, convert them to floats using parseFloat(), add them together and then put them into the destination field. The two helper functions are: |
|
textArea |
textArea( pageName, areaId, left, top, right, bottom, hint, changeAction ) textArea( pageName, areaId, left, top, right, bottom, hint, changeAction, properties ) This functions exactly like textField() except that it allows multiple lines of text. This is for bigger comment and other large content text boxes. This automatically handles word wrapping and scrolling to handle any amount of text. The setText and getText functions operate on textAreas as well as textFields. |
|
Control Location |
getLeft(controlId) - This will return the left edge of the control with the specified id. This is in pixels. getTop(controlId) - This will return the top edge of the control with the specified id. This is in pixels. setLeft(controlId, newLeft) - This will change the left edge of the control with the specified id. newLeft is in pixels. The width of the control is unchanged. setTop(controlId, newTop) - This will change the top edge of the control with the specified id. newTopis in pixels. The height of the control is unchanged. |