As we know that used for remote server application. But in case we have local XML file then how we can fetch recored from XML using 1. First create new project in Adobe Flex Builder 3. File -> New -> Flext Project give some name (say Binod_ShareTrading) and click on Finish. 2. Paste you local XML into src folder (say addressbookdata.xml)
3. Right click on Binod_ShareTrading project and click on properties -> Flex Compiler and come to Additional compiler arguments: and put this info -locale en_US -use-network=false and click on Apply and OK. Now it will inform to httpserice that do not look on internet for the given XML file.
4. Now start your code in Binod_ShareTrading.mxml (May be different in your case)
<mx:Script> <![CDATA[ import mx.collections.ArrayCollection; import mx.controls.Alert; import mx.events.ValidationResultEvent; import mx.rpc.xml.SimpleXMLDecoder; import mx.collections.ArrayCollection; import mx.rpc.events.ResultEvent; import mx.effects.easing.*; [Bindable] public var allEmp:ArrayCollection; public var checked:Boolean=false; private function addBlurFilter():void { var bf:BlurFilter = new BlurFilter(0,0,0); var myFilters:Array = new Array(); myFilters.push(bf); Login_lbl.filters = myFilters; Pass_lbl.filters = myFilters; Button_Login.filters = myFilters; loginPanel.filters = myFilters; } public function checkUserAndPassword(name:String,pass:String):Boolean{ for(var i:int=0;i<allEmp.length;i++){ var un:String = allEmp[i].userName; var ps:String = allEmp[i].password; if((name==un)&&(pass==ps)){ //Alert.show("Name :: "+name+" username in database "+un); //Alert.show("Pass :: "+pass+" in database :: "+ps); checked=true; } } return checked; } public function validate():void{ if (loginValidator.validate().type == ValidationResultEvent.VALID){ if (passwordValidator.validate().type == ValidationResultEvent.VALID){ myservice.send(); } else{ Alert.show("Password can not be blank"); } } else{ Alert.show("Login ID can not be blank"); } } public function myfun(event:ResultEvent):void{ allEmp = event.result.contacts.contact; var check:Boolean = checkUserAndPassword(Login_tx.text,Pass_Tx.text); // Alert.show("Check value :: "+check); if(check) Alert.show("Welcome Mr. "+Login_tx.text); else Alert.show("CHECK USER NAME OR PASSWORD"); } //mylabel2.setStyle("showEffect", rotate); //mylabel2.setStyle("hideEffect", fade); public function showuser():void{ if (mygrid.visible==true){ mygrid.visible=false; showAllUser.label="Show All User"; } else{ mygrid.visible=true; showAllUser.label="Hide the user Details"; } } private function init():void { fx.play([loginPanel,Login_lbl]); //Alert.show("INIT METHOD IS CALLING"); mygrid.setStyle("showEffect", rotate); mygrid.setStyle("hideEffect", fadeOut); } </mx:Script> <mx:Fade id="fade"/> <mx:Fade id="fx" alphaFrom="0" alphaTo="1" duration="5000" /> <mx:Fade id="dLinkFadeIn" alphaTo="1.0" alphaFrom="0" duration="100"/> <mx:Fade id="dLinkFadeOut" alphaTo="0.0" alphaFrom="1.0" duration="100"/> <mx:Fade id="fadeOut" duration="1000" alphaFrom="1.0" alphaTo="0.0"/> <mx:Fade id="fadeIn" duration="1000" alphaFrom="0.0" alphaTo="1.0"/>
Devoted to Java for more than 14 years. My expertise, hobby and daily life work as Java, Spring, SOA, BigData, Machine Learning, Data Analytics, Deep Learning Engineer.
Other play ares includes :
IoT Specialist, R Programming, Spark, AWS, Azure, Docker, CDH.
Really it is very useful for my project
ReplyDeletea bit confusing how you have formatted the sourcecode :(
ReplyDeleteNow I have re formatted the code. Hope you will not get confusion again. :)
ReplyDelete