Skip to main content

Posts

Showing posts with the label Flex

How to send variables from on SWF flex file to another SWF file Using Flex.

How to Communicate From one SWF Flex file to another SWF Flex File ? See the below example, This is loading external swf flex file into parent SWF File and sharing the data or variable from parent to child and child to parent. Parent.mxml CODE: 1: <?xml version="1.0" encoding="utf-8"?> 2: <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="100%" height="100%"> 3: <mx:Script> 4: <![CDATA[ 5: import mx.events.CloseEvent; 6: import mx.controls.SWFLoader; 7: import mx.managers.PopUpManager; 8: import mx.containers.TitleWindow; 9: import mx.controls.Alert; 10: 11: public var tw:SWFPlaceHolder; 12: 13: public function launchExternalSWF(title:String,swfFilePath:String):void{ 14: 15: /...

Use FilterFunction in Flex ArrayCollection

Here is the simple Flex ArrayCollection FilterFunction example to ignore blank records (name) form arrayCollection. var ac=new ArrayCollection(); ac.addItem({name:'abc'}); ac.addItem({name:'xyz'}); ac.addItem({name:''}); ac.addItem({name:'dac'}); // use of fillter function ac.filterFunction = function(item:*):Boolean{ return (StringUtill.trim(item.name)!=""); // } ac.refresh(); Now filtered ArrayCollection object use further code.

Creating Data Grid Using HTTP Service in Flex

Creating Data Grid Using HTTP Service in Flex & displaying data using XML in flex. <?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="XYZ" width="100%" height="100%"> <mx:datagrid x="10" y="10" width="10...

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); } }

How to use 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 }

Flex Banner Example

Simple Flex Fade in Fade out Banner Example CODE: 1: <?xml version="1.0" encoding="utf-8"?> 2: <mx:Application verticalScrollPolicy="off" verticalGap="0" horizontalGap="0" horizontalScrollPolicy="off" xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" paddingTop="0" paddingLeft="0" paddingRight="0" paddingBottom="0" verticalAlign="middle" backgroundColor="white" creationComplete="{init();}"> 3: <mx:Script> 4: <![CDATA[ 5: import mx.effects.WipeLeft; 6: import mx.events.TweenEvent; 7: import mx.controls.Alert; 8: import mx.events.EffectEvent; 9: import mx.effects.Fade; 10: import mx.effects.Pause; 11: import mx.effects.Sequence; 12: import mx.effects.SetPropertyAction; 13: import mx.effects.WipeRight; 14: private var fader:Sequence; 15: private ...

Dynamic ArrayCollection Using Flex

Creating Dynamic Array Collection 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); ArrayCollection filterfunction

Flex Interview Questions

1) What is Flex? Flex is used to devleop Rich Internet Application (RIA) You can both desktop & web based applicaiton.It is markup language and object-oriented languages its many syntax match with flash action script. Flex Developers use typically five distinct phases to develoep Rich Internet Application. Design Configure Build Deploy Secure 2) How do i get Page URL and Query String ? We can use mx.core.Application.application.url (mx.core)package to work with current page URL. & query string. 3) Describe flex component file types ? There are following file types we can use in flex. extension .mxml - a component implemented as an MXML file. extension .as - a component implemented as an ActionScript class. extension .swc - a SWC file contains components in a packge. 4) Difference between target & currentTarget ? target : This property is set by the dispatchEvent() method. You cannot change this to a different object. currentTarget : This property is set by component instan...

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.

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("?")...