Parallax Effect (3D background in the project)


Use the script from example to make a Parallax Effect for your projects background.
Background Image should be bigger than the base page

Parallax_Effect.irpz

Custom Password in GUI for secured Page

If you want to create custom "edit box" item to secure access to some page of GUI,

you can use this script (see attachment, script is in the "JS" tab in GUI Editor)


Lists and Single/Double Tap on list item distinguishing

Hi everybody, 


I decided to write this post as I haven't found any clear solutions for the tasks I met. Writing a driver for Autonomic Mirage Media Server (MMS) I faced the necessity to provide a good way for the user to manage content of the media server so that the user could find and select the media to include into 'now playing' list. Imagine the following situation. A user wants to find a content to play by genre. I want to show on the popup both the list of genres as well as the list of albums related to the selected genre. Once the user choose a specific album, I want to show both the list of albums, related to the selected genre, as well as the list of songs within the selected album. Of course there are a number of ways how to organize that but I didn't want to have a mess of popups and I wanted the user to clearly understand the 'chain'. 

Thus I decided to do the following. A created a popup with a static list of 'list' popups. At once only two 'list' popups are visible. Once the user chooses the item in the left list within the 'list' popup, I scroll the static list so that the right 'list' popup becomes the left one and the third 'list' popup becomes visible... I didn't use the practice to populate a single list with different data as in a real life so called 'list popups' will have completely different layout.        


One more thing to be mentioned: I wanted to distinguish a single tap on the list item from a double tap and do different things. For instance I wanted to show special popup on the double tap on the item so that the user could choose whether to play the album/song immediately or just add it to the playlist.


In the attached project there are both technics are shown. Probably there is an easier way to do the same or I reinvented the wheel...


Vladimir Makarov


NestedLists.irpz

List Item Example project for Iridium V2.0

Q:
Is their an good Example out their showing the function of the "List Item". 
I found the example project under the Wiki page. But all comments are in Russian and the project does not have a function that you can actually press on the list items and some action will be executed.
 It would be nice if anyone has a good working example.

A:
Please try this project.

ListTest__2_.irpz

Custom Slider for the Level Item

In iRidium 2.1 you can use a slider from the ready list, available for each Level item. But if want to see your own slider on the Level to make it unique, please see this method.
Download the project from attachment. Here you can see the Level items, Slider items and Script file in [JS] window.  This script connects the Level with the separated Slider.
Using instances of the script you can make one, two or more Levels with unique Sliders.
alternate slider.irpz

3 state button

Need:
- item type = Level, name = Item 1
- item type =  Button, name = Item 2
- script 

1. For Item 1, create 3 states and changes property:

Feedback =  Channel
Min: 0
Max: 2


2. Item 2, for all state change property color alpha channel = 0;


3. open script editor (JS button)

4. create script

IR.AddListener(IR.EVENT_ITEM_RELEASE, IR.GetItem("Page 1").GetItem("Item 2"), function(){
   var item =  IR.GetItem("Page 1").GetItem("Item 1");
   item.Value = (item.Value + 1) % 3;      

   switch( item.Value )
   {
     case 0:
     // Commands
     break;

     case 1:
     // Commands
     break;

     case 2:
     // Commands
     break;
    }
});

3State_Buttons_2.irpz

Javascript Tutorials

Hi 

There 6 hours of tutorials going over the basics of Javascript.  Keep in mind that in some cases they will explain syntax which is unique to using Javascript in a browser.

https://www.youtube.com/playlist?feature=edit_ok&list=PLGJDCzBP5j3xKdHn-RYHvk3uafZSN0eYV">https://www.youtube.com/playlist?feature=edit_ok&list=PLGJDCzBP5j3xKdHn-RYHvk3uafZSN0eYV

thanks,


Roger

Rotate letters for language Hebrew


function RotateText(){
   for(var j = 2; j < IR.PagesCount; j++)
      for(var i = 0; i < IR.GetPage(j).ItemsCount; i++)
      {  
         var string = IR.GetPage(j).GetItem(i).GetState(0).Text;
         if(string.charCodeAt(0) > 122){     
            IR.GetPage(j).GetItem(i).GetState(0).Text = "";
            for(var k = string.length; k >= 0; k--){
                IR.GetPage(j).GetItem(i).Text += string.charAt(k);
    
            }     
          }    
      }
   for(var j = 0; j < IR.PopupsCount; j++)
      for(var i = 0; i < IR.GetPopup(j).ItemsCount; i++)
      {  
         var string = IR.GetPopup(j).GetItem(i).GetState(0).Text;
         if(string.charCodeAt(0) > 122){
            IR.GetPopup(j).GetItem(i).GetState(0).Text = "";
            for(var k = string.length; k >= 0; k--){
                IR.GetPopup(j).GetItem(i).Text += string.charAt(k); 
            }  
          }       
      }
}
IR.AddListener(IR.EVENT_START,0,RotateText);

RotateText.irpz

Change a text at Item when Level moves

This example shows you how to change some parameter of the graphic item in your GUI.

We change a text field of the item from the word to the real value received from equipment and back. It is possible using tags of graphic item.


ChangeText-when-lvl-moves.irpz

Open the popup when maximizing the app

If you want to open some default page or popup each time when maximizing the iRidium app, use the example attached


Background-Foreground_mode_iOS.irpz

Color relation

Q:
I use a color picker to fill a global token. But if I use the editor to create a relation it doesn't work.

Imagehttp://farm9.staticflickr.com/8123/8659810061_9308ffd90e_z.jpg">

