This blog has been moved. This redirect you our new blog with all old posts..
Get Page URL in Flex
How do i get flex html page url & how can use query string ?
Above property return query string & url which we can use in flex code.
mx.core.Application.application.url
Above property return query string & url which we can use in flex code.
Dynamic Array Collection Using Flex
How to create Dynamic ArrayCollection Using Flex ?
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);
Cache problem in flex
How to avoid cache problem in flex? well guys i have tried it and i think it works. Put below script your main html file which contain swf file.
You can also put this script html-template/index.template.html. This will added automatically in you flex publish html file.
This script will generate a new query string for your application url in each refresh & which help to avoid cache problem.
You can also put this script html-template/index.template.html. This will added automatically in you flex publish html file.
< 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("?"))+"?timeStamp="+nts;
}
function isNumber(val)
{
var vc = "0123456789.";
var isNum=true;
var char;
for (i = 0; i < val.length && isNum == true; i++)
{
char = val.charAt(i);
if (vc.indexOf(char) == -1)
{
isNum = false;
}
}
return isNum;
}
</Script>
This script will generate a new query string for your application url in each refresh & which help to avoid cache problem.
How to use Color Picker in flex
<mx:application mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:panel x="80" y="30" width="352" height="200" layout="absolute">
<mx:colorpicker x="74" y="34" width="121">
</mx:colorpicker>
</mx:panel>
</mx:application>
How to us Accordion window in Flex
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Panel x="119" y="63" width="382" height="268" layout="absolute" title="Accordion select">
<mx:HBox width="100%" height="100%" id="hbox6">
<mx:Accordion width="100%" height="100%">
<mx:Canvas width="100%" label="Accordion 1">
</mx:Canvas>
<mx:Canvas width="100%" label="Accordion 2">
</mx:Canvas>
<mx:Canvas width="100%" label="Accordion 3">
</mx:Canvas>
<mx:Canvas width="100%" label="Accordion 4">
</mx:Canvas>
</mx:Accordion>
</mx:HBox>
</mx:Panel>
</mx:Application>
Read Mulitiple selected item of List Box Using Flex
How to read multiple selection list box in flex?
<mx:List allowMultipleSelection="true"
id="searchResult" width="100%"
height="100"
verticalScrollPolicy="on"
click="filter">
<mx:dataProvider>
<mx:Object label="Schmidt, Frank" value="1"/>
<mx:Object label="Schmidt, Peter" value="2"/>
</mx:dataProvider>
</mx:List>
function filter():void{
var str:String="";
for each(var ob:Object in searchResult.selectedItems){
str+=(str=="")?ob.value.toString():","+ob.value.toString();
i++;
}
trace(str); // this will return you indexs of list box
}
How to display Image In Flex
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Image x="102" y="123" width="100%" height="100%">
<mx:source>file:///C|/Winter.jpg>/mx:source>
</mx:Image>
</mx:Application>
Using Date Feild in Flex.
How to use Date Feild in flex ?
<mx:application mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:datefield x="25" y="68" width="217" height="40">
</mx:datefield>
</mx:application>
Drawing Line and arrow using flex
How to drawing line with arrow in flex?
public function addPoint(sX:int,sY:int,eX:int,eY:int,
createArrow:Boolean):void
{
var g:Graphics =this.graphics;
g.lineStyle(1, 0xff0000, 1);
g.moveTo(sX, sY);
g.lineTo(eX, eY);
if(createArrow){// drawing arrow
g.lineStyle(6, 0x0000ff, 1);
g.moveTo(Math.round(eX+((sX-eX)/6)),
Math.round(eY+((sY-eY)/6))); // mid point
g.lineTo(eX, eY);
g.lineStyle(3, 0x00ff00, 1);
g.moveTo(Math.round(eX+((sX-eX)/6)),
Math.round(eY+((sY-eY)/6))); // mid point
g.lineTo(eX, eY);
}
}
Find dynamic instance of an Object using flex
How to find component list in a Canvas/Panel
var uDC:UserDefineComponent;
for each(var ob:Object in application.getChildren()){
if(ob.toString().indexOf("uDC")>0){ // object name
var o:UserDefineComponent = Object(ob.valueOf())
as UserDefineComponent;
/*
Here You can use properties of
UserDefineComponent.
trace(o.xPos);
*/
}
}
Creating Data grid Using flex
Data Grid in Flex.
<mx:application mx="http://www.adobe.com/2006/mxml">
<mx:script>
<!--[CDATA[ import mx.collections.ArrayCollection; [Bindable]-->
</mx:script>
<mx:panel paddingtop="10" paddingbottom="10" paddingleft="10"
paddingright="10">
<mx:datagrid id="dataGrid" dataprovider="{DGrid}" width="100%"
editable="true">
<mx:columns>
<mx:datagridcolumn datafield="Artist" resizable="true">
<mx:datagridcolumn datafield="Album" resizable="true">
<mx:datagridcolumn datafield="Price" resizable="true">
</mx:datagridcolumn>
</mx:datagridcolumn>
</mx:datagridcolumn>
</mx:columns></mx:datagrid></mx:panel></mx:application>
Using combo box in flex
How to use combo box in flex?
<mx:application mx="http://www.adobe.com/2006/mxml"
layout="absolute">
<mx:vbox width="400" height="300">
<mx:panel title="Select Combo Box" paddingtop="50"
paddingbottom="100"
paddingleft="50" paddingright="100">
<mx:combobox id="comBox">
<mx:dataprovider>
<mx:string>AB</mx:string>
<mx:string>CD</mx:string>
<mx:string>EF</mx:string>
<mx:string>Efd</mx:string>
<mx:string>gd</mx:string>
<mx:string>gfd</mx:string>
<mx:string>bjdfgF</mx:string>
</mx:dataprovider>
</mx:combobox>
<mx:textinput id="textInput"
text="{comBox.selectedItem}">
</mx:textinput>
</mx:panel>
</mx:vbox></mx:application>
Creating Data Grid Using HTTP Service in Flex
Creating Data Grid Using HTTP Service in Flex & displaying data using XML in flex.
This Data Grid Example will display above xml data in grid.
<?xml version='1.0' />
<Data>
<ID>1</ID>
<Name>Vineet</Name>
</Data>
<Data>
<ID>2</ID>
<Name>Abhishek</Name>
</Data>
This Data Grid Example will display above xml data in grid.
<mx:application mx="http://www.adobe.com/2006/mxml"
layout="absolute"
creationcomplete="init()">
<mx:httpservice id="xmlFile" url="http://localhost/***/***/project.php" result="getXML(event)" resultformat="e4x" />
<mx:script>
<!--[CDATA[
import mx.rpc.events.ResultEvent;
[Bindable]
-->
</mx:script>
<mx:panel x="10" y="10" width="100%" height="100%">
<mx:canvas label="Mash Frame" width="100%" height="100%">
<mx:datagrid x="10" y="10" width="100%" height="100%" dataprovider="{xmlHandler}">
<mx:columns>
<mx:datagridcolumn width="82" headertext="ID" datafield="ID">
<mx:datagridcolumn headertext="name" datafield="Name">
</mx:datagridcolumn>
</mx:datagridcolumn>
</mx:columns>
</mx:datagrid>
</mx:canvas>
</mx:panel>
</mx:application>
Say Hello World In Flex..
This is the Hello world example in flex.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
creationComplete="init();"
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
public function init():void{
Alert.show("Hello World..");
}
]]>
</mx:Script>
</mx:Application>
Subscribe to:
Posts (Atom)