[flexcoders] Complex shape selection
Hi, how to create complex selectable shape in flex. For example if I make Europe map. And There is countries like Germany, Italy, Greece etc. They all have their boundaries. And I want to create application so that user can select Greece for example but only selectable in her boundaries. If I put canvas over this country and make it selectable I get square selection which is not what I really want.
[flexcoders] How to display bullet insted asterisk in textinput controll
I added displayAsPassword but I want bullets instead of asterisks. How to achieve this? I can't change type of fonts in controll.
[flexcoders] Multiline label or text
Hi, I need to display large text in a small area and I have to make Label or Text to be multilined (wordWrap). I succeeds with Text control but When I put enabled property to false my letters change color. I work everything from AS nothing from MXML. Is there any way to control enabled(false) color or make Label to be multiline?
[flexcoders] Problem with native AIR component
Hello, one more problem :). I created native AIR component in the following way: I create VBox and fill it with buttons and labels components. I created one native component (type Window) and add previous VBox components in it (addChild(...)). Now becouse I have to use native components to load this VBox in it I don't need window borders (chrome etc.) so I hide it, and my component look just as I like it, BUT. I can't move my component, I made this VBox movable but when I start to move it it despairs because it is in window native component and when I move inner component down, down part of that become invisible. I can't explain better. My component is surrounded with borders of native component. I try to switch this VBox with panel but problem is still the same. So, is there any way to make this component movable, when I work with native window?
[flexcoders] Re: How to run another air application from air application
Hi, you help me a lot, but now I have some strange problem: This application cannot be installed because this installer has been mis-configured. Please contact the application author for assistance. I make one relase 0.0.1. and install on client. I make new relase 0.0.2. I put new relase on server, also I put descriptor file on the server 0.0.2. I call method to download this new version. Ok. In here updater.update(airFile, updateVersionName.text); updateVersionName.text is number of new version 0.0.2. and it still show this error. So: Certificates are the same. Version on release config and descriptor on server are the same. Client config is lower then on the server and there is still error. --- In flexcoders@yahoogroups.com, Ian Thomas i...@... wrote: Take a look at the flash.desktop.Update class - call the update() method on the AIR file in question rather than using URLLoader(). There's a code snippet that does what you want here: http://livedocs.adobe.com/flex/3/html/help.html?content=updating_apps_1.html HTH, Ian On Wed, Aug 12, 2009 at 8:24 AM, vladakg85vladak...@... wrote: I have one air application. Now I want to make custom update (no default, I want my component) and I made it to download new application version to my app folder now I need to install it, but I don't know how to invoke newVersion.air from action script code??? I try with this but doesn't work: var req:URLRequest = new URLRequest(file:///c:\Documents and Settings\vvucetic.newVersion.air); var rld:URLLoader = new URLLoader(); rld.load(req); fscommand(exec, file:///c:\Documents and Settings\vvucetic.newVersion.air);
[flexcoders] Re: How to run another air application from air application
Yes, but I don;t want to use framework. I have to make manual update. I have methods that check if there is new version on server,manually download new version from server, and manually run installer, but I recived this message. This application cannot be installed because this installer has been mis-configured. Please contact the application author for assistance. --- In flexcoders@yahoogroups.com, Ian Thomas i...@... wrote: On Thu, Aug 13, 2009 at 11:07 AM, vladakg85vladak...@... wrote: Hi, you help me a lot, but now I have some strange problem: This application cannot be installed because this installer has been mis-configured. Please contact the application author for assistance. If you're having trouble rolling your own updater, perhaps you should consider using the Air Update Framework which is supplied with the Flex SDK? There's information here: http://www.adobe.com/devnet/air/articles/air_update_framework.html http://blog.everythingflex.com/2008/08/01/air-update-framework/ HTH, Ian
[flexcoders] Re: How to run another air application from air application
No, download goes ok, if I run file.air manually update is OK. Old version is replaced with new. This is how I get file: urlStream.addEventListener(Event.COMPLETE, loaded); urlStream.load(urlReq); private function loaded(event:Event):void { urlStream.readBytes(fileData, 0, urlStream.bytesAvailable); writeAirFile(); } private function writeAirFile():void { file=File.applicationStorageDirectory.resolvePath(xyz.air); var fileStream:FileStream=new FileStream(); fileStream.open(file, FileMode.WRITE); fileStream.writeBytes(fileData, 0, fileData.length); fileStream.close(); trace(The AIR file is written.); Alert.show(The AIR file is written.); var fileSpecialToInstallUpdate:File=new File(); fileSpecialToInstallUpdate=file; var updater:Updater = new Updater(); var airFile:File = fileSpecialToInstallUpdate; updater.update(airFile, updateVersionName.text); } --- In flexcoders@yahoogroups.com, Ian Thomas i...@... wrote: On Thu, Aug 13, 2009 at 11:44 AM, vladakg85vladak...@... wrote: Yes, but I don;t want to use framework. I have to make manual update. I have methods that check if there is new version on server,manually download new version from server, and manually run installer, but I recived this message. This application cannot be installed because this installer has been mis-configured. Please contact the application author for assistance. Does the 0.2 .air file on the _server_ actually work properly when you try to manually install it? If no, there's your problem right there. :-) Does the 0.2 downloaded .air file actually work properly when you try to manually install it? If not, the download has gone wrong (nothing to do with the update framework). It the second case is true, try looking at the .air file contents in a text editor - does it just contain some HTTP or PHP error data or something? If a text editor doesn't reveal the answer, try a HTTP monitor such as Charles to see if anything odd is going on with the request/response. And try a byte-editor compare between your server .air file and the downloaded .air file. If the downloaded file _does_ work properly when manually installed, then I'm afraid I don't know what's going on - would need more context/test files. HTH, Ian
[flexcoders] How to run another air application from air application
I have one air application. Now I want to make custom update (no default, I want my component) and I made it to download new application version to my app folder now I need to install it, but I don't know how to invoke newVersion.air from action script code??? I try with this but doesn't work: var req:URLRequest = new URLRequest(file:///c:\Documents and Settings\vvucetic.newVersion.air); var rld:URLLoader = new URLLoader(); rld.load(req); fscommand(exec, file:///c:\Documents and Settings\vvucetic.newVersion.air);
[flexcoders] Need help fast: Mouse and ketboard event
Hi, I have a list of buttons in my VBox (1,2,3,4,5,6...) and I can click with mouse on each of them. Now I need to make numeric keyboard to register click on some of this buttons. If I press 5 on numpad button on the screen must flash a little (like it is pressed for real with mouse). But I can't figure out how to do this, help please? Thanks
[flexcoders] PopUp vs other containers
How to decide do I need PopUp window or Title Window component for example? If I have button in my application and I want to after click new window shows on the screen which I can move, add other components on it bla bla... should I here use PopUpManager or something else. When and why to use PopUps?
[flexcoders] Re: Flex logging
Hi, I setup something by the manual but practical problem occured :( 1) this is in my mm.cfg file: ErrorReportingEnable=1 TraceOutputFileEnable=1 MaxWarnings =0 TraceOutputFileName=c:/flashlog.txt Problem here is, Each log is still writing in c:/documents/user/appdata/macromedia/flashlog.txt, and not where I specified location, how to fix this? Another problem is, when I start application log start writing but overwrite old log and I don't want to do that, can I disable overwriting? 2) This file mm.cfg always must be edited, can I somehow add some XML document to my project to change log config from there, becouse when I put application on client, I cant tell him to go c:/blabla to help me solve my problem :) ? Thanks --- In flexcoders@yahoogroups.com, Julien Nicoulaud primo...@... wrote: Flex provides a real logging API, spare you some efforts :) http://livedocs.adobe.com/flex/3/html/help.html?content=logging_09.html 2009/7/14 valdhor valdhorli...@... Shared Objects? --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, vladakg85 vladakg85@ wrote: Hi, I need to setup my flex application to save log information in some *.txt file, but I don't know how to setup this. Help me :(
[flexcoders] Flex logging
Hi, I need to setup my flex application to save log information in some *.txt file, but I don't know how to setup this. Help me :(
[flexcoders] Re: Flex in eclipse
I have installed WTP, associate mxml with XML editor, add xsd schema in xml catalog...but don't work :( I found some tool AXDT it works fine, but only thing I miss is debuger, I don't know how to add breakpoint and watch my variables while code executes, somebody know? --- In flexcoders@yahoogroups.com, Tom Chiverton tom.chiver...@... wrote: On Tuesday 07 Jul 2009, vladakg85 wrote: Ok, I downloaded xsd4MXML project and opened it in Eclipse...Build...It works... but what do I get with this? Am I wrong in something? You get a .xsd file, which gives you syntax highlights and insight for MXML files. You can install it via a procedure like : 1. Install the web tools ('WTP') 2. Associate *.mxml files with the XML Editor in preferences, general, editors) 3. Add the schema itself in preferences, web and xml, xml catalog, add user. The 'keytype' is the namespace name. -- Helping to completely enhance integrated bandwidth as part of the IT team of the year, '09 and '08 This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at Halliwells LLP, 3 Hardman Square, Spinningfields, Manchester, M3 3EB. A list of members is available for inspection at the registered office together with a list of those non members who are referred to as partners. We use the word ?partner? to refer to a member of the LLP, or an employee or consultant with equivalent standing and qualifications. Regulated by the Solicitors Regulation Authority. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 2500. For more information about Halliwells LLP visit www.halliwells.com.
[flexcoders] Eclipse and flex setup questions
I connected flex 3 sdk and eclipse classic eclipse-jee-galileo-win32, now: 1) What is better to use for build code with ANT or without ANT? 2) Is there any way to add code hint (Ctrl + Space) while coding AS3 class or MXML file inside eclipse? 3) For code colors, is there some better way than using Java for AS and XML for MXML? Thanks
[flexcoders] Re: Flex in eclipse
Ok, I downloaded xsd4MXML project and opened it in Eclipse...Build...It works... but what do I get with this? Am I wrong in something? Thanks for understanding --- In flexcoders@yahoogroups.com, Tom Chiverton tom.chiver...@... wrote: On Friday 03 Jul 2009, vladakg85 wrote: O yeah, I want to connect eclipse to flex SDK, looking for free solution :) The xsd4MXML project on Google code will allow you to use the Eclipse XML view to edit MXML with full insight support. You can just keep a command line window open for running the compiler in, or look into ANT. -- Helping to confidentially bully slick killer eigth-generation CEOs as part of the IT team of the year, '09 and '08 This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at Halliwells LLP, 3 Hardman Square, Spinningfields, Manchester, M3 3EB. A list of members is available for inspection at the registered office together with a list of those non members who are referred to as partners. We use the word ?partner? to refer to a member of the LLP, or an employee or consultant with equivalent standing and qualifications. Regulated by the Solicitors Regulation Authority. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 2500. For more information about Halliwells LLP visit www.halliwells.com.
[flexcoders] Flex in eclipse
Is there on the internet some good explanation step by step, how to configure eclipse to develop flex applications. Thanks
[flexcoders] Re: Flex in eclipse
O yeah, I want to connect eclipse to flex SDK, looking for free solution :) --- In flexcoders@yahoogroups.com, vladakg85 vladak...@... wrote: Is there on the internet some good explanation step by step, how to configure eclipse to develop flex applications. Thanks
[flexcoders] PureMVC, register popup mediator problem
Below is my code for popup, in my project, I have a problem to register mediator, I try like this :: facade.registerMediator(new InfoWindowFriendDetailsMediator(InfoWindowFriendDetails)); :: Problem happened when I register events on my popup component controls, I get null here and application crash. I don't know how to register mediator? $$$ override public function onRegister():void { friendDetailsInfoWindow.btnCloseInfoWindowFriendDetails.addEventListener(MouseEvent.CLICK, onCloseClick); } $$$ package util.popup { import flash.display.DisplayObject; import flash.display.Sprite; import mx.core.Application; import mx.core.IFlexDisplayObject; import mx.managers.PopUpManager; import org.puremvc.as3.multicore.patterns.facade.Facade; /** * Used to handle popup opening controling registering and unregistering mediators * * @author */ public class PopManager extends PopUpManager { private static var popupList:Array=new Array(); /** * Opens a popup window. Window component is crated and mediator is assigned to it. * Targeted for PureMVC multicore so method requires moduleId to be passed */ public static function openPopUpWindow(ComponentClass:Class, MediatorClass:Class, moduleUid:String, modal:Boolean=true, parent:DisplayObject=null):IFlexDisplayObject { if (parent == null) { parent=Application.application as DisplayObject; } var window:IFlexDisplayObject=PopUpManager.createPopUp(parent, ComponentClass, modal); var obj:Facade=Facade.getInstance(moduleUid)as Facade; obj.registerMediator(new MediatorClass(window)); PopUpManager.centerPopUp(window); return window; } /** * Removes PopUp window and unregisteres associated mediator */ public static function closePopUpWindow(window:IFlexDisplayObject, mediatorName:String, moduleUid:String):void { PopUpManager.removePopUp(window); Facade.getInstance(moduleUid).removeMediator(mediatorName); } /** * * Tries to retrieve popup window from the list of popups already opened. If there is no window opened with * provided mediator name associated with it, a new one is created and displayed. */ public static function retrievePopUp(ComponentClass:Class, MediatorClass:Class, mediatorName:String, moduleUid:String, modal:Boolean=true):IFlexDisplayObject { if (popupList[mediatorName]) { PopUpManager.addPopUp(popupList[mediatorName]as IFlexDisplayObject, Application.application as Sprite, modal); PopUpManager.bringToFront(popupList[mediatorName]); } else { popupList[mediatorName]=openPopUpWindow(ComponentClass, MediatorClass, moduleUid, modal) } return popupList[mediatorName]; } /** * Removes popup from display list. The actual popup object still exists in the list and can be retrieved */ public static function hidePopUp(window:IFlexDisplayObject, mediatorName:String):void { PopUpManager.removePopUp(window); } /** * Removes the popup completle. Also unregisters mediator. */ public static function destroyPopUp(window:IFlexDisplayObject, mediatorName:String, moduleUid:String):void { closePopUpWindow(window, mediatorName, moduleUid); if (popupList[mediatorName]) { popupList[mediatorName]=null; } } } }
[flexcoders] From where to start building chat client
Hello, I want to start one small project for my self, it's about chat client where user can login and chat with other users etc. I am very interested to know what should I use to transfer messages from user to user is there any server, anything to start, yo analyze how to build chat application in Flex? Thanks
[flexcoders] Re: I can't understand pureMVC
Ok, problem solved, my friend with more experience help :) I made stupid mistake, I have wrong mapped User VO, instead this: [RemoteClass(alias=BL.User)] Now I have this: [RemoteClass(alias=DemoFluorine.BL.User)] Thats why service returned me ObjectProxy --- In flexcoders@yahoogroups.com, Simon Bailey si...@... wrote: Yeh I heard about Flex wrapping results from certain remote requests using the ObjectProxy class, cant remember why this happens but try this and see what happens: var user:User = ObjectProxy( event.result ).object_proxy::object; Cheers, S On 24 Jun 2009, at 13:23, vladakg85 wrote: I am trying whole morning, I try to cast it in everything :( From remote service I return object User, same VO object like in flex application. But is this image below ok, becuse I don't see User object anywhere, this is my evt.result. http://img31.imageshack.us/img31/9747/debug2.jpg --- In flexcoders@yahoogroups.com, Simon Bailey simon@ wrote: Something is wrong with your assigning the remote result to the data in your Proxy. The 'data' object has not been cast to User() and is instead typed as ObjectProxy? On 23 Jun 2009, at 16:15, vladakg85 wrote: http://img37.imageshack.us/i/debug1.jpg/ this is debug from mediator. loginUserData is always null :( --- In flexcoders@yahoogroups.com, Simon Bailey simon@ wrote: Debug man, check the datatype of the object coming back from your remote request, maybe there is a problem with the cast. Is the Object from your remote result datatyped? Try assigning it to a var first and then debug to see if the cast works. If on debug you cast the result successfully and can see the cast variable in debugger no problem there should be no reason why you cannot then send that variable on a notification. What is showing in the debugger in your mediator? On 23 Jun 2009, at 15:50, vladakg85 wrote: I tried this data = evt.result as User; and its not work. I also tried to send User data with notification, same again. LoginCommand [code] override public function execute(notification:INotification):void { var myUser:User = notification.getBody() as User; var loginProxy:LoginProxy; loginProxy = facade.retrieveProxy(LoginProxy.NAME) as LoginProxy; loginProxy.tryLogin(myUser.username, myUser.password); } [/code] Mediator [code] override public function handleNotification(notification:INotification):void { switch (notification.getName()) { case ApplicationFacade.LOGIN_SUCCESFUL: var uProxy:LoginProxy; uProxy = facade.retrieveProxy(LoginProxy.NAME) as LoginProxy; var u:User = notification.getBody() as User; Alert.show(welcome: + u.realName+ , + u.City); break; case ApplicationFacade.LOGIN_FAILED: Alert.show(sorry pal, wrong password); break; } } [/code] --- In flexcoders@yahoogroups.com, Simon Bailey simon@ wrote: In your onResult method try assigning the data like: data = evt.result as User; // cast result to a User Object and assign to data Then you need to either: a) Have you mediator access the loginUserData directly (you may need to set it up as Bindable and dispatch an updated event - see http://bit.ly/14Rlqd and look at my HandleLoginProxy). b) Easier to assign the loginUserData as the notification body e.g. sendNotification( ApplicationFacade.LOGIN_SUCCESSFUL, loginUserData ); and in your Mediator register an interest in the LOGIN_SUCCESSFUL notification and simply pull out the loginUserData object using note.getBody(). I would go for option (b)! On 23 Jun 2009, at 14:59, vladakg85 wrote: Hi, thank you so much, I did something that I was trying for whole month :( ddd :) But now I have one more problem, this one is small :) 1) I make remote call to .NET to login user, everything is fine retrive data, check if user exists its ok, data from service are in proxy, this is my code for this: [code] public class LoginProxy extends Proxy implements IProxy { public static const NAME:String = loginProxy; private var loginRemoteService:RemoteObject; public function LoginProxy() { super(NAME, new User()); loginRemoteService = new RemoteObject(fluorine); loginRemoteService.source = BL.Sample; loginRemoteService .LoginUserByEnteredData.addEventListener
[flexcoders] Re: I can't understand pureMVC
I am trying whole morning, I try to cast it in everything :( From remote service I return object User, same VO object like in flex application. But is this image below ok, becuse I don't see User object anywhere, this is my evt.result. http://img31.imageshack.us/img31/9747/debug2.jpg --- In flexcoders@yahoogroups.com, Simon Bailey si...@... wrote: Something is wrong with your assigning the remote result to the data in your Proxy. The 'data' object has not been cast to User() and is instead typed as ObjectProxy? On 23 Jun 2009, at 16:15, vladakg85 wrote: http://img37.imageshack.us/i/debug1.jpg/ this is debug from mediator. loginUserData is always null :( --- In flexcoders@yahoogroups.com, Simon Bailey simon@ wrote: Debug man, check the datatype of the object coming back from your remote request, maybe there is a problem with the cast. Is the Object from your remote result datatyped? Try assigning it to a var first and then debug to see if the cast works. If on debug you cast the result successfully and can see the cast variable in debugger no problem there should be no reason why you cannot then send that variable on a notification. What is showing in the debugger in your mediator? On 23 Jun 2009, at 15:50, vladakg85 wrote: I tried this data = evt.result as User; and its not work. I also tried to send User data with notification, same again. LoginCommand [code] override public function execute(notification:INotification):void { var myUser:User = notification.getBody() as User; var loginProxy:LoginProxy; loginProxy = facade.retrieveProxy(LoginProxy.NAME) as LoginProxy; loginProxy.tryLogin(myUser.username, myUser.password); } [/code] Mediator [code] override public function handleNotification(notification:INotification):void { switch (notification.getName()) { case ApplicationFacade.LOGIN_SUCCESFUL: var uProxy:LoginProxy; uProxy = facade.retrieveProxy(LoginProxy.NAME) as LoginProxy; var u:User = notification.getBody() as User; Alert.show(welcome: + u.realName+ , + u.City); break; case ApplicationFacade.LOGIN_FAILED: Alert.show(sorry pal, wrong password); break; } } [/code] --- In flexcoders@yahoogroups.com, Simon Bailey simon@ wrote: In your onResult method try assigning the data like: data = evt.result as User; // cast result to a User Object and assign to data Then you need to either: a) Have you mediator access the loginUserData directly (you may need to set it up as Bindable and dispatch an updated event - see http://bit.ly/14Rlqd and look at my HandleLoginProxy). b) Easier to assign the loginUserData as the notification body e.g. sendNotification( ApplicationFacade.LOGIN_SUCCESSFUL, loginUserData ); and in your Mediator register an interest in the LOGIN_SUCCESSFUL notification and simply pull out the loginUserData object using note.getBody(). I would go for option (b)! On 23 Jun 2009, at 14:59, vladakg85 wrote: Hi, thank you so much, I did something that I was trying for whole month :( ddd :) But now I have one more problem, this one is small :) 1) I make remote call to .NET to login user, everything is fine retrive data, check if user exists its ok, data from service are in proxy, this is my code for this: [code] public class LoginProxy extends Proxy implements IProxy { public static const NAME:String = loginProxy; private var loginRemoteService:RemoteObject; public function LoginProxy() { super(NAME, new User()); loginRemoteService = new RemoteObject(fluorine); loginRemoteService.source = BL.Sample; loginRemoteService .LoginUserByEnteredData.addEventListener(ResultEvent.RESULT, onResult); loginRemoteService.addEventListener(FaultEvent.FAULT, onFault); } private function onResult(evt:ResultEvent):void { setData(evt.result); sendNotification(ApplicationFacade.LOGIN_SUCCESFUL); } private function onFault(evt:FaultEvent):void { sendNotification(ApplicationFacade.LOGIN_FAILED); } public function get loginUserData():User { return data as User; } public function tryLogin(p1:String, p2:String):void { loginRemoteService.LoginUserByEnteredData(p1, p2); } } } [/code] Problem is in mediator, because I send successful notification from proxy to mediator, and I want to preview returned data (Welcome: + name + username + city ... etc.), but problem is because loginUserData is null
[flexcoders] I can't understand pureMVC
I try to learn this framework for a month, and I always stack somewhere, and now I need help. What I know: to make view, to make mediators, to make commands.. But, I don't understand proxy at all. First what should be there. I think that this is the place where I store service call methods and keep returned data from server so I can use that data through every part of application (just to grab them). Ok, maybe I am ok with this, but I don't know how to implement this :(. 1) What should I do/type to store data in proxy and in what var? Is there any special var? 2) How to get specific data from proxy? 3) What is the connection between commands and proxy 4) If I have User Proxy with ability to log in user, log out user, display user name, display user details... should I put all this in one proxy or make separate: loginProxy getUserNameProxy userDetailsProxy etc. Please help me to understand this framework, I am crying :(` Thanks, for any answer
[flexcoders] Re: I can't understand pureMVC
Hi, thank you so much, I did something that I was trying for whole month :( ddd :) But now I have one more problem, this one is small :) 1) I make remote call to .NET to login user, everything is fine retrive data, check if user exists its ok, data from service are in proxy, this is my code for this: [code] public class LoginProxy extends Proxy implements IProxy { public static const NAME:String = loginProxy; private var loginRemoteService:RemoteObject; public function LoginProxy() { super(NAME, new User()); loginRemoteService = new RemoteObject(fluorine); loginRemoteService.source = BL.Sample; loginRemoteService.LoginUserByEnteredData.addEventListener(ResultEvent.RESULT, onResult); loginRemoteService.addEventListener(FaultEvent.FAULT, onFault); } private function onResult(evt:ResultEvent):void { setData(evt.result); sendNotification(ApplicationFacade.LOGIN_SUCCESFUL); } private function onFault(evt:FaultEvent):void { sendNotification(ApplicationFacade.LOGIN_FAILED); } public function get loginUserData():User { return data as User; } public function tryLogin(p1:String, p2:String):void { loginRemoteService.LoginUserByEnteredData(p1, p2); } } } [/code] Problem is in mediator, because I send successful notification from proxy to mediator, and I want to preview returned data (Welcome: + name + username + city ... etc.), but problem is because loginUserData is null. And in debug, data is full with data but they are private so can't use it, what I have done? --- In flexcoders@yahoogroups.com, Simon Bailey si...@... wrote: 1) What should I do/type to store data in proxy and in what var? Is there any special var? Typically the proxy is storing an Object with your data which could as your quite rightly state, be a result from a service call of some type. For example, an ArrayCollection containing all your user value objects. The IProxy interface exposes a property named data which is typed as an Object, this can be cast to data type you want and instantiated in your Proxy class constructor, set through the data reference and retrieved using a simple getter (see below): public function UserProxy() { super( NAME, new ArrayCollection ); // second param is instantiating the data Object casting as a new ArrayCollection } public function assignAllUsers( val:ArrayCollection ):void { data = val; // Assign the result from a service call to our data array collection } public function get userArrayCollection():ArrayCollection { return data as ArrayCollection; // return the proxy data object as an ArrayCollection } 2) How to get specific data from proxy? Using the public getter as shown above 3) What is the connection between commands and proxy You can use a command to interact with the proxy e.g. pass login information to the proxy which will send the data to a remote service for verification. 4) If I have User Proxy with ability to log in user, log out user, display user name, display user details... should I put all this in one proxy or make separate: loginProxy getUserNameProxy userDetailsProxy etc. Depends on what data, if we go by what you suggested i.e. username password and general user details then I personally would have a UserProxy which handles the user details as a whole. HTH, Simon [ Blog ] nutrixinteractive.com/blog/ On 23 Jun 2009, at 11:34, vladakg85 wrote: I try to learn this framework for a month, and I always stack somewhere, and now I need help. What I know: to make view, to make mediators, to make commands.. But, I don't understand proxy at all. First what should be there. I think that this is the place where I store service call methods and keep returned data from server so I can use that data through every part of application (just to grab them). Ok, maybe I am ok with this, but I don't know how to implement this :(. 1) What should I do/type to store data in proxy and in what var? Is there any special var? 2) How to get specific data from proxy? 3) What is the connection between commands and proxy 4) If I have User Proxy with ability to log in user, log out user, display user name, display user details
[flexcoders] Re: I can't understand pureMVC
I tried this data = evt.result as User; and its not work. I also tried to send User data with notification, same again. LoginCommand [code] override public function execute(notification:INotification):void { var myUser:User = notification.getBody() as User; var loginProxy:LoginProxy; loginProxy = facade.retrieveProxy(LoginProxy.NAME) as LoginProxy; loginProxy.tryLogin(myUser.username, myUser.password); } [/code] Mediator [code] override public function handleNotification(notification:INotification):void { switch (notification.getName()) { case ApplicationFacade.LOGIN_SUCCESFUL: var uProxy:LoginProxy; uProxy = facade.retrieveProxy(LoginProxy.NAME) as LoginProxy; var u:User = notification.getBody() as User; Alert.show(welcome: + u.realName+ , + u.City); break; case ApplicationFacade.LOGIN_FAILED: Alert.show(sorry pal, wrong password); break; } } [/code] --- In flexcoders@yahoogroups.com, Simon Bailey si...@... wrote: In your onResult method try assigning the data like: data = evt.result as User; // cast result to a User Object and assign to data Then you need to either: a) Have you mediator access the loginUserData directly (you may need to set it up as Bindable and dispatch an updated event - see http://bit.ly/14Rlqd and look at my HandleLoginProxy). b) Easier to assign the loginUserData as the notification body e.g. sendNotification( ApplicationFacade.LOGIN_SUCCESSFUL, loginUserData ); and in your Mediator register an interest in the LOGIN_SUCCESSFUL notification and simply pull out the loginUserData object using note.getBody(). I would go for option (b)! On 23 Jun 2009, at 14:59, vladakg85 wrote: Hi, thank you so much, I did something that I was trying for whole month :( ddd :) But now I have one more problem, this one is small :) 1) I make remote call to .NET to login user, everything is fine retrive data, check if user exists its ok, data from service are in proxy, this is my code for this: [code] public class LoginProxy extends Proxy implements IProxy { public static const NAME:String = loginProxy; private var loginRemoteService:RemoteObject; public function LoginProxy() { super(NAME, new User()); loginRemoteService = new RemoteObject(fluorine); loginRemoteService.source = BL.Sample; loginRemoteService .LoginUserByEnteredData.addEventListener(ResultEvent.RESULT, onResult); loginRemoteService.addEventListener(FaultEvent.FAULT, onFault); } private function onResult(evt:ResultEvent):void { setData(evt.result); sendNotification(ApplicationFacade.LOGIN_SUCCESFUL); } private function onFault(evt:FaultEvent):void { sendNotification(ApplicationFacade.LOGIN_FAILED); } public function get loginUserData():User { return data as User; } public function tryLogin(p1:String, p2:String):void { loginRemoteService.LoginUserByEnteredData(p1, p2); } } } [/code] Problem is in mediator, because I send successful notification from proxy to mediator, and I want to preview returned data (Welcome: + name + username + city ... etc.), but problem is because loginUserData is null. And in debug, data is full with data but they are private so can't use it, what I have done? --- In flexcoders@yahoogroups.com, Simon Bailey simon@ wrote: 1) What should I do/type to store data in proxy and in what var? Is there any special var? Typically the proxy is storing an Object with your data which could as your quite rightly state, be a result from a service call of some type. For example, an ArrayCollection containing all your user value objects. The IProxy interface exposes a property named data which is typed as an Object, this can be cast to data type you want and instantiated in your Proxy class constructor, set through the data reference and retrieved using a simple getter (see below): public function UserProxy() { super( NAME, new ArrayCollection ); // second param is instantiating the data Object casting as a new ArrayCollection } public function assignAllUsers( val:ArrayCollection ):void { data = val; // Assign the result from a service call to our data array collection } public function get userArrayCollection():ArrayCollection { return data as ArrayCollection; // return the proxy data object
[flexcoders] Re: I can't understand pureMVC
http://img37.imageshack.us/i/debug1.jpg/ this is debug from mediator. loginUserData is always null :( --- In flexcoders@yahoogroups.com, Simon Bailey si...@... wrote: Debug man, check the datatype of the object coming back from your remote request, maybe there is a problem with the cast. Is the Object from your remote result datatyped? Try assigning it to a var first and then debug to see if the cast works. If on debug you cast the result successfully and can see the cast variable in debugger no problem there should be no reason why you cannot then send that variable on a notification. What is showing in the debugger in your mediator? On 23 Jun 2009, at 15:50, vladakg85 wrote: I tried this data = evt.result as User; and its not work. I also tried to send User data with notification, same again. LoginCommand [code] override public function execute(notification:INotification):void { var myUser:User = notification.getBody() as User; var loginProxy:LoginProxy; loginProxy = facade.retrieveProxy(LoginProxy.NAME) as LoginProxy; loginProxy.tryLogin(myUser.username, myUser.password); } [/code] Mediator [code] override public function handleNotification(notification:INotification):void { switch (notification.getName()) { case ApplicationFacade.LOGIN_SUCCESFUL: var uProxy:LoginProxy; uProxy = facade.retrieveProxy(LoginProxy.NAME) as LoginProxy; var u:User = notification.getBody() as User; Alert.show(welcome: + u.realName+ , + u.City); break; case ApplicationFacade.LOGIN_FAILED: Alert.show(sorry pal, wrong password); break; } } [/code] --- In flexcoders@yahoogroups.com, Simon Bailey simon@ wrote: In your onResult method try assigning the data like: data = evt.result as User; // cast result to a User Object and assign to data Then you need to either: a) Have you mediator access the loginUserData directly (you may need to set it up as Bindable and dispatch an updated event - see http://bit.ly/14Rlqd and look at my HandleLoginProxy). b) Easier to assign the loginUserData as the notification body e.g. sendNotification( ApplicationFacade.LOGIN_SUCCESSFUL, loginUserData ); and in your Mediator register an interest in the LOGIN_SUCCESSFUL notification and simply pull out the loginUserData object using note.getBody(). I would go for option (b)! On 23 Jun 2009, at 14:59, vladakg85 wrote: Hi, thank you so much, I did something that I was trying for whole month :( ddd :) But now I have one more problem, this one is small :) 1) I make remote call to .NET to login user, everything is fine retrive data, check if user exists its ok, data from service are in proxy, this is my code for this: [code] public class LoginProxy extends Proxy implements IProxy { public static const NAME:String = loginProxy; private var loginRemoteService:RemoteObject; public function LoginProxy() { super(NAME, new User()); loginRemoteService = new RemoteObject(fluorine); loginRemoteService.source = BL.Sample; loginRemoteService .LoginUserByEnteredData.addEventListener(ResultEvent.RESULT, onResult); loginRemoteService.addEventListener(FaultEvent.FAULT, onFault); } private function onResult(evt:ResultEvent):void { setData(evt.result); sendNotification(ApplicationFacade.LOGIN_SUCCESFUL); } private function onFault(evt:FaultEvent):void { sendNotification(ApplicationFacade.LOGIN_FAILED); } public function get loginUserData():User { return data as User; } public function tryLogin(p1:String, p2:String):void { loginRemoteService.LoginUserByEnteredData(p1, p2); } } } [/code] Problem is in mediator, because I send successful notification from proxy to mediator, and I want to preview returned data (Welcome: + name + username + city ... etc.), but problem is because loginUserData is null. And in debug, data is full with data but they are private so can't use it, what I have done? --- In flexcoders@yahoogroups.com, Simon Bailey simon@ wrote: 1) What should I do/type to store data in proxy and in what var? Is there any special var? Typically the proxy is storing an Object with your data which could as your quite rightly state, be a result from a service call of some type. For example, an ArrayCollection containing all your user value objects. The IProxy interface exposes a property named data which is typed as an Object, this can be cast to data type you want and instantiated in your Proxy class constructor, set through the data reference and retrieved using a simple getter (see below): public function UserProxy