This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| trace(formatNum(1000)); | |
| trace(formatNum(10000000)); | |
| trace(formatNum(1000000.39485)); | |
| function formatNum(num:Number):String { | |
| var newStr:String = ""; | |
| var str:String = num.toString(); | |
| var parts:Array = str.split("."); | |
| str = parts[0]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var someString:String = "_file"; | |
| trace(someString.substr(1)); | |
| /* | |
| ouptuts: | |
| file | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var phoneField:TextField = new TextField(); | |
| with (phoneField) { | |
| type=TextFieldType.INPUT; | |
| maxChars=12; | |
| restrict="0-9"; | |
| border=true; | |
| width=100; | |
| height=20; | |
| x=y=20; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Please add blackberry.system and blackberry.system.event feature IDs to config.xml | |
| if (!blackberry.system.hasDataCoverage()) { | |
| alert("This app requires access to internet for the content to work. Please turn on Wifi and restart this application"); | |
| } | |
| else{ | |
| alert('Winning'); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| http://devblog.blackberry.com/2012/06/internationalizing-webworks-app/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Original Source: http://stackoverflow.com/questions/1960473/unique-values-in-an-array | |
| // 1. Variation 1 | |
| var a = [1,5,1,6,4,5,2,5,4,3,1,2,6,6,3,3,2,4]; | |
| // note: jQuery's filter params are opposite of javascript's native implementation :( | |
| var unique = $.makeArray($(a).filter(function(i,itm){ | |
| // note: 'index', not 'indexOf' | |
| return i == $(a).index(itm); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Page { | |
| content: Container { | |
| SegmentedControl { | |
| Option { id: option1; text: "Container1"; value: "option1"; selected: true } | |
| Option { id: option2; text: "Container2"; value: "option2" } | |
| onSelectedIndexChanged: { | |
| if (selectedIndex == 0) { | |
| cnt2.visible = false; | |
| cnt1.visible = true; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import bb.cascades 1.0 | |
| Page { | |
| content: Container { | |
| Label { | |
| id: emailLabel | |
| text: qsTr("Email") | |
| } | |
| Label { | |
| id: urlLabel |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function add1(array, val, n) { | |
| var iter = 0, | |
| end = array.length, | |
| count = (n) ? n : -1, | |
| multiple = 1; | |
| if(n < 0) { | |
| iter = array.length - 1; | |
| end = 0; | |
| multiple = -1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Container { | |
| id: rootContainer | |
| background: back.imagePaint | |
| attachedObjects: [ | |
| ImagePaintDefinition { | |
| id: back | |
| repeatPattern: RepeatPattern.XY | |
| imageSource: "asset:///container/tiled/core16x16" | |
| } | |
| ] |