If I use Javascript using the following line:
IR.GetItem("Main").GetItem("Item 1").GetState(0).FillColor = IR.GetVariable("Tokens.BannerColor");
It DOES work. But it would be nice if i could use the first option

A:
This  fixed! Please try project!




ColorTest__1_.irpz

EVENT_ITEM_CHANGE not send text value

Q:
I have a project with:
 - 1 Page with name "Eventi"
 - 4 EditBox with name in page
 - 1 Sound with name "beep.wav"

I need play a sound when text property of one item change and text is "1".
I write in JS this code


var Eventi;

IR.AddListener(IR.EVENT_START, 0, function()
{
   Eventi = new Alarm();    
});

function Alarm()
{
   var ItemList = ["Item 4","Item 1","Item 2","Item 3"];
   var Page = IR.GetItem("Eventi");
   
   for(i=0;i<ItemList.length;i++)
   {
      IR.Log("Generazione evento item "+ItemList[i]);
      IR.AddListener(IR.EVENT_ITEM_CHANGE, Page.GetItem(ItemList[i]),function (text)
      {
            if(text = "1")
            {
               IR.PlaySound('Alarm.mp3');   
            }
      });
   } 
};


I run this code with some Log istruction and i see that when i change text on the object, the variable "text" in JS is always "undefined".

This is a bug or I wrong something?

A:
Please try this project.

FullAccessDataItemforListener.irpz

Image size changing

Q:

When I have an javascript with:
IR.GetItem("Page 1").GetItem("Button").GetState(0).Image = "pict.jpg"; 
It ads an image to the button.
When I ad:
IR.GetItem("Page 1").GetItem("Button").Width = 500;
IR.GetItem("Page 1").GetItem("Button").Height = 100;
It changes the button size, but not the image size.
How can I change the image size in the javascript? 

A:
You can not change image size with script, but you can change image size with item property "image stetch" = propoptional (or full size).  if property image stetch = prooportional (or full size) then image auto change size after set.
 
 
how change property image stretch? select item, open object properties panel, select tab states and find this property.

Recommended Reading for the Scripts

http://www.w3schools.com/js/default.asp" style="font-size: medium;">http://www.w3schools.com/js/default.asp

The following topics are useful for iRidium Script:
JS Statements JS Comments JS Variables JS Data Types JS Objects JS Functions JS Operators JS Comparisons JS Conditions JS Switch JS Loop For JS Loop While JS Breaks JS Errors JS Validation JS Object JS Number JS String JS Date JS Array JS Boolean JS Math JS RegExp 

You don't need to read the sections JS Libraries, JS HTML DOM, JS Windows; because these are specific topics for using javascript for an web browser.

For JSON take a look at:
http://www.w3schools.com/json/default.asp">http://www.w3schools.com/json/default.asp

Block the button for a while after pressing it

Q:
This is to be used for example when actuating a garage door and the magnetic contact is down. How can the user be sure that he pressed the button if the feedback is connected to this switch placed at end of run of the door? Does the functionality exist? What does it means "holding time"?

A:
You can use item property Enable with script, when pressing to Item Enable = 0 and command Send. 
When receive Feedback then Enable = 1;

Or you use full screen Popup Show when pressing  to Item and when receive Feedback then Hide full screen Popup


Holding Time is item property, is time interval of start event pressing to activate event Hold.

screensaver

Q:
In the last mailing from Iridiummobile, when version 2.0.7 was released, there was an item about screensavers.
See image below.
How can I create an analog clock as an screensaver?

A:
You can read how create analog clock an create this
http://www.iridiummobile.net/blog/how-to-create-analogue-clocks-in-iridium-gui-editor">http://www.iridiummobile.net/blog/how-to-create-analogue-clocks-in-iridium-gui-editor

or you can use ready project in gallery iRidium Samples / Screensavers

screensaver.jpg

Create project tokens

Q:
Is it possible to create project tokens with Javascript?
I couldn't find any information about it.

A:
if project token TokenName, not created in project, then script command

IR.SetVariable("Global.TokenName", Value) - will create this token

Selected Item info

Q:
I don't know if it's already possible but I couldn't found it.
What I would like to see is that when I press on an item that the program knows what item is pressed.

I would like to use something like this:

IR.AddListener(IR.EVENT_ITEM_PRESS,IR.GetItem("Page 1").GetItem("Item 1"),function(this)
{  
  IR.Log(this.Text);
});
I know I could use: 'IR.GetItem("Page 1").GetItem("Item 1").Text'

But it would increase the programming speed and flexibility of the program if you ask me.
I think it would be nice if the program automatically knows whatis happening and we're able to use that during programming.

A:
thank you for your idea! I have transferred it to iRidium programmers.  At the moment for increasing the speed of script writing you can use this: 

var Item = IR.GetItem("Page 1").GetItem("Item 1"); 

IR.AddListener(IR.EVENT_ITEM_PRESS, Item ,function()  
{    
  IR.Log(Item.Text);  
});

Great guide to object oriented javascript. ))- advanced users

Hi,

This is for the advanced scripters.  Watch the video on this site.
thanks,

Roger


Object Playground: The Definitive Guide to Object-Oriented JavaScript

An excellent (and definitive), illustrated guide to JavaScript objects.

How do I call Execute from JS

Q:
 How do I call Execute from JS?!

A:
you can use: http://wiki2.iridiummobile.net/index.php/Systems_API#IR.Execute">http://wiki2.iridiummobile.net/index.php/Systems_API#IR.Execute



Сервис поддержки клиентов работает на платформе UserEcho