|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
[flex_india:26301] Have to reload/refresh for displaying from external dataHello, I have a problem synchronising external data loading and drawing graph as per external data. I have to display 12 concentric rings(each representing a sun sign"Rashi"). I take the order of rings from xml file. I have to plot users as dots on the respective sunsign rings. The problem is, I get a blank page without rings and all. But when I randomly click on the blank canvas, the mose-click events meant for displaying the user(dot) profile data from xml file get fired and I can see the users' data. I am trying to play with the initialize/creationComplete and applicationComplete for getting the desired output. I have set startup ()(which calls httpservice.send) in the initialize and create()(which reads xml data and draws circles and nodes in the httpservice's xmlresult success event. I am not sure of how to go about. In IE, because of cache, when I reload my page, the circles get displayed. But not in Firefox. Pasting the code below:- <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="711" height="600" backgroundColor="#FFFFFF" horizontalScrollPolicy="off" verticalScrollPolicy="off" initialize = "startup()"> <mx:VRule x="588" y="24" width="0" height="600" /> <mx:Canvas x="0" y="0" width="711" height="600" id="cnv1" backgroundColor="#FFFFFF" borderStyle="none" horizontalScrollPolicy="off" verticalScrollPolicy="off"> <mx:VRule x="511" y="0" width="8" height="600"/> <mx:Image x="564" y="27" id="img1" scaleContent="true"/> <mx:Label x="529" y="260" text="Favourite Movies:" width="112" id="lblMovies" fontFamily="Verdana"/> <mx:Label x="529" y="388" text="Favourite Music:" width="112" id="lblMusic"/> <mx:Label x="529" y="499" text="Favourite Books:" id="lblBooks"/> <mx:TextArea x="533" y="124" width="168" id="txtStatus" height="53" wordWrap="true" verticalScrollPolicy="auto" verticalScrollPosition="0" editable="false" borderStyle="none"/> <mx:TextArea x="527" y="282" height="101" id="txtMovies" editable="false" enabled="true" borderStyle="none" width="160"/> <mx:TextArea x="529" y="408" height="89" id="txtMusic" wordWrap="true" editable="false" borderStyle="none" width="158"/> <mx:TextArea x="529" y="516" height="83" id="txtBooks" wordWrap="true" editable="false" borderStyle="none" width="158"/> <mx:Label x="527" y="221" text="Birthday:" height="25" width="101" id="lblBday"/> <mx:Label x="582" y="220" width="98" id="txtBday" height="25" alpha="0.0"/> <mx:Label x="528" y="195" text="Name:" id="lblName"/> <mx:Label x="572" y="197" id="txtName" width="124" height="18"/> </mx:Canvas> <mx:Script> <![CDATA[ import mx.rpc.events.ResultEvent; import mx.rpc.events.FaultEvent; // import flash.display.LoaderInfo; import flash.display.MovieClip; import flash.display.Sprite; import flash.events.Event; import flash.events.MouseEvent; // import flash.net.URLLoader; // import flash.net.URLRequest; import flash.text.TextField; import mx.core.UIComponent; public var rashiObjectsArray:Array; public var rashiRingsArray:Array; import mx.controls.Alert; import mx.rpc.events.FaultEvent; import mx.rpc.events.ResultEvent; [Bindable] private var myXML:XML; internal var isLoaded:Boolean = false; internal var myFormat:TextFormat = new TextFormat(); public function deg2rad(deg:Number):Number { return deg*Math.PI/180; } public function clearControls():void { // img1.unloadAndStop(); txtStatus.text = ""; txtBday.text=""; txtMovies.text =""; txtMusic.text = ""; txtBooks.text =""; txtName.text=""; } public function initControls():void { myFormat.font = "Verdana"; myFormat.font = "12px"; myFormat.bold; lblBday.visible = false; lblMovies.visible = false; lblMusic.visible = false; lblBooks.visible = false; lblName.visible = false; cnv1.visible = true; } public function onOver(event:MouseEvent):void { var txt:TextField = (event.target as TextField); txt.setTextFormat(myFormat); var value:int = parseInt(txt.name); var rindex:int = value / 1000; var dindex:int = value % 1000; var rashi:RashiObject = rashiObjectsArray[rindex]; var userobj:UserObject = rashi.rusers[dindex]; txt.text = userobj.getUname(); txt.autoSize = "left"; } public function onClick(event:MouseEvent):void { clearControls(); var txt:TextField = (event.target as TextField); var value:int = parseInt(txt.name); var rindex:int = value / 1000; var dindex:int = value % 1000; var rashi:RashiObject = rashiObjectsArray[rindex]; var userobj:UserObject = rashi.rusers[dindex]; txt.text = userobj.getUname(); txt.autoSize = "left"; img1.source = userobj.getPic(); if(userobj.getStatus()=="NA") txtStatus.visible = false; else { txtStatus.text = userobj.getStatus(); txtStatus.visible = true; } txtName.text = userobj.getUname(); lblName.visible = true; txtBday.text = userobj.getBdate(); lblBday.visible = true; if(userobj.getMovies()=="NA") { txtMovies.visible = false; lblMovies.visible = false; } else { txtMovies.text = userobj.getMovies(); txtMovies.visible = true; lblMovies.visible = true; } if(userobj.getMusic()=="NA"){ txtMusic.visible = false; lblMusic.visible = false; } else { txtMusic.text = userobj.getMusic(); txtMusic.visible = true; lblMusic.visible = true; } if(userobj.getBooks()=="NA"){ txtBooks.visible = false; lblBooks.visible = false; } else { txtBooks.text = userobj.getBooks(); txtBooks.visible = true; lblBooks.visible = true; } } public function onOut(event:MouseEvent):void { var txt:TextField = (event.target as TextField); txt.text = ""; } private function convertDate(bdate:String):String { var finalString:String =""; var mon:String=""; if(bdate !="") { var tokens:Array = bdate.split("/"); switch(tokens[0]) { case 01: { mon = "January"; break; } case 02: { mon = "February"; break; } case 03: { mon = "March"; break; } case 04: { mon = "April"; break; } case 05: { mon = "May"; break; } case 06: { mon = "June"; break; } case 07: { mon = "July"; break; } case 08: { mon = "August"; break; } case 09: { mon = "September"; break; } case 10: { mon = "October"; break; } case 11: { mon = "November"; break; } case 12: { mon = "December"; break; } } if(tokens.length == 3) finalString = tokens[1]+" "+mon+" "+tokens[2]; else if(tokens.length==2) finalString = tokens[1]+" "+mon; } else finalString = "NA"; return finalString; } public function create():void { var borderColor:uint = 0x666666; var borderSize:uint = 2; var xCoord:int = 240; //original:-250 var yCoord:int = 300; //original:-200 var radius:int = 18; var r:int = radius; rashiRingsArray = new Array(); rashiObjectsArray = new Array(); // var rashiCount:int = myXML.rashi.length(); //2. Create 12 rashi circles. for (var i:int = 0; i < 11; i++) { //Big Circle. var circle1:Sprite = new Sprite(); //Push rashi circle in the cirle array. rashiRingsArray.push(circle1); // circle1.graphics.lineStyle(borderSize, myXML.rashi[i].color); circle1.graphics.lineStyle(borderSize, 0xFF0000); circle1.graphics.drawCircle(xCoord, yCoord, r); var shift:int = i * 90; //At the same time create a rashi object nd push in object array. var rashiobj:RashiObject = new RashiObject(myXML.rashi[i].rid , myXML.rashi[i].rname, myXML.rashi[i].trait, myXML.rashi[i].count); rashiObjectsArray.push(rashiobj); //Get count of users for the rashi. var userCount:int = myXML.rashi[i].users.length(); // trace(myXML.rashi[i].count); if (myXML.rashi[i].users.length() > 0) { //Initialize angle. var angle:int = shift; var angleDelta:Number = deg2rad(360 / myXML.rashi[i].count); for (var j:int = 0; j < myXML.rashi[i].count; j++) { //Add the user to rashiobject array. // var str:String = convertDate(myXML.rashi[i].users.user [j].bday); var str:String = myXML.rashi[i].users.user[j].bday; var userObject:UserObject = new UserObject(myXML.rashi [i].users.user[j].uid, myXML.rashi[i].users.user[j].uname,myXML.rashi [i].users.user[j].upic,myXML.rashi[i].users.user[j].umovies,myXML.rashi [i].users.user[j].umusic,myXML.rashi[i].users.user [j].ubooks,myXML.rashi[i].users.user[j].usite,myXML.rashi[i].users.user [j].status,str); //trace(rashiObjectsArray[i].getRname()); rashiObjectsArray[i].addUser(userObject); //Draw smaller circle simulating a dot. var dot:Sprite = new Sprite(); dot.name = (i*1000+j).toString(); dot.graphics.beginFill(0xFF0000); // dot.graphics.beginFill(myXML.rashi[i].color); dot.buttonMode = false; //Set the x and y co-ordinates. angle += angleDelta; var b:Number = r*Math.cos(angle); var h:Number = r * Math.sin(angle); var imageLoader:MovieClip = new MovieClip(); var txt:TextField = new TextField(); txt.setTextFormat(myFormat); txt.name = (i*1000+j).toString(); txt.visible = true; txt.width = 100; txt.height = 18; txt.text = ""; txt.x = xCoord+b-1; txt.y = yCoord + h ; txt.addEventListener(MouseEvent.MOUSE_OVER, onOver); txt.addEventListener(MouseEvent.CLICK, onClick); txt.addEventListener(MouseEvent.MOUSE_OUT, onOut); dot.addChildAt(txt,0); dot.graphics.drawCircle(xCoord + b, yCoord + h, 5); circle1.addChildAt(dot, j); } } cnv1.rawChildren.addChildAt(circle1, i); cnv1.setVisible(true); r = r + 20; } } private function xmlResultFailure( event:FaultEvent ):void { Alert.show( event.fault.message, "Error loading XML" ); } private function xmlResultSuccess( event:ResultEvent ):void { myXML = event.result as XML; isLoaded = true; create(); } public function startup():void { initControls(); //1. Import XML data. myService.clearResult(true); myService.send(); } ]]> </mx:Script> <mx:HTTPService id="myService" url="http://www.udayjoshi.com/ rashi.xml" showBusyCursor="true" result="xmlResultSuccess( event )" resultFormat="e4x" fault="xmlResultFailure( event ); " /> </mx:Application> Thanks. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to flex_india@... To unsubscribe from this group, send email to flex_india+unsubscribe@... For more options, visit this group at http://groups.google.com/group/flex_india?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
[flex_india:26303] Re: Have to reload/refresh for displaying from external dataHi,
In the following code you can try the following: public function create():void { var borderColor:uint = 0x666666; var borderSize:uint = 2; var xCoord:int = 240; //original:-250 var yCoord:int = 300; //original:-200 var radius:int = 18; var r:int = radius; rashiRingsArray = new Array(); rashiObjectsArray = new Array(); // var rashiCount:int = myXML.rashi.length(); //2. Create 12 rashi circles. for (var i:int = 0; i < 11; i++) { //Big Circle. var circle1:Sprite = new Sprite(); //Push rashi circle in the cirle array. rashiRingsArray.push(circle1); // circle1.graphics.lineStyle( borderSize, myXML.rashi[i].color); circle1.graphics.lineStyle(borderSize, 0xFF0000); circle1.graphics.drawCircle(xCoord, yCoord, r); var shift:int = i * 90; //At the same time create a rashi object nd push in object array. var rashiobj:RashiObject = new RashiObject(myXML.rashi[i].rid , myXML.rashi[i].rname, myXML.rashi[i].trait, myXML.rashi[i].count); rashiObjectsArray.push(rashiobj); //Get count of users for the rashi. var userCount:int = myXML.rashi[i].users.length(); // trace(myXML.rashi[i].count); if (myXML.rashi[i].users.length() > 0) { //Initialize angle. var angle:int = shift; var angleDelta:Number = deg2rad(360 / myXML.rashi[i].count); for (var j:int = 0; j < myXML.rashi[i].count; j++) { //Add the user to rashiobject array. // var str:String = convertDate(myXML.rashi[i].users.user [j].bday); var str:String = myXML.rashi[i].users.user[j].bday; var userObject:UserObject = new UserObject(myXML.rashi [i].users.user[j].uid, myXML.rashi[i].users.user[j].uname,myXML.rashi [i].users.user[j].upic,myXML.rashi[i].users.user[j].umovies,myXML.rashi [i].users.user[j].umusic,myXML.rashi[i].users.user [j].ubooks,myXML.rashi[i].users.user[j].usite,myXML.rashi[i].users.user [j].status,str); //trace(rashiObjectsArray[i].getRname()); rashiObjectsArray[i].addUser(userObject); //Draw smaller circle simulating a dot. var dot:Sprite = new Sprite(); dot.name = (i*1000+j).toString(); dot.graphics.beginFill(0xFF0000); // dot.graphics.beginFill(myXML.rashi[i].color); dot.buttonMode = false; //Set the x and y co-ordinates. angle += angleDelta; var b:Number = r*Math.cos(angle); var h:Number = r * Math.sin(angle); var imageLoader:MovieClip = new MovieClip(); var txt:TextField = new TextField(); txt.setTextFormat(myFormat); txt.name = (i*1000+j).toString(); txt.visible = true; txt.width = 100; txt.height = 18; txt.text = ""; txt.x = xCoord+b-1; txt.y = yCoord + h ; txt.addEventListener(MouseEvent.MOUSE_OVER, onOver); txt.addEventListener(MouseEvent.CLICK, onClick); txt.addEventListener(MouseEvent.MOUSE_OUT, onOut); dot.addChildAt(txt,0); dot.graphics.drawCircle(xCoord + b, yCoord + h, 5); circle1.addChildAt(dot, j); } } cnv1.rawChildren.addChildAt(circle1, i); cnv1.setVisible(true); r = r + 20; can1.validateNow() or this.validateNow() } } On Mon, Nov 2, 2009 at 1:10 PM, harshadaj <harshadajog@...> wrote:
-- Thanks, Vaibhav Seth. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to flex_india@... To unsubscribe from this group, send email to flex_india+unsubscribe@... For more options, visit this group at http://groups.google.com/group/flex_india?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
[flex_india:26313] Re: Have to reload/refresh for displaying from external dataHi, I tried using validateNow, but I get the same problem. Its a facebook application at :-aaps.facebook.com at http://apps.facebook.com/my_kaleidoscope/. When I click on Sunsigns I get a blank canvas,but when I click on the canvas, the mouseclick events meant for users get triggered properly. So what I have is a blank canvas which when clicked randomly show the user data properly on right pane. Please help. On Nov 2, 12:29 pm, Vaibhav Seth <seth.vaibhav...@...> wrote: > Hi, > > In the following code you can try the following: > > public function create():void > { > > var borderColor:uint = 0x666666; > var borderSize:uint = 2; > var xCoord:int = 240; //original:-250 > var yCoord:int = 300; //original:-200 > var radius:int = 18; > var r:int = radius; > > rashiRingsArray = new Array(); > rashiObjectsArray = new Array(); > // var rashiCount:int = myXML.rashi.length(); > //2. Create 12 rashi circles. > > for (var i:int = 0; i < 11; i++) > { > > //Big Circle. > var circle1:Sprite = new Sprite(); > //Push rashi circle in the cirle array. > rashiRingsArray.push(circle1); > // circle1.graphics.lineStyle( > borderSize, myXML.rashi[i].color); > circle1.graphics.lineStyle(borderSize, > 0xFF0000); > circle1.graphics.drawCircle(xCoord, yCoord, > r); > var shift:int = i * 90; > //At the same time create a rashi object nd > push in object array. > var rashiobj:RashiObject = new > RashiObject(myXML.rashi[i].rid , > myXML.rashi[i].rname, myXML.rashi[i].trait, myXML.rashi[i].count); > rashiObjectsArray.push(rashiobj); > //Get count of users for the rashi. > var userCount:int = > myXML.rashi[i].users.length(); > // trace(myXML.rashi[i].count); > > if (myXML.rashi[i].users.length() > 0) > { > > //Initialize angle. > var angle:int = shift; > var angleDelta:Number = deg2rad(360 / > myXML.rashi[i].count); > > for (var j:int = 0; j < > myXML.rashi[i].count; j++) > { > > //Add the user to rashiobject > array. > // var str:String = > convertDate(myXML.rashi[i].users.user > [j].bday); > var str:String = > myXML.rashi[i].users.user[j].bday; > var userObject:UserObject = > new UserObject(myXML.rashi > [i].users.user[j].uid, myXML.rashi[i].users.user[j].uname,myXML.rashi > [i].users.user[j].upic,myXML.rashi[i].users.user[j].umovies,myXML.rashi > [i].users.user[j].umusic,myXML.rashi[i].users.user > [j].ubooks,myXML.rashi[i].users.user[j].usite,myXML.rashi[i].users.user > [j].status,str); > > //trace(rashiObjectsArray[i].getRname()); > > rashiObjectsArray[i].addUser(userObject); > > //Draw smaller circle > simulating a dot. > var dot:Sprite = new > Sprite(); > dot.name = > (i*1000+j).toString(); > > dot.graphics.beginFill(0xFF0000); > // > dot.graphics.beginFill(myXML.rashi[i].color); > dot.buttonMode = false; > > //Set the x and y > co-ordinates. > angle += angleDelta; > var b:Number = > r*Math.cos(angle); > var h:Number = r * > Math.sin(angle); > > var imageLoader:MovieClip = > new MovieClip(); > > var txt:TextField = new > TextField(); > txt.setTextFormat(myFormat); > txt.name = > (i*1000+j).toString(); > txt.visible = true; > txt.width = 100; > txt.height = 18; > txt.text = ""; > txt.x = xCoord+b-1; > txt.y = yCoord + h ; > > txt.addEventListener(MouseEvent.MOUSE_OVER, onOver); > > txt.addEventListener(MouseEvent.CLICK, onClick); > > txt.addEventListener(MouseEvent.MOUSE_OUT, onOut); > dot.addChildAt(txt,0); > > dot.graphics.drawCircle(xCoord + b, yCoord + h, 5); > circle1.addChildAt(dot, j); > > } > } > cnv1.rawChildren.addChildAt(circle1, i); > cnv1.setVisible(true); > r = r + 20; > > can1.validateNow() or this.validateNow() > > } > > } > > On Mon, Nov 2, 2009 at 1:10 PM, harshadaj <harshada...@...> wrote: > > > Hello, > > I have a problem synchronising external data loading and drawing > > graph as per external data. > > I have to display 12 concentric rings(each representing a sun > > sign"Rashi"). I take the order of rings from xml file. I have to plot > > users as dots on the respective sunsign rings. The problem is, I get a > > blank page without rings and all. But when I randomly click on the > > blank canvas, the mose-click events meant for displaying the user(dot) > > profile data from xml file get fired and I can see the users' data. > > > I am trying to play with the initialize/creationComplete and > > applicationComplete for getting the desired output. I have set startup > > ()(which calls httpservice.send) in the initialize and create()(which > > reads xml data and draws circles and nodes in the httpservice's > > xmlresult success event. I am not sure of how to go about. In IE, > > because of cache, when I reload my page, the circles get displayed. > > But not in Firefox. > > > Pasting the code below:- > > > <?xml version="1.0" encoding="utf-8"?> > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > > layout="absolute" width="711" height="600" backgroundColor="#FFFFFF" > > horizontalScrollPolicy="off" verticalScrollPolicy="off" initialize = > > "startup()"> > > <mx:VRule x="588" y="24" width="0" height="600" /> > > <mx:Canvas x="0" y="0" width="711" height="600" id="cnv1" > > backgroundColor="#FFFFFF" borderStyle="none" > > horizontalScrollPolicy="off" verticalScrollPolicy="off"> > > <mx:VRule x="511" y="0" width="8" height="600"/> > > <mx:Image x="564" y="27" id="img1" scaleContent="true"/> > > <mx:Label x="529" y="260" text="Favourite Movies:" > > width="112" > > id="lblMovies" fontFamily="Verdana"/> > > <mx:Label x="529" y="388" text="Favourite Music:" > > width="112" > > id="lblMusic"/> > > <mx:Label x="529" y="499" text="Favourite Books:" > > id="lblBooks"/> > > <mx:TextArea x="533" y="124" width="168" id="txtStatus" > > height="53" > > wordWrap="true" verticalScrollPolicy="auto" verticalScrollPosition="0" > > editable="false" borderStyle="none"/> > > <mx:TextArea x="527" y="282" height="101" id="txtMovies" > > editable="false" enabled="true" borderStyle="none" width="160"/> > > <mx:TextArea x="529" y="408" height="89" id="txtMusic" > > wordWrap="true" editable="false" borderStyle="none" width="158"/> > > <mx:TextArea x="529" y="516" height="83" id="txtBooks" > > wordWrap="true" editable="false" borderStyle="none" width="158"/> > > > <mx:Label x="527" y="221" text="Birthday:" height="25" > > width="101" > > id="lblBday"/> > > <mx:Label x="582" y="220" width="98" id="txtBday" > > height="25" > > alpha="0.0"/> > > <mx:Label x="528" y="195" text="Name:" id="lblName"/> > > <mx:Label x="572" y="197" id="txtName" width="124" > > height="18"/> > > </mx:Canvas> > > > <mx:Script> > > <![CDATA[ > > import mx.rpc.events.ResultEvent; > > import mx.rpc.events.FaultEvent; > > // import flash.display.LoaderInfo; > > import flash.display.MovieClip; > > import flash.display.Sprite; > > import flash.events.Event; > > import flash.events.MouseEvent; > > // import flash.net.URLLoader; > > // import flash.net.URLRequest; > > import flash.text.TextField; > > import mx.core.UIComponent; > > > public var rashiObjectsArray:Array; > > public var rashiRingsArray:Array; > > > import mx.controls.Alert; > > import mx.rpc.events.FaultEvent; > > import mx.rpc.events.ResultEvent; > > > [Bindable] > > private var myXML:XML; > > > internal var isLoaded:Boolean = false; > > > internal var myFormat:TextFormat = new TextFormat(); > > > public function deg2rad(deg:Number):Number > > { > > return deg*Math.PI/180; > > } > > > public function clearControls():void > > { > > // img1.unloadAndStop(); > > txtStatus.text = ""; > > txtBday.text=""; > > txtMovies.text =""; > > txtMusic.text = ""; > > txtBooks.text =""; > > txtName.text=""; > > > } > > > public function initControls():void > > { > > myFormat.font = "Verdana"; > > myFormat.font = "12px"; > > myFormat.bold; > > ... > > read more » --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to flex_india@... To unsubscribe from this group, send email to flex_india+unsubscribe@... For more options, visit this group at http://groups.google.com/group/flex_india?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
[flex_india:26311] Re: Have to reload/refresh for displaying from external dataHi, I tried it, but still doesnot work. The application link is :www.udayjoshi.com/DisplayRashi.swf or the facebook app is at http://apps.facebook.com/my_kaleidoscope/(Click on sunsigns). Please help. Thanks. On Nov 2, 12:29 pm, Vaibhav Seth <seth.vaibhav...@...> wrote: > Hi, > > In the following code you can try the following: > > public function create():void > { > > var borderColor:uint = 0x666666; > var borderSize:uint = 2; > var xCoord:int = 240; //original:-250 > var yCoord:int = 300; //original:-200 > var radius:int = 18; > var r:int = radius; > > rashiRingsArray = new Array(); > rashiObjectsArray = new Array(); > // var rashiCount:int = myXML.rashi.length(); > //2. Create 12 rashi circles. > > for (var i:int = 0; i < 11; i++) > { > > //Big Circle. > var circle1:Sprite = new Sprite(); > //Push rashi circle in the cirle array. > rashiRingsArray.push(circle1); > // circle1.graphics.lineStyle( > borderSize, myXML.rashi[i].color); > circle1.graphics.lineStyle(borderSize, > 0xFF0000); > circle1.graphics.drawCircle(xCoord, yCoord, > r); > var shift:int = i * 90; > //At the same time create a rashi object nd > push in object array. > var rashiobj:RashiObject = new > RashiObject(myXML.rashi[i].rid , > myXML.rashi[i].rname, myXML.rashi[i].trait, myXML.rashi[i].count); > rashiObjectsArray.push(rashiobj); > //Get count of users for the rashi. > var userCount:int = > myXML.rashi[i].users.length(); > // trace(myXML.rashi[i].count); > > if (myXML.rashi[i].users.length() > 0) > { > > //Initialize angle. > var angle:int = shift; > var angleDelta:Number = deg2rad(360 / > myXML.rashi[i].count); > > for (var j:int = 0; j < > myXML.rashi[i].count; j++) > { > > //Add the user to rashiobject > array. > // var str:String = > convertDate(myXML.rashi[i].users.user > [j].bday); > var str:String = > myXML.rashi[i].users.user[j].bday; > var userObject:UserObject = > new UserObject(myXML.rashi > [i].users.user[j].uid, myXML.rashi[i].users.user[j].uname,myXML.rashi > [i].users.user[j].upic,myXML.rashi[i].users.user[j].umovies,myXML.rashi > [i].users.user[j].umusic,myXML.rashi[i].users.user > [j].ubooks,myXML.rashi[i].users.user[j].usite,myXML.rashi[i].users.user > [j].status,str); > > //trace(rashiObjectsArray[i].getRname()); > > rashiObjectsArray[i].addUser(userObject); > > //Draw smaller circle > simulating a dot. > var dot:Sprite = new > Sprite(); > dot.name = > (i*1000+j).toString(); > > dot.graphics.beginFill(0xFF0000); > // > dot.graphics.beginFill(myXML.rashi[i].color); > dot.buttonMode = false; > > //Set the x and y > co-ordinates. > angle += angleDelta; > var b:Number = > r*Math.cos(angle); > var h:Number = r * > Math.sin(angle); > > var imageLoader:MovieClip = > new MovieClip(); > > var txt:TextField = new > TextField(); > txt.setTextFormat(myFormat); > txt.name = > (i*1000+j).toString(); > txt.visible = true; > txt.width = 100; > txt.height = 18; > txt.text = ""; > txt.x = xCoord+b-1; > txt.y = yCoord + h ; > > txt.addEventListener(MouseEvent.MOUSE_OVER, onOver); > > txt.addEventListener(MouseEvent.CLICK, onClick); > > txt.addEventListener(MouseEvent.MOUSE_OUT, onOut); > dot.addChildAt(txt,0); > > dot.graphics.drawCircle(xCoord + b, yCoord + h, 5); > circle1.addChildAt(dot, j); > > } > } > cnv1.rawChildren.addChildAt(circle1, i); > cnv1.setVisible(true); > r = r + 20; > > can1.validateNow() or this.validateNow() > > } > > } > > On Mon, Nov 2, 2009 at 1:10 PM, harshadaj <harshada...@...> wrote: > > > Hello, > > I have a problem synchronising external data loading and drawing > > graph as per external data. > > I have to display 12 concentric rings(each representing a sun > > sign"Rashi"). I take the order of rings from xml file. I have to plot > > users as dots on the respective sunsign rings. The problem is, I get a > > blank page without rings and all. But when I randomly click on the > > blank canvas, the mose-click events meant for displaying the user(dot) > > profile data from xml file get fired and I can see the users' data. > > > I am trying to play with the initialize/creationComplete and > > applicationComplete for getting the desired output. I have set startup > > ()(which calls httpservice.send) in the initialize and create()(which > > reads xml data and draws circles and nodes in the httpservice's > > xmlresult success event. I am not sure of how to go about. In IE, > > because of cache, when I reload my page, the circles get displayed. > > But not in Firefox. > > > Pasting the code below:- > > > <?xml version="1.0" encoding="utf-8"?> > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > > layout="absolute" width="711" height="600" backgroundColor="#FFFFFF" > > horizontalScrollPolicy="off" verticalScrollPolicy="off" initialize = > > "startup()"> > > <mx:VRule x="588" y="24" width="0" height="600" /> > > <mx:Canvas x="0" y="0" width="711" height="600" id="cnv1" > > backgroundColor="#FFFFFF" borderStyle="none" > > horizontalScrollPolicy="off" verticalScrollPolicy="off"> > > <mx:VRule x="511" y="0" width="8" height="600"/> > > <mx:Image x="564" y="27" id="img1" scaleContent="true"/> > > <mx:Label x="529" y="260" text="Favourite Movies:" > > width="112" > > id="lblMovies" fontFamily="Verdana"/> > > <mx:Label x="529" y="388" text="Favourite Music:" > > width="112" > > id="lblMusic"/> > > <mx:Label x="529" y="499" text="Favourite Books:" > > id="lblBooks"/> > > <mx:TextArea x="533" y="124" width="168" id="txtStatus" > > height="53" > > wordWrap="true" verticalScrollPolicy="auto" verticalScrollPosition="0" > > editable="false" borderStyle="none"/> > > <mx:TextArea x="527" y="282" height="101" id="txtMovies" > > editable="false" enabled="true" borderStyle="none" width="160"/> > > <mx:TextArea x="529" y="408" height="89" id="txtMusic" > > wordWrap="true" editable="false" borderStyle="none" width="158"/> > > <mx:TextArea x="529" y="516" height="83" id="txtBooks" > > wordWrap="true" editable="false" borderStyle="none" width="158"/> > > > <mx:Label x="527" y="221" text="Birthday:" height="25" > > width="101" > > id="lblBday"/> > > <mx:Label x="582" y="220" width="98" id="txtBday" > > height="25" > > alpha="0.0"/> > > <mx:Label x="528" y="195" text="Name:" id="lblName"/> > > <mx:Label x="572" y="197" id="txtName" width="124" > > height="18"/> > > </mx:Canvas> > > > <mx:Script> > > <![CDATA[ > > import mx.rpc.events.ResultEvent; > > import mx.rpc.events.FaultEvent; > > // import flash.display.LoaderInfo; > > import flash.display.MovieClip; > > import flash.display.Sprite; > > import flash.events.Event; > > import flash.events.MouseEvent; > > // import flash.net.URLLoader; > > // import flash.net.URLRequest; > > import flash.text.TextField; > > import mx.core.UIComponent; > > > public var rashiObjectsArray:Array; > > public var rashiRingsArray:Array; > > > import mx.controls.Alert; > > import mx.rpc.events.FaultEvent; > > import mx.rpc.events.ResultEvent; > > > [Bindable] > > private var myXML:XML; > > > internal var isLoaded:Boolean = false; > > > internal var myFormat:TextFormat = new TextFormat(); > > > public function deg2rad(deg:Number):Number > > { > > return deg*Math.PI/180; > > } > > > public function clearControls():void > > { > > // img1.unloadAndStop(); > > txtStatus.text = ""; > > txtBday.text=""; > > txtMovies.text =""; > > txtMusic.text = ""; > > txtBooks.text =""; > > txtName.text=""; > > > } > > > public function initControls():void > > { > > myFormat.font = "Verdana"; > > myFormat.font = "12px"; > > myFormat.bold; > > ... > > read more » --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to flex_india@... To unsubscribe from this group, send email to flex_india+unsubscribe@... For more options, visit this group at http://groups.google.com/group/flex_india?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
[flex_india:26402] Re: Have to reload/refresh for displaying from external dataHello, My problem is finally solved. On Nov 2, 5:55 pm, harshadaj <harshada...@...> wrote: > Hi, > > I tried using validateNow, but I get the same problem. Its a > facebook application at :-aaps.facebook.com athttp://apps.facebook.com/my_kaleidoscope/. > When I click on Sunsigns I get a blank canvas,but when I click on the > canvas, the mouseclick events meant for users get triggered properly. > So what I have is a blank canvas which when clicked randomly show the > user data properly on right pane. Please help. > > On Nov 2, 12:29 pm, Vaibhav Seth <seth.vaibhav...@...> wrote: > > > Hi, > > > In the following code you can try the following: > > > public function create():void > > { > > > var borderColor:uint = 0x666666; > > var borderSize:uint = 2; > > var xCoord:int = 240; //original:-250 > > var yCoord:int = 300; //original:-200 > > var radius:int = 18; > > var r:int = radius; > > > rashiRingsArray = new Array(); > > rashiObjectsArray = new Array(); > > // var rashiCount:int = myXML.rashi.length(); > > //2. Create 12 rashi circles. > > > for (var i:int = 0; i < 11; i++) > > { > > > //Big Circle. > > var circle1:Sprite = new Sprite(); > > //Push rashi circle in the cirle array. > > rashiRingsArray.push(circle1); > > // circle1.graphics.lineStyle( > > borderSize, myXML.rashi[i].color); > > circle1.graphics.lineStyle(borderSize, > > 0xFF0000); > > circle1.graphics.drawCircle(xCoord, yCoord, > > r); > > var shift:int = i * 90; > > //At the same time create a rashi object nd > > push in object array. > > var rashiobj:RashiObject = new > > RashiObject(myXML.rashi[i].rid , > > myXML.rashi[i].rname, myXML.rashi[i].trait, myXML.rashi[i].count); > > rashiObjectsArray.push(rashiobj); > > //Get count of users for the rashi. > > var userCount:int = > > myXML.rashi[i].users.length(); > > // trace(myXML.rashi[i].count); > > > if (myXML.rashi[i].users.length() > 0) > > { > > > //Initialize angle. > > var angle:int = shift; > > var angleDelta:Number = deg2rad(360 / > > myXML.rashi[i].count); > > > for (var j:int = 0; j < > > myXML.rashi[i].count; j++) > > { > > > //Add the user to rashiobject > > array. > > // var str:String = > > convertDate(myXML.rashi[i].users.user > > [j].bday); > > var str:String = > > myXML.rashi[i].users.user[j].bday; > > var userObject:UserObject = > > new UserObject(myXML.rashi > > [i].users.user[j].uid, myXML.rashi[i].users.user[j].uname,myXML.rashi > > [i].users.user[j].upic,myXML.rashi[i].users.user[j].umovies,myXML.rashi > > [i].users.user[j].umusic,myXML.rashi[i].users.user > > [j].ubooks,myXML.rashi[i].users.user[j].usite,myXML.rashi[i].users.user > > [j].status,str); > > > //trace(rashiObjectsArray[i].getRname()); > > > rashiObjectsArray[i].addUser(userObject); > > > //Draw smaller circle > > simulating a dot. > > var dot:Sprite = new > > Sprite(); > > dot.name = > > (i*1000+j).toString(); > > > dot.graphics.beginFill(0xFF0000); > > // > > dot.graphics.beginFill(myXML.rashi[i].color); > > dot.buttonMode = false; > > > //Set the x and y > > co-ordinates. > > angle += angleDelta; > > var b:Number = > > r*Math.cos(angle); > > var h:Number = r * > > Math.sin(angle); > > > var imageLoader:MovieClip = > > new MovieClip(); > > > var txt:TextField = new > > TextField(); > > txt.setTextFormat(myFormat); > > txt.name = > > (i*1000+j).toString(); > > txt.visible = true; > > txt.width = 100; > > txt.height = 18; > > txt.text = ""; > > txt.x = xCoord+b-1; > > txt.y = yCoord + h ; > > > txt.addEventListener(MouseEvent.MOUSE_OVER, onOver); > > > txt.addEventListener(MouseEvent.CLICK, onClick); > > > txt.addEventListener(MouseEvent.MOUSE_OUT, onOut); > > dot.addChildAt(txt,0); > > > dot.graphics.drawCircle(xCoord + b, yCoord + h, 5); > > circle1.addChildAt(dot, j); > > > } > > } > > cnv1.rawChildren.addChildAt(circle1, i); > > cnv1.setVisible(true); > > r = r + 20; > > > can1.validateNow() or this.validateNow() > > > } > > > } > > > On Mon, Nov 2, 2009 at 1:10 PM,harshadaj<harshada...@...> wrote: > > > > Hello, > > > I have a problem synchronising external data loading and drawing > > > graph as per external data. > > > I have to display 12 concentric rings(each representing a sun > > > sign"Rashi"). I take the order of rings from xml file. I have to plot > > > users as dots on the respective sunsign rings. The problem is, I get a > > > blank page without rings and all. But when I randomly click on the > > > blank canvas, the mose-click events meant for displaying the user(dot) > > > profile data from xml file get fired and I can see the users' data. > > > > I am trying to play with the initialize/creationComplete and > > > applicationComplete for getting the desired output. I have set startup > > > ()(which calls httpservice.send) in the initialize and create()(which > > > reads xml data and draws circles and nodes in the httpservice's > > > xmlresult success event. I am not sure of how to go about. In IE, > > > because of cache, when I reload my page, the circles get displayed. > > > But not in Firefox. > > > > Pasting the code below:- > > > > <?xml version="1.0" encoding="utf-8"?> > > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > > > layout="absolute" width="711" height="600" backgroundColor="#FFFFFF" > > > horizontalScrollPolicy="off" verticalScrollPolicy="off" initialize = > > > "startup()"> > > > <mx:VRule x="588" y="24" width="0" height="600" /> > > > <mx:Canvas x="0" y="0" width="711" height="600" id="cnv1" > > > backgroundColor="#FFFFFF" borderStyle="none" > > > horizontalScrollPolicy="off" verticalScrollPolicy="off"> > > > <mx:VRule x="511" y="0" width="8" height="600"/> > > > <mx:Image x="564" y="27" id="img1" scaleContent="true"/> > > > <mx:Label x="529" y="260" text="Favourite Movies:" > > > width="112" > > > id="lblMovies" fontFamily="Verdana"/> > > > <mx:Label x="529" y="388" text="Favourite Music:" > > > width="112" > > > id="lblMusic"/> > > > <mx:Label x="529" y="499" text="Favourite Books:" > > > id="lblBooks"/> > > > <mx:TextArea x="533" y="124" width="168" id="txtStatus" > > > height="53" > > > wordWrap="true" verticalScrollPolicy="auto" verticalScrollPosition="0" > > > editable="false" borderStyle="none"/> > > > <mx:TextArea x="527" y="282" height="101" id="txtMovies" > > > editable="false" enabled="true" borderStyle="none" width="160"/> > > > <mx:TextArea x="529" y="408" height="89" id="txtMusic" > > > wordWrap="true" editable="false" borderStyle="none" width="158"/> > > > <mx:TextArea > > ... > > read more » --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to flex_india@... To unsubscribe from this group, send email to flex_india+unsubscribe@... For more options, visit this group at http://groups.google.com/group/flex_india?hl=en -~----------~----~----~----~------~----~------~--~--- |
| Free embeddable forum powered by Nabble | Forum Help |