Skip to main content

Posts

Dynamic Array Collection Using Flex

We can create dynamic Array Collection in flex using following code. var ob:Object; var n:String = "Name"; var a:String = "Address"; var ar:ArrayCollection = ""; ob = new Object(); ob[n] = "Ar"; ob[a] = "xyz, UK"; ar = new ArrayCollection(); ar.addItem(ob); It binds data into array just like. arrayCollection = [{Name:'Ar',Address:'xyz, UK'}]; setPropertyIsEnumerable() is use to hide ArrayCollection item. which we can use like. ar.setPropertyIsEnumerable("Name",true); After using above method we can hide array collection item.

Javascript Trim Function Problem

There is no function to trim string in javascript. We can use following user define function to trim string using javascript. Mainly we need three type of trim function which we use in program. Right Trim Javascript User Define function. function rightTrim(str) { return str.replace(/\str+$/,""); } Left Trim Javascript User Define function. function leftTrim(str) { return str.replace(/^\str+/,""); } Trim javascript function for both left and right side. function trim(str) { return str.replace(/^\str+|\str+$/g,""); }

Flex Cache Problem

There is very big problem in flex that's cache problem. When I was developing a Rich Internet application. I faced flex cache problem in Internet Explore & Firefox browser i was stuck badly. Then I wrote this code for avoiding flex cache problem & i think it works a bit. Well still working on it. I have added this code into index.template.html which is located into flex project html-template/index.template.html. <Script Language="javascript"> var url = location.href; var ots = parseInt(url.substring(url.indexOf("=")+1,url.length))+6000; var dt = new Date(); var n = dt.getTime(); if(url.indexOf("?timeStamp=")!=-1) { if(isNumber(ots) && ots!=""){ if(nts>ots){ location.href=url.substring(0,url.indexOf("?"))+"?timeStamp="+nts; } }else{ location.href=url.substring(0,url.indexOf("?"))+"?timeStamp="+newTimeStamp; } }else{ location.href=url.substring(0,url.indexOf("?")