[flexcoders] Re: Items with variable width ? (TileBase component that don't override items width)
I'm having a similar problem, couldn't find a good way to enforce the HorizontalList to enable items with different width. --- In flexcoders@yahoogroups.com, z_babin [EMAIL PROTECTED] wrote: Hello, The result should be an HorizontalList like component (with all features; dataProvider, Layout, Effects Events...) but does not override it's items width property. Problem is that any component extending TileBase is setting it's items width and height and that makes it impossible for the item to set it's width. I have been looking into ListBase, TileBase and tried to override the measure function on the itemRenderer (which does not seem like a good idea).. Before I'm going to implement a new component from scratch (thought about using OpenFlux).. anyone got some ideas ?
[flexcoders] Re: Keyboard navigating through List's item renderers
Hi Alex, sorry for the long delay... The item renderer in fact implements the IFocusManagerComponent, however, there are other issues, consider an item renderer with 2 TextInputs, it should allow the user to tab along the TexInputs with the Tab or the Shift+Tab key. That would require these event handlers: 1. The renderer itself By overriding the setFocus() function teh following behavior can be achieved: a. Tab - Pass the focus to its first TextInput, b. Shift+Tab - Another item renderer or the upper left component should receive the focus as determined by the default screen order. 2. The first input field What's tricky here is that we only want to know when the focus is about to be changed through keyboard interaction, not mouse, the FocusEvent.KEY_FOCUS_CHANGE whose target is the the currently focused InteractiveObject should be used. So for the FocusEvent.KEY_FOCUS_CHANGE: a. Tab - pass the focus to the next input field b. Shift+Tab - behave like the renderer itself when focused using shift tab (it should behave just like the renderer instead of passing the focus to the renderer and let it handle the rest, because use the same behavior instead of 3. The 2nd input field Here the FocusEvent.KEY_FOCUS_CHANGE is useful too because the focus should move backward to the first input field when using Shift+Tab and and the default behavior would handle Tab and pass the focus to the next element And this is the renderer code that tries (and somewhat fails) to implement the above behavior: http://paste.bradleygill.com/index.php?paste_id=2273 The main problem is the Shift+Tag when trying moving from renderer to renderer, which is when the List hijacks the focus..:| Another issue is undesirable behavior when using both mouse and keyboard. I know noticed that there is a very similar thread going on here: http://tech.groups.yahoo.com/group/flexcoders/message/121233 Also, I used the search but didn't find any solution yet. Thanks again, Almog Kurtser http://www.mostlyflex.com --- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: You're headed in the right direction. I think you have to implement IFocusManagerComponent on the renderer, and handle KEY_FOCUS_CHANGE. FWIW, I wouldn't use a Form since it is pretty heavy. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of mydarkspoon Sent: Thursday, July 31, 2008 7:31 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Keyboard navigating through List's item renderers Hi, I have a list that renders meta data about images (title tags). This list uses a Form with 2 TextInput controls as an item renderer. The user should be able to navigate through the input fields using either the mouse or the tab key. The List default behavior when editable=true is to set the focus to the renderers themselves, but not to their sub components, so the Form itself will have a focus rectangle but not the TextInput controls. What I tried to do is to override the setFocus() on the Form subcomponent and move the focus to the first TextInput and on that TextInput focusOut set its focus to the 2nd TextInput. That didn't work as expected, and even if it did, I'm sure the is a better way to achieve this behavior. Thank you, Almog Kurtser http://www.mostlyflex.com http://www.mostlyflex.com
[flexcoders] Keyboard navigating through List's item renderers
Hi, I have a list that renders meta data about images (title tags). This list uses a Form with 2 TextInput controls as an item renderer. The user should be able to navigate through the input fields using either the mouse or the tab key. The List default behavior when editable=true is to set the focus to the renderers themselves, but not to their sub components, so the Form itself will have a focus rectangle but not the TextInput controls. What I tried to do is to override the setFocus() on the Form subcomponent and move the focus to the first TextInput and on that TextInput focusOut set its focus to the 2nd TextInput. That didn't work as expected, and even if it did, I'm sure the is a better way to achieve this behavior. Thank you, Almog Kurtser http://www.mostlyflex.com
[flexcoders] Re: Debugging problems with Firefox 3 Final
I found some workaround - set the wmode to opaque. it seems to work on xp, more about it here: http://mostlyflex.com/2008/06/23/firefox3-vs-flex-builder/ Cheers, Almog Kurtser --- In flexcoders@yahoogroups.com, João Fernandes [EMAIL PROTECTED] wrote: Hi there, did anyone had problems with the final version of Firefox 3? Each time I make a change, I have to do a 'clean' to be able to debug my application again. Anyone noticed this? -- João Fernandes http://www.onflexwithcf.org http://www.riapt.org Portugal Adobe User Group (http://aug.riapt.org)
[flexcoders] SecurityDomain.currentDomain causes weird loaderInfo.url
Hi, I have swf file loaded into another swf from different domain. The swf is loaded into the same security domain (SecurityDomain.currentDomain). Both swf explicitly trust each other's domains so I don't experience any security violations. The loading works fine and I'm able to do cross scripting, however, I experience one strange problem: the loaded swf's url (loaderInfo.url) turns out to be a concatenation of the loader url + loaded swf url. For example, I created domains in my hosts file: loader and content, both are localhost and only meant to simulate cross domains: When the swf from http://content is loaded into the swf from http://loader, it traces it's url, which I expected to be: http://content/FileThatTracesItsUrl.swf However, instead of the above url ,it traces out this exact url: http://loader/[[IMPORT]]/content/FileThatTracesItsUrl.swf; This only happen when the SecurityDomain is set to SecurityDomain.currentDomain, if the swf is loaded into new SecurityDomain (by not specifying it, or passing null), the url resolves to: http://content/FileThatTracesItsUrl.swf which is just what I expected to happen. For the mean while, I simply extracted the correct url using String.substr, nevertheless, I'd be glad to know what's the reason for this or how this can be avoided. Thanks in advance, Almog Kustser.
[flexcoders] Re: SecurityDomain.currentDomain causes weird loaderInfo.url
Thanks Alex, I couldn't find any info about it elsewhere... I guess it got to be one of the most difficult things to search on google since there is no way to search for brackets and the word import is too common in flex issues...grrr. Thanks again, Almog Kurtser --- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: Yeah, known issue. No way to avoid that we know of. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of mydarkspoon Sent: Thursday, June 19, 2008 2:36 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] SecurityDomain.currentDomain causes weird loaderInfo.url Hi, I have swf file loaded into another swf from different domain. The swf is loaded into the same security domain (SecurityDomain.currentDomain). Both swf explicitly trust each other's domains so I don't experience any security violations. The loading works fine and I'm able to do cross scripting, however, I experience one strange problem: the loaded swf's url (loaderInfo.url) turns out to be a concatenation of the loader url + loaded swf url. For example, I created domains in my hosts file: loader and content, both are localhost and only meant to simulate cross domains: When the swf from http://content is loaded into the swf from http://loader, it traces it's url, which I expected to be: http://content/FileThatTracesItsUrl.swf http://content/FileThatTracesItsUrl.swf However, instead of the above url ,it traces out this exact url: http://loader/[[IMPORT]]/content/FileThatTracesItsUrl.swf; This only happen when the SecurityDomain is set to SecurityDomain.currentDomain, if the swf is loaded into new SecurityDomain (by not specifying it, or passing null), the url resolves to: http://content/FileThatTracesItsUrl.swf http://content/FileThatTracesItsUrl.swf which is just what I expected to happen. For the mean while, I simply extracted the correct url using String.substr, nevertheless, I'd be glad to know what's the reason for this or how this can be avoided. Thanks in advance, Almog Kustser.
[flexcoders] Re: Two questions: Nested applications styles colllisions, flashvars injection
Hi Alex, thanks for your reply. I guess you're right about the styles, since we use modal window to open the loaded swf, we simply unloaded the main app styles before loading the 2nd app. Then, when the user is done with the loaded swf, we called it's deactivate() method which unloads its styles and the main app reloads its styles. About the flashvars, I made it work, in a very hacky way, but I can't think of anything else. Basically, the solution is to catch the right moment to inject data to the application.parameters, which is between when the application gets a copy of the SystemManager.parameters and the tyime when the application dispatces a preinitialize event, which is the time for the app to start kicking. The only way I found to catch this moment was to use the event UIComponent.dispatchEventHook and check for the first preinitialize event. I had 2 problems with that: 1. I use actionscript only application for the wrapper, otherwise it will make no sense to use a wrapper - that can be solved by copying the mx_internal to access the UIComponent.dispatchEventHook and using ApplicationDomain.getDefinition() 2. The UIComponent class definition is only avialable through ApplicationDomain.getDefinition() at the SystemManager 2nd frame So at first, I thought I could simply add an event listener to the enterFrame, but then I found out, that the enterFrame is always dispatched after the frameScript function, which in some cases can be too late, because the application can get initialized and disapcth the preinitialize before the first enterFrame event for frame 2 is dispacthed. So, to overcome these timing issues I had to override the call to the SystemManager.docFrameHandler, by passing my own frameScript function where I first acquire the UICompoennt class definition to use its dispatch hook, and only then call the SystemManager.docFrameHandler manually Enough bubbling, here is the code, it's hacky, I'm aware of the risk of using the mx_internal, but currently it works, so here it is: package { import flash.display.Loader; import flash.display.MovieClip; import flash.display.StageAlign; import flash.display.StageScaleMode; import flash.events.Event; import flash.net.URLRequest; import mx.managers.SystemManager; SystemManager; import mx.core.mx_internal; import mx.core.EventPriority; //import mx.core.mx_internal; public class SWFWrapper extends MovieClip { //import mx.core.mx_internal; private var _loader:Loader = new Loader; private var _systemManager:MovieClip; private var _classUiComponent:Class; use namespace mx_internal; public function SWFWrapper() { stage.scaleMode = StageScaleMode.NO_SCALE; stage.align = StageAlign.TOP_LEFT; _loader.contentLoaderInfo.addEventListener(Event.INIT, loaderCompleteHandler, false, EventPriority.DEFAULT_HANDLER); _loader.load(new URLRequest(Loadee.swf)); this.addChild(_loader); } private function loaderCompleteHandler(completeEvent:Event):void { _systemManager = _loader.content as MovieClip; _systemManager.addFrameScript(1, docFrameHandler); } private function docFrameHandler(e:Event = null):void { _classUiComponent = _systemManager.loaderInfo.applicationDomain.getDefinition(mx.core.UIComponent) as Class; _classUiComponent.mx_internal::[dispatchEventHook] = myEventHook; _systemManager.mx_internal::[docFrameHandler](); } private function myEventHook(event:Event, uic:Object):void { if (event.type == preinitialize _firstTime) { _firstTime = false; _systemManager[application][parameters][message] = Great success!; } } } } --- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: There is no good way to have a loaded SWF keep its own styles. There might be in 3.x later this year. Since you own both SWFs, I'd simply have a handshake between the loader and the loaded app. Sublcass App, override its parameters property and have it query the loading Apps loaderInfo.parameters. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of mydarkspoon Sent: Saturday, May 31, 2008 4:22 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Two questions: Nested applications styles colllisions, flashvars injection Hi all, I'm
[flexcoders] Re: Two questions: Nested applications styles colllisions, flashvars injection
The _firstTime var declaration was dropped out of the code. it's: private static var _firstTime:Boolean = true; Actually, the reason I used the first time is quite weird, if I set the dispatchEventHook to null after getting the first preinitialize event, it keeps calling it... However, if I set it to ther fucntion it will call the other function. Thanks, Almog Kurtser, http://www.kaltura.com/ --- In flexcoders@yahoogroups.com, mydarkspoon [EMAIL PROTECTED] wrote: Hi Alex, thanks for your reply. I guess you're right about the styles, since we use modal window to open the loaded swf, we simply unloaded the main app styles before loading the 2nd app. Then, when the user is done with the loaded swf, we called it's deactivate() method which unloads its styles and the main app reloads its styles. About the flashvars, I made it work, in a very hacky way, but I can't think of anything else. Basically, the solution is to catch the right moment to inject data to the application.parameters, which is between when the application gets a copy of the SystemManager.parameters and the tyime when the application dispatces a preinitialize event, which is the time for the app to start kicking. The only way I found to catch this moment was to use the event UIComponent.dispatchEventHook and check for the first preinitialize event. I had 2 problems with that: 1. I use actionscript only application for the wrapper, otherwise it will make no sense to use a wrapper - that can be solved by copying the mx_internal to access the UIComponent.dispatchEventHook and using ApplicationDomain.getDefinition() 2. The UIComponent class definition is only avialable through ApplicationDomain.getDefinition() at the SystemManager 2nd frame So at first, I thought I could simply add an event listener to the enterFrame, but then I found out, that the enterFrame is always dispatched after the frameScript function, which in some cases can be too late, because the application can get initialized and disapcth the preinitialize before the first enterFrame event for frame 2 is dispacthed. So, to overcome these timing issues I had to override the call to the SystemManager.docFrameHandler, by passing my own frameScript function where I first acquire the UICompoennt class definition to use its dispatch hook, and only then call the SystemManager.docFrameHandler manually Enough bubbling, here is the code, it's hacky, I'm aware of the risk of using the mx_internal, but currently it works, so here it is: package { import flash.display.Loader; import flash.display.MovieClip; import flash.display.StageAlign; import flash.display.StageScaleMode; import flash.events.Event; import flash.net.URLRequest; import mx.managers.SystemManager; SystemManager; import mx.core.mx_internal; import mx.core.EventPriority; //import mx.core.mx_internal; public class SWFWrapper extends MovieClip { //import mx.core.mx_internal; private var _loader:Loader = new Loader; private var _systemManager:MovieClip; private var _classUiComponent:Class; use namespace mx_internal; public function SWFWrapper() { stage.scaleMode = StageScaleMode.NO_SCALE; stage.align = StageAlign.TOP_LEFT; _loader.contentLoaderInfo.addEventListener(Event.INIT, loaderCompleteHandler, false, EventPriority.DEFAULT_HANDLER); _loader.load(new URLRequest(Loadee.swf)); this.addChild(_loader); } private function loaderCompleteHandler(completeEvent:Event):void { _systemManager = _loader.content as MovieClip; _systemManager.addFrameScript(1, docFrameHandler); } private function docFrameHandler(e:Event = null):void { _classUiComponent = _systemManager.loaderInfo.applicationDomain.getDefinition(mx.core.UIComponent) as Class; _classUiComponent.mx_internal::[dispatchEventHook] = myEventHook; _systemManager.mx_internal::[docFrameHandler](); } private function myEventHook(event:Event, uic:Object):void { if (event.type == preinitialize _firstTime) { _firstTime = false; _systemManager[application][parameters][message] = Great success!; } } } } --- In flexcoders@yahoogroups.com, Alex Harui aharui@ wrote: There is no good way to have a loaded SWF keep its own styles. There might be in 3.x later this year. Since you own both SWFs, I'd simply have
[flexcoders] Two questions: Nested applications styles colllisions, flashvars injection
Hi all, I'm targeting here 2 problems I've been struggling with for quite long time regarding nested SWFs. The first, which is more nasty and 5 times more evil is using different styles for 2 flex applications where one application is loaded into the shell app. The behavior I'd like to have is like this: 1. If the loaded app uses a class selector greenButton and the loader also uses this app, each of the applications would be able to use the greenButton definition it came with. 2. Same as no. 1 but for type selectors (e.g Alert{...}, Button{...}). 3. If the loaded app uses some component, whose styles weren't defined (no class, nor type selctors) it would inherit these styles from the loader app. I can settle down without no. 3, but I can/t find anyway to achieve 1 2. To make this question clearer, I made a small app http://www.2shared.com/file/3367026/55565dba/StylesTests.html?A that demonstrate the problem I'm refering: The second issue that gives me hard time is like this: I use a wrapper swf to load my main flex application. it works just fine, it's a 1KB swf that does nothing but load a flex application. However, the flex application is unaware of it being loaded into a wrapper swf, and since it uses flashvars to know the basic coniguration to work with (service url and so...), it reads the Application.application.parameters. The application.parameters, as you know is simply the LoaderInfo.parameters copied into the application by thye SystemManager. What I'd like to do is to inject the application the wrapper swf flashvars (which is embedded in the html page) just before the application dispatches the preinitialize event, which is where client-server communication starts. I could just load the flex app with query string (app.swf?mode=5), but that would prevent browser caching, which I'd like to leverage on. Then, the other options are: 1. Get a hold of the loaded swf root (SystemManager) and set it's LoaderInfo.parameters to {mode: 5}. that would not work as this is a read only property... 2. ok,so whay won't you get a reference of that parameters object and dynamically add some properties to it like that: var p:Object = loader.content.parameters; p.mode = 5; sounds ok, but guess what? every time you access the loaderInfo.parameters it returns a different copy it, so you end up with different object every time and can't add new proprties to the soource object...grrr 3. Ok, so hacking my way there, I thought of changing the loader.content[application].parameters, shich is a property copoed from the SystemManager's loaderinfo.parameters.However, that can be done only after the SystemManager dispatches an applicationComplete event (because the sys manager just doesn't informs us of any other events...), which isn't the best time to change the parameters, because the loaded application can take a hold of them right after the preinitialize event, which is when I always start to fetch configuration data from the server. I'd be grateful for any ideas. [:)] Thanks in advance, Almog Kurtser.
[flexcoders] Maintaining styles and locales(proeprties files)
Hi, I'm currently working on a project where both styles and language content are externalized and loaded at runtime. The same application is supplied to all clients from the same code base, and the changes are only made on the locales/styles. As the styles and the locales are compiled for every client differently, they're located on separated projects: -Main application project (Same code base for all clients) -Styles flex project (per client) -Locale project (per client) Since the main app is rapidly being developed, new styles and texts are added. Whenever new text is added to the app, it needs to be added to each and every locale project, even if all clients share the same text. same goes with styles. This is a quite maintenance issue and I'm looking for ways to make this proccess easier. I'll be really glad to get get some advices regarding maintenance of such architecture. Thanks in advance, Almog Kurtser.
[flexcoders] Re: Maintaining styles and locales(proeprties files)
I don't see how this can help maintaining the projects. Maybe I didn't explain myself, basically, the configuration is like: Every client has 2 projects: style project and locales project. If I have 2 clients, both would have, for the simplicty, these 2 files: Client A's style project: .myCoolButton { color: #FF; } Client B's style project: .myCoolButton { color: #FF; } Now, all I have to do is to compile each client style and dynamically load it, leaving the main up ignorant of the client. However, lets say I need to add new screen with some new kind of button, I'll need to add a new class selector all clients' style projects, one by one, that's the maintenance issue I have - I don't want to go through N projects just because I need to ass new text/style... Thanks, Almog Kurtser --- In flexcoders@yahoogroups.com, Mayur Bais [EMAIL PROTECTED] wrote: can u not keep the styles and text file..in once folder.. and add that folder as a external source path ..to all ur locale project.. and there by only one copy gets used across all projects... On 5/13/08, mydarkspoon [EMAIL PROTECTED] wrote: Hi, I'm currently working on a project where both styles and language content are externalized and loaded at runtime. The same application is supplied to all clients from the same code base, and the changes are only made on the locales/styles. As the styles and the locales are compiled for every client differently, they're located on separated projects: -Main application project (Same code base for all clients) -Styles flex project (per client) -Locale project (per client) Since the main app is rapidly being developed, new styles and texts are added. Whenever new text is added to the app, it needs to be added to each and every locale project, even if all clients share the same text. same goes with styles. This is a quite maintenance issue and I'm looking for ways to make this proccess easier. I'll be really glad to get get some advices regarding maintenance of such architecture. Thanks in advance, Almog Kurtser.
[flexcoders] Segment and Interval Tree implementation for Actionscript?
Hi, I'm implementing a timeline related tracking class, where I have timeline objects with inTime and outTime, and I need the ability to retrieve all objects for time value. I found 2 suitable data structures for this task: Interval tree and Segment tree. Has anyone seen an implementation of these data structures for actionscript? Thanks in advance, Almog Kurtser
[flexcoders] Flex component kit - ContainerMovieClip content scaleX/scaleY changes...
Hi, I'm using the flex component kit to create custom skinned containers. It all works fine, except for one very annoying thing: When I change the container width/height, the content scaleX and sclaeY are being changed instead of the width/height. This causes some really nasty effect. For example, the TextArea's focus rectangle is stretched..grr..this seems ugly. Has anyone have experienced that sort of thing? Thanks!
[flexcoders] Font.registerFont() throws error when called from partitioned ApplicationDomain
Hi, I encountered a problem when having a main swf (flex app) that loads another flex application into a partitioned application domain (new ApplicationDomain()) and the loaded swf tries to register a font using either the Font.registerFont or using embeded font in style sheet (which behind the scenes does the same as the Font.registerFont does) However, when the loaded swf is loaded into a child app domain, it works fine. Since both the main swf and the loaded swf are in a separated application domains (under the FP system app domain) I can't see why such error from a system domain class is thrown. I uploaded the sample project I made to demonstrate the error: http://www.2shared.com/file/3086720/386245a0/AppDomainHell.html Thanks a lot.
[flexcoders] Any existing Sound-NetStream Façade to play mp3/flv ?
Hi, I encountered a problem with existing application that plays audio from a given URL. The URL was an flv file, which the Actionscript Sound class doesn't support. Just before I write my own Façade for Sound and Netstream, I'm curious if anybody ever seen an existing lib that can do it ? Thanks.
[flexcoders] Re: Using module from Flex library project
Hi Guarev, I really appreciate your help. I now tried what you suggested and it works! Also, I made the project I uploaded to work as well, by just adding another path to the shell app source path: ${DOCUMENTS}/ModulesHome/locale/{locale} Well, I feel kinda stupid for not finding this out earlier. This simply let the shell find the right locale from the module. I think this is a bit more easy to use, because you don't have to copy the module to the shell app bin dir. Thanks again! Almog Kurtser. --- In flexcoders@yahoogroups.com, Gaurav Jain [EMAIL PROTECTED] wrote: I looked at the project file you sent. If you follow the instructions I sent you earlier, you should be all set. 1. Delete MainApp.mxml from ModulesHome project. 2. Modify ModulesHome project by setting do not optimize for any project 3. remove the source path entry (for module home) from the main app project. 4. Modify MainApp project's compile setting and add -link-report=C:\lnkreport.xml 5. Modify MoulesHome compiler setting and add -load-externs=C:\lnkreport.xm finally before running copy the module swf from ModuleHome to MainApp (nect to the MainApp.swf). Thanks, Gaurav --- In flexcoders@yahoogroups.com, mydarkspoon mydarkspoon@ wrote: --- In flexcoders@yahoogroups.com, Gaurav Jain gauravj@ wrote: The flex project that uses the module puts the module home project in its source path, Why is it required? Since you module is supposedly independent of your main app, you do not need to specify it in the source path. However, when compiling the main app (the shell) it complains about the module's locale files (ModuleTexts.properties for example) Are you using some class from the module project directly in your main app? I would suggest to have main app independent of the module classes, if that is not possble including module home/locale/en_US in the source path of main app should resolve the compilation errors. Thanks, Gaurav Hi again, Putting the locales in the source path merely won't help compiling, because the locales are treated differently. I put an example siutuation online, the link is in my previous post. Thanks, Almog Kurtser
[flexcoders] Using module from Flex library project
Hello, I've developed a small flex module which I used inside flex project. Now I want to allow different applications to use that module, so I thought the best way to allow them using it is to distibute the module in a flex library project. However, when I put the library project in the source path of new flex project and mark it as a module, I get compile errors telling me that the *new project* (not the lib project) can't find the module resources (locales). I think the lib project should be the one responsible of having these locale resources, not the flex project that uses it. in the flex lib project I put this in the additional compiler arguments: -locale=en_US -allow-source-path-overlap=true -incremental=true and added the locales to the source path: locale/{locale} (just like I've done in a regular flex project) Any ideas of what I'm wrong ? (When running the module in a regular flex project, I get it to compile fine with the locales) Thanks in advance, Almog Kurtser.
[flexcoders] Re: Using module from Flex library project
Thanks for your response, but RSL won't fit in this situation. RSL are loaded at the application startup, however, I'm using module because I want to load the component by demand. I've used modules before, but never been using modules that sits in a different project. It's important that the module will be separated from the main app/apps so that one developer can add features to the module, while another one can work on the loader app and have an up-to-date module compiled using source control. Cheers, Almog Kurtser. --- In flexcoders@yahoogroups.com, Gaurav Jain [EMAIL PROTECTED] wrote: The idea behind modules is to make your main app smaller (by breaking into modules) so that you can speed up initial load time. And load/unload modules when ever required. By default when you compile a module, flex builder optimizes it for the main application - which means it does not add classes to the module which are already in the main app. You can share the same module between different applications as long as you don't optimize your module for any particular app. Module is runtime thing. Adding module into a library will not work. If you are looking to share common code across application and are not interested in modules, you can use libraries. Also if you want to share code across different application but you want to do so at runtime, you can benefit from using runtime shared libraries. For more information about rsls see here http://livedocs.adobe.com/labs/flex3/html/help.html?content=rsl_02.html Thanks, Gaurav --- In flexcoders@yahoogroups.com, mydarkspoon mydarkspoon@ wrote: Hello, I've developed a small flex module which I used inside flex project. Now I want to allow different applications to use that module, so I thought the best way to allow them using it is to distibute the module in a flex library project. However, when I put the library project in the source path of new flex project and mark it as a module, I get compile errors telling me that the *new project* (not the lib project) can't find the module resources (locales). I think the lib project should be the one responsible of having these locale resources, not the flex project that uses it. in the flex lib project I put this in the additional compiler arguments: -locale=en_US -allow-source-path-overlap=true -incremental=true and added the locales to the source path: locale/{locale} (just like I've done in a regular flex project) Any ideas of what I'm wrong ? (When running the module in a regular flex project, I get it to compile fine with the locales) Thanks in advance, Almog Kurtser.
[flexcoders] Re: Using module from Flex library project
Him Guarev, I tried what you suggested but the errors only appears when using using the flex localization. My Module locales are located in -projectHome --locale en_US --src The flex project that uses the module puts the module home project in its source path, and since the module uses locales (under [project home dir]locale\en_US) I want the module to include these locales at compile time. However, when compiling the main app (the shell) it complains about the module's locale files (ModuleTexts.properties for example) How does the main app knows about the locales ? It reads the [ResourceBundle(ModuleTexts)] from the module file and looks for them at it's own project, not looking inside the modules project to see if the locales are there. That's seems reasonable, since it doesn't uses the project itself, but the source path, in which there is no information of the locale path. How I can get rid off these errors ? include the locale properties files inside the shell app. I did this only for testing, since it's tears apart the module encapsulation and add extra responsibility for someone using this module... :| I uploaded the 2 flex projects so anyone can see the error: http://www.filefactory.com/file/109714 Thanks again. Almog Kurtser. --- In flexcoders@yahoogroups.com, Gaurav Jain [EMAIL PROTECTED] wrote: So I assume you are just looking to move module(s) into a separate flex builder project? If my assumption is correct read on. It is possible to load the modules from a different project. A module is after all a SWF so you theoretically be able to load it from a url (as long as you don't run into domain issues). Here is what I would do. 1. Create a Flex Project in Flex Builder. 2. Add what ever modules, you need to add. 3. Delete the main app file (from this project). 4. Go to project properties - Flex modules - double click on all modules (one by one) and remove the option for Optimize for. The disadvantage for moving modules to a separate project is that you loose capability for automatic optimize for. This is used to reduce the size of the module by not duplicating classes which are already in the main application. However there is a workaround: In the main project (from which you want to move *out* all modules): 1. Go to project properties - Flex compiler 2. In the additional compiler arguments add -link-report=lnkreport.xml (you can also give the absolute path for where you want the link report to be generated). Now in the project which will contain modules. 1. Go to project properties - Flex compiler 2. In the additional compiler arguments add -load-externs=lnkreport.xml (make sure path is same as what you gave in the main project). This would make sure that modules in the separate project would be optimized for your main app. Now since you moved them to a different project, you need to copy the compiled modules to the location specified by the url used to load the modules. or simply change the Output folder for the modules project by going to project properties - flex build path HTH, Gaurav --- In flexcoders@yahoogroups.com, mydarkspoon mydarkspoon@ wrote: Thanks for your response, but RSL won't fit in this situation. RSL are loaded at the application startup, however, I'm using module because I want to load the component by demand. I've used modules before, but never been using modules that sits in a different project. It's important that the module will be separated from the main app/apps so that one developer can add features to the module, while another one can work on the loader app and have an up-to-date module compiled using source control. Cheers, Almog Kurtser. --- In flexcoders@yahoogroups.com, Gaurav Jain gauravj@ wrote: The idea behind modules is to make your main app smaller (by breaking into modules) so that you can speed up initial load time. And load/unload modules when ever required. By default when you compile a module, flex builder optimizes it for the main application - which means it does not add classes to the module which are already in the main app. You can share the same module between different applications as long as you don't optimize your module for any particular app. Module is runtime thing. Adding module into a library will not work. If you are looking to share common code across application and are not interested in modules, you can use libraries. Also if you want to share code across different application but you want to do so at runtime, you can benefit from using runtime shared libraries. For more information about rsls see here http://livedocs.adobe.com/labs/flex3/html/help.html?content=rsl_02.html Thanks, Gaurav --- In flexcoders@yahoogroups.com, mydarkspoon mydarkspoon@ wrote: Hello, I've developed a small flex module which I used inside flex
[flexcoders] Re: Using module from Flex library project
*Him=Hi --- In flexcoders@yahoogroups.com, mydarkspoon [EMAIL PROTECTED] wrote: Him Guarev, I tried what you suggested but the errors only appears when using using the flex localization. My Module locales are located in -projectHome --locale en_US --src The flex project that uses the module puts the module home project in its source path, and since the module uses locales (under [project home dir]locale\en_US) I want the module to include these locales at compile time. However, when compiling the main app (the shell) it complains about the module's locale files (ModuleTexts.properties for example) How does the main app knows about the locales ? It reads the [ResourceBundle(ModuleTexts)] from the module file and looks for them at it's own project, not looking inside the modules project to see if the locales are there. That's seems reasonable, since it doesn't uses the project itself, but the source path, in which there is no information of the locale path. How I can get rid off these errors ? include the locale properties files inside the shell app. I did this only for testing, since it's tears apart the module encapsulation and add extra responsibility for someone using this module... :| I uploaded the 2 flex projects so anyone can see the error: http://www.filefactory.com/file/109714 Thanks again. Almog Kurtser. --- In flexcoders@yahoogroups.com, Gaurav Jain gauravj@ wrote: So I assume you are just looking to move module(s) into a separate flex builder project? If my assumption is correct read on. It is possible to load the modules from a different project. A module is after all a SWF so you theoretically be able to load it from a url (as long as you don't run into domain issues). Here is what I would do. 1. Create a Flex Project in Flex Builder. 2. Add what ever modules, you need to add. 3. Delete the main app file (from this project). 4. Go to project properties - Flex modules - double click on all modules (one by one) and remove the option for Optimize for. The disadvantage for moving modules to a separate project is that you loose capability for automatic optimize for. This is used to reduce the size of the module by not duplicating classes which are already in the main application. However there is a workaround: In the main project (from which you want to move *out* all modules): 1. Go to project properties - Flex compiler 2. In the additional compiler arguments add -link-report=lnkreport.xml (you can also give the absolute path for where you want the link report to be generated). Now in the project which will contain modules. 1. Go to project properties - Flex compiler 2. In the additional compiler arguments add -load-externs=lnkreport.xml (make sure path is same as what you gave in the main project). This would make sure that modules in the separate project would be optimized for your main app. Now since you moved them to a different project, you need to copy the compiled modules to the location specified by the url used to load the modules. or simply change the Output folder for the modules project by going to project properties - flex build path HTH, Gaurav --- In flexcoders@yahoogroups.com, mydarkspoon mydarkspoon@ wrote: Thanks for your response, but RSL won't fit in this situation. RSL are loaded at the application startup, however, I'm using module because I want to load the component by demand. I've used modules before, but never been using modules that sits in a different project. It's important that the module will be separated from the main app/apps so that one developer can add features to the module, while another one can work on the loader app and have an up-to-date module compiled using source control. Cheers, Almog Kurtser. --- In flexcoders@yahoogroups.com, Gaurav Jain gauravj@ wrote: The idea behind modules is to make your main app smaller (by breaking into modules) so that you can speed up initial load time. And load/unload modules when ever required. By default when you compile a module, flex builder optimizes it for the main application - which means it does not add classes to the module which are already in the main app. You can share the same module between different applications as long as you don't optimize your module for any particular app. Module is runtime thing. Adding module into a library will not work. If you are looking to share common code across application and are not interested in modules, you can use libraries. Also if you want to share code across different application but you want to do so at runtime, you can benefit from using runtime shared libraries. For more information about rsls see here http://livedocs.adobe.com/labs/flex3/html
[flexcoders] Re: Using module from Flex library project
--- In flexcoders@yahoogroups.com, Gaurav Jain [EMAIL PROTECTED] wrote: The flex project that uses the module puts the module home project in its source path, Why is it required? Since you module is supposedly independent of your main app, you do not need to specify it in the source path. However, when compiling the main app (the shell) it complains about the module's locale files (ModuleTexts.properties for example) Are you using some class from the module project directly in your main app? I would suggest to have main app independent of the module classes, if that is not possble including module home/locale/en_US in the source path of main app should resolve the compilation errors. Thanks, Gaurav Hi again, Putting the locales in the source path merely won't help compiling, because the locales are treated differently. I put an example siutuation online, the link is in my previous post. Thanks, Almog Kurtser
[flexcoders] Re: Change Flex Editor Font Size
--- In flexcoders@yahoogroups.com, Shaq [EMAIL PROTECTED] wrote: Does anyone know how to change the Flex editors font size. When I'm looking at the code I would like the font to be a little smaller so I can get more code on the screen. Any ideas? Go to Window-preferences-general-appearance-color and fonts-basic-Text font-change Cheers, Almog Kurtser. http://www.kaltura.com
[flexcoders] Undo/redo for flex cairngorm
Hello, I want to implement an undo/redo mechanism into an existing cairngorm app. I found the flex UndoRedo framework to be quite interesting, but since it's a framework and the operation of implementing the undo-redo is quite a lot of work, I'd be really glad to know what people who tried it think about it. The flex UndoRedo home: http://code.google.com/p/flexundoredo/ Thanks a lot ! Almog Kurtser.
[flexcoders] Preserving loaded applications styles
Hi, I've built a flex 3 application, called application A, that uses compiled css, in which I set Application type selector to set all text default color to white. Now I've got application B that uses type selector styles (Application, Label, etc). Application B loads application A and I want application A to be displayed the same way it renders when running alone in the flash plyaer. As far as I know the only way to achieve that, is that app B will load application B into new partitioned ApplicationDomain. This worked just fine when testing on demo project that only uses some labels to indicate their styles. However, when I load the real application A into application B with new ApplicationDomain, I get all sort of obscure of runtime errors from the flex framework: Panel/showTitleBar() Error: Error #1023: Stack overflow occurred. at Object$/_hasOwnProperty() TypeError: Error #1009: Cannot access a property or method of a null object reference. at mx.managers::PopUpManagerImpl/findPopupInfoByOwner() Please help me with this if you've got any tips for preserving styles on loaded apps or if you've ever been into that kind of errors. Thanks in advance, Almog Kurtser.
[flexcoders] RSL realtive path is relative to the page path, not the swf path
Hello, I'm trying to load RSL from a relative path: MainApp.swf - my main app MyRsl.swf - my rsl Now, it happens to be that the main application is being loaded from url like this: http://www.myDomain.com/swf/MainApp.swf which loads-- http://www.myDomain.com/swf/MyRsl.swf However, the swf is embedded in another path: http://www.myDomain.com/swf/index.php/index.html The MainApp.swf however tries to load the rsl from http://www.myDomain.com/swf/index.php/MyRsl.swf This is obviously a wrong path and since the path is given at tcompile time I can't seem to be able to point it to the swf relative path. Any ideas of how to use the swf path instead of the page path without specifying an absolute location ? Thanks in advance, Almog Kurtser. Almog Kurtser.
[flexcoders] Dynamic loading of ResourceBundle textual content (not compiled ResourceBundle)
Hello, I'm using moxie localization capabilities lately and I was wondering if anyone ever made a kit that dynamically load the resource bundles textual content. The resource manager does great job of loading compiled ResourceBundles, yet, sometimes, the one that changes the .properties file has no knowledge of flex and the changes must be immediate. Has anyone ever seen any library that enables that sort of thing ? Thanks in advance, Almog Kurtser.
[flexcoders] FileReference crashing firefox on linux testing old fp versions on linux
Hello, I'm using FileReference to upload file, the swf euns as expected under windows XP OS X but when using linux Redhat with firefox 2, it crashes... This happened when using flash player 9.0.45 However with fp 9.0.115 firefox doesn't crash but, it acts as if the upload operation is synchronous - firefox won't response until the upload is finished. My first act was to try testing it under different fp versions using the adobe archive: http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14266sliceId=2 However, after downloading the archive, I found that the only linux fp version there is the latest one... Has anyone ever bumped into this kind of bug with firefox ? (I found some complaints about this issue while googling it, but no solutions) Also, I'd like to know how do you test legacy fp 9 versions under linux. Thanks in advance, Almog Kurtser
[flexcoders] Re: Using modules in Actionscript
No, you can also extend the mx.modules.Module class which is a layout container. Cheers, Almog Kurtser http://www.kaltura.com --- In flexcoders@yahoogroups.com, duncan mcmillan [EMAIL PROTECTED] wrote: Folks I want to make a module in actionscript and have read that you need to extend the moduleBase class to do this. What I want though is to make the module a composite component which usually extends the UIComponent. Does this mean the only way you can do this is to extend the ModuleBase class and implement all the interfaces usually implemented via extending the UIComponent class? Thanks in advance Duncan __ Sent from Yahoo! Mail - a smarter inbox http://uk.mail.yahoo.com
[flexcoders] Re: i18n - Adavnced Internationalization in Flex Builder 3 - words order in a ph
Thanks a lot, you saved me a whole lot of time ! --- In flexcoders@yahoogroups.com, Alger Werft [EMAIL PROTECTED] wrote: The methode getString in ResourceManager has a third optional Parameter. If a parameters Array is passed to this method, the parameters in it are converted to Strings and then substituted, in order, for the placeholders {0}, {1}, and so on, in the String before it is returned. in your properties-File: search_label=Search {0} {1} on {2} Then pass in an array containing three objects. Alger mydarkspoon wrote: Hi, I'm in a progress of starting to I18n-ize a medium scale flex application. I'm reading the i18l tutorial as well as the ResourceManager flex 3 docs. I find the ResourceManager class really useful, much more than I expected it to be, yet, I can't find any premade solution to a very common problem - words order. For example, I have a label that displays Search all images on Flickr. The label text is disassembled into Search {scope} {mediaType} on {Flickr}. for instance, this phrase can be Search your videos on Youtube The ResourceManager can supply a good solution for using another language for these words, yet, language like German uses different part of speech order (I'm not speaking German so I might be wrong, sorry). Since I don't know German, but just to demonstrate what I mean in a fictional language I just made, the words order is Videos your search Youtube on (of course wit hthe appropriate translation). A good solution could be a binding template that would come with the locale file, but I couldn't find any existing solution to enable that. Has anyone came across with this problem ? I'd be very glad to get some tips.
[flexcoders] i18n - Adavnced Internationalization in Flex Builder 3 - words order in a phrase
Hi, I'm in a progress of starting to I18n-ize a medium scale flex application. I'm reading the i18l tutorial as well as the ResourceManager flex 3 docs. I find the ResourceManager class really useful, much more than I expected it to be, yet, I can't find any premade solution to a very common problem - words order. For example, I have a label that displays Search all images on Flickr. The label text is disassembled into Search {scope} {mediaType} on {Flickr}. for instance, this phrase can be Search your videos on Youtube The ResourceManager can supply a good solution for using another language for these words, yet, language like German uses different part of speech order (I'm not speaking German so I might be wrong, sorry). Since I don't know German, but just to demonstrate what I mean in a fictional language I just made, the words order is Videos your search Youtube on (of course wit hthe appropriate translation). A good solution could be a binding template that would come with the locale file, but I couldn't find any existing solution to enable that. Has anyone came across with this problem ? I'd be very glad to get some tips.
[flexcoders] Re: Conditional itemrenderer
The ampersand oprator cannot be used inside XML tag. you can either use condition1 amp;amp; condition2 or pass the params to function which evaluates to Boolean. Also, take a look at this: http://www.herrodius.com/blog/17 Almog Kurtser, http://www.kaltura.com --- In flexcoders@yahoogroups.com, candysmate [EMAIL PROTECTED] wrote: I have a clickable image inside a datagrid column which is only enabled if datagridcolumn 'code' contains data using: mx:DataGridColumn headerText=M width=26 textAlign=center editable = false mx:itemRenderer mx:Component mx:HBox horizontalAlign=center click=outerDocument.moveToInactive(); enabled = {data.code != ''} mx:Image height=16 width=16 source=@Embed('/images/forwardicon.png') toolTip=Click to make 'Inactive' visible={data.code != ''} /mx:Image /mx:HBox /mx:Component /mx:itemRenderer /mx:DataGridColumn However, I need to expand the condition so that the clickable image operates only if more than one column contains data. I tried: enabled ={data.code != '' data.sub_category != '' data.retail != ''} without success. Any ideas please guys?
[flexcoders] Re: FLEX 2 do not support mx:Loader,why?
Loader is a direct subclass of DispalyObjectContainer. The only flex container that can host non IUIComponent objects is UIComponent, which is an abstract container. Instead of using the Loader, use the SWFLoader or Image. --- In flexcoders@yahoogroups.com, markflex2007 [EMAIL PROTECTED] wrote: Hi, I do know why flex 2 doesn't work with the following code mx:Loader id=loader_1 contentPath=http://localhost/guidelines.swf; / other component do the same job?Thanks Mark
[flexcoders] Re: Flex 3 Beta 3 Debugger Doesnt Connect
If you're running a firewall softwarre, it might block port 3434, which the flex builder uses for debugging. --- In flexcoders@yahoogroups.com, Sheriff [EMAIL PROTECTED] wrote: reverted back to Flex 3 Beta 2 and installed the older flash player and everything works again so i am guessing it has to do with the flash 9.0115 and Windows Vista Home Premium or something with the Flex 3 Beta 3 not connecting. Any Advise? - Original Message From: Sheriff [EMAIL PROTECTED] To: flexcoders@yahoogroups.com Sent: Tuesday, December 25, 2007 4:34:08 PM Subject: [flexcoders] Flex 3 Beta 3 Debugger Doesnt Connect Anyone having this problem? I am running Windows Vista Home and the Debugger always times out. Flash Player used is the one that comes with the Stand Alone Flex Builder. I cleaned/Uninstalled /reinstalled and nothing works it always times out. I even tried the plugin version and same problem. The build is the 115 one Never miss a thing. Make Yahoo your homepage. Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs
[flexcoders] Simple Cairngorm and State Pattern - design thoughts.
Hello, I'm adding some functionality to a Cairngorm app, I want to enable the user to select an audio clip from a DataGrid object with 2 columns: sound track name, and a play button next to it. Easy enough. The confusion start to rose when thinking about the different use cases, which are very few but still: 1. The user selects an item and click the play button next to it, the sound plays and the play button's label turns to Stop. 2. (continuing from 1): The user clicks the stop button and the sound stops. 3. (continuing from 1): The user selects another sound track and hits the play button next to it, the previous sound clip stops playing, the previous sound clip button turns back to Play, the selcted sound clip starts to play and its Play button turns to Stop. That's it. To disassemble these use cases into participants, I think I should have something like that: In the view: A data grid populating list of SoundTrackVO objects where the first column displays the sound track name and the second displays a play button. Commands: 1. PlaySoundCommand - start playing the soundtrack 2. StopSoundCommand - stops playing the soundtrack Cairngorm events: 1. SoundToggleEvent can be named as START_PLAY or STOP_PLAY. attched to it will be the target SoundTrackVO object. VO: AudioTrackVO properties: - soundUrl - the sound URL - isPlaying - a boolean indicating if the sound is currently playing Model (That's where I need your help !:) ): Well, the use cases define a statefull behavior (e.g. the play button in case 1 causes the sound to play while the play button in case 3 causes the active sound to stops and only then the requested sound to start playing).\ And since commands are stateless I'd NOT like to have the play command to check whether a sound is currently playing and then stop it, that would lead to code duplication (both commands would need to know how to stop audio). Yuk. That leads me to the State Pattern: In my opinion, which I'm really not sure is right, the play command should simply tell a SoundPlayer in the model to start play (is it ok to call it a business object ? I'm serious) and like so the stop command. That object which resides in the model will have two methods: function startPlay(soundTrackVO:SoundTrackVO); function stopPlay(soundTrackVO:SoundTrackVO); The SoundPlayer object is implementing a state pattern, therefore it'll have state objects: PlayState object StopState object each of these will implement the IPlayerState interface which has a play() and stop() methods. I'm digging to much into the State pattern, but that's the idea, The PlaySoundCommand will simply call the soundPlayer.play() and pass the SoundTrackVO to the model, and the StopSoundCommand will call the soundPlayer.stop() passing the target SoundTrackVO to stop playing. So my question is if it's considered to be ok placing a self stateful object into the model like that in terms of best practices ? Thanks a lot, hope I didn't babble too much of it :) Almog Kurtser.
[flexcoders] Re: Simple Cairngorm and State Pattern - design thoughts.
Hi Sebastian, you answered my question, since I'm pretty new to Cairngorm, I just wanted to make sure it's appropriate to host in the model object that actually performs actions and don't just represents values derived from actions performed by commands... I think you answered my question, thanks then ! Almog Kurtser. --- In flexcoders@yahoogroups.com, Sebastian Zarzycki [EMAIL PROTECTED] wrote: I'm not really sure what you are asking about. If it's about whether you are allowed to store state of your application in your model, then the answer would be - of course! State is model as well! I've built several applications, where among various VO objects that came from server, I have my own model, sometimes built around those VO's, but sometimes just purely related to UI logic, that is state of my application. I would just have one variable inside your SoundPlayer of the same type even (SoundTrackVO), or plain boolean if you wish - currentTrack, isPlaying, etc. depending on how much data you need about current song - this variable would be set as a result of .play() method, and nullified as a result of .stop() method. Now commands just don't care, they just execute external functionality, asking SoundPlayer to either play or stop, passing the parameters, they've received from events. SoundPlayer, within .play() method (or you can refactor it even and extract to new method), checks, whether currentTrack != null. If so, then go with .stop() first before playing new one. Hope this helps. Sebastian -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of mydarkspoon Sent: Saturday, December 22, 2007 11:28 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Simple Cairngorm and State Pattern - design thoughts. Hello, I'm adding some functionality to a Cairngorm app, I want to enable the user to select an audio clip from a DataGrid object with 2 columns: sound track name, and a play button next to it. Easy enough. The confusion start to rose when thinking about the different use cases, which are very few but still: 1. The user selects an item and click the play button next to it, the sound plays and the play button's label turns to Stop. 2. (continuing from 1): The user clicks the stop button and the sound stops. 3. (continuing from 1): The user selects another sound track and hits the play button next to it, the previous sound clip stops playing, the previous sound clip button turns back to Play, the selcted sound clip starts to play and its Play button turns to Stop. That's it. To disassemble these use cases into participants, I think I should have something like that: In the view: A data grid populating list of SoundTrackVO objects where the first column displays the sound track name and the second displays a play button. Commands: 1. PlaySoundCommand - start playing the soundtrack 2. StopSoundCommand - stops playing the soundtrack Cairngorm events: 1. SoundToggleEvent can be named as START_PLAY or STOP_PLAY. attched to it will be the target SoundTrackVO object. VO: AudioTrackVO properties: - soundUrl - the sound URL - isPlaying - a boolean indicating if the sound is currently playing Model (That's where I need your help !:) ): Well, the use cases define a statefull behavior (e.g. the play button in case 1 causes the sound to play while the play button in case 3 causes the active sound to stops and only then the requested sound to start playing).\ And since commands are stateless I'd NOT like to have the play command to check whether a sound is currently playing and then stop it, that would lead to code duplication (both commands would need to know how to stop audio). Yuk. That leads me to the State Pattern: In my opinion, which I'm really not sure is right, the play command should simply tell a SoundPlayer in the model to start play (is it ok to call it a business object ? I'm serious) and like so the stop command. That object which resides in the model will have two methods: function startPlay(soundTrackVO:SoundTrackVO); function stopPlay(soundTrackVO:SoundTrackVO); The SoundPlayer object is implementing a state pattern, therefore it'll have state objects: PlayState object StopState object each of these will implement the IPlayerState interface which has a play() and stop() methods. I'm digging to much into the State pattern, but that's the idea, The PlaySoundCommand will simply call the soundPlayer.play() and pass the SoundTrackVO to the model, and the StopSoundCommand will call the soundPlayer.stop() passing the target SoundTrackVO to stop playing. So my question is if it's considered to be ok placing a self stateful object into the model like that in terms of best practices ? Thanks a lot, hope I didn't babble too much of it :) Almog Kurtser.
[flexcoders] Re: DataGrid data accessed from Item renderer
Hi Mark, your item renderer should not be worried about saving data, but instead notifying an higher level view about the user request to save the user interaction. You can either bubble an event to be catched by one of its parent or if the right component to perform the operation is the renderer direct parent, use the outerDoceumtn.publicFunctionNameGoesHere() to avoid unneeded bubbling. Cheers, Almog Kurtser, Kaltura, http://www.kaltura.com --- In flexcoders@yahoogroups.com, markgoldin_2000 [EMAIL PROTECTED] wrote: This is a combobox change event handler used as an itemRenderer in DataGrid: public function handleDataChanged(event:ListEvent):void { // update underlying data data.person = selectedItem.data; // Globally store updated row mx.core.Application.application.globalDataToSave = data; } I am also trying to create a generic Save routine. For that I am using globalDataProviderToSave to remember the modified data. But the user can change multiple rows in the grids before he clicks on Save. I need to store the whole grid data into globalDataProviderToSave to be able to save all rows. How can I access it from within item renderer every time the user changes data? Differnet ideas? Thanks
[flexcoders] Possible mx:SetEventHandler / bug
Hi, I encountered an error using the SetEventHandler and made a simple test case to see what was the problem: In my app I have a component that contains button and dispatches a goPrevious event when the component::button is clicked. Following the goPrevious event, the main app changes its state. The new state uses the SetEventHandler to change the goPreviousHandler: My main app: ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute xmlns:local=* creationComplete=init() mx:Script ![CDATA[ import mx.controls.Alert; private function init():void { trace(document.toString()); } private function onClick1(evt:Event):void { Alert.show(chnaging from state 1 to state 2); currentState = myState } private function onClick2(evt:Event):void { Alert.show(state 2); } ]] /mx:Script mx:states mx:State name=myState mx:SetProperty target={bt} name=alpha value=0.2 / !--mx:SetEventHandler target={bt} handlerFunction=onClick2 name=goPrevious / -- /mx:State /mx:states local:MyButton id=bt goPrevious=onClick1(event) / !--mx:Button id=bt click=onClick1() / -- /mx:Application --- The Component: ?xml version=1.0 encoding=utf-8? mx:VBox xmlns:mx=http://www.adobe.com/2006/mxml; width=100 height=100 click=onClick() creationPolicy=auto mx:Metadata [Event(name=goPrevious, type=events.NavigationEvent)] /mx:Metadata mx:Script ![CDATA[ import events.NavigationEvent; private function onClick():void { dispatchEvent(new NavigationEvent(NavigationEvent.GO_PREVIOUS)); } ]] /mx:Script mx:Button label=previous click=onClick() / /mx:VBox And this is the error you get from the SetEventH/handler object: ReferenceError: Error #1069: Property __bt_goPrevious not found on MyButton and there is no default value. at mx.states::SetEventHandler/apply() It seems that inside the SetEventHandler.apply() function it can't find the oldHandlerFunction. I'm struggling this bug for hours now and been goggling it a lot, yet nothing useful was found... I'd be grateful if anyone take a look at that. Thanks in advance, Almog Kurtser
[flexcoders] Re: Possible mx:SetEventHandler / bug
Hi, first of all, thanks for the reply, I had a piece of my main app code commented, so if you just copied and paste it, you won't see the bug immediately, sorry, the fixed code is bellow. I tried to use actionscript addEventListener, yet, the problem with this approach is that SetEventHandlet purpose is to replace the handling function, however, it won't unregister actionscript event listeners, so the error won't show up but now we'll have 2 listeners instead of 1. The good code (still with the bug): ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute xmlns:local=* creationComplete=init() mx:Script ![CDATA[ import mx.controls.Alert; private function onClick1(evt:Event):void { Alert.show(chnaging from state 1 to state 2); currentState = myState } private function onClick2():void { Alert.show(state 2); } ]] /mx:Script mx:states mx:State name=myState mx:SetEventHandler target={bt} handler=onClick2() name=goPrevious / /mx:State /mx:states local:MyButton id=bt goPrevious=onClick1(event) / /mx:Application Thanks a lot, Almog Kurtser --- In flexcoders@yahoogroups.com, rueter007 [EMAIL PROTECTED] wrote: Hey, I ran your code and I could reproduce the error you got. It seems like a bug in the SetEventHandler code. However, if you add the initial event listener in actionscript, it all works fine. private function init():void { trace(document.toString()); bt.addEventListener(change, onClick1); } - venkat http://www.venkatj.com --- In flexcoders@yahoogroups.com, mydarkspoon mydarkspoon@ wrote: Hi, I encountered an error using the SetEventHandler and made a simple test case to see what was the problem: In my app I have a component that contains button and dispatches a goPrevious event when the component::button is clicked. Following the goPrevious event, the main app changes its state. The new state uses the SetEventHandler to change the goPreviousHandler: My main app: ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute xmlns:local=* creationComplete=init() mx:Script ![CDATA[ import mx.controls.Alert; private function init():void { trace(document.toString()); } private function onClick1(evt:Event):void { Alert.show(chnaging from state 1 to state 2); currentState = myState } private function onClick2(evt:Event):void { Alert.show(state 2); } ]] /mx:Script mx:states mx:State name=myState mx:SetProperty target={bt} name=alpha value=0.2 / !--mx:SetEventHandler target={bt} handlerFunction=onClick2 name=goPrevious / -- /mx:State /mx:states local:MyButton id=bt goPrevious=onClick1(event) / !--mx:Button id=bt click=onClick1() / -- /mx:Application --- The Component: ?xml version=1.0 encoding=utf-8? mx:VBox xmlns:mx=http://www.adobe.com/2006/mxml; width=100 height=100 click=onClick() creationPolicy=auto mx:Metadata [Event(name=goPrevious, type=events.NavigationEvent)] /mx:Metadata mx:Script ![CDATA[ import events.NavigationEvent; private function onClick():void { dispatchEvent(new NavigationEvent(NavigationEvent.GO_PREVIOUS)); } ]] /mx:Script mx:Button label=previous click=onClick() / /mx:VBox And this is the error you get from the SetEventH/handler object: ReferenceError: Error #1069: Property __bt_goPrevious not found on MyButton and there is no default value. at mx.states::SetEventHandler/apply() It seems that inside the SetEventHandler.apply() function it can't find the oldHandlerFunction. I'm struggling this bug for hours now and been goggling it a lot, yet nothing useful was found... I'd be grateful if anyone take a look at that. Thanks in advance, Almog Kurtser
[flexcoders] Re: Possible mx:SetEventHandler / bug
I think I'll use this, it certainly can help hacking this bug, but I can't believe this bug hasn't been talked before, maybe there is less hacky way to deal with it ? Anyway, that really helps me, thank you ! Cheers, Almog Kurtser --- In flexcoders@yahoogroups.com, rueter007 [EMAIL PROTECTED] wrote: I uncommented that line from your code before and did see the error. And I agree that there are two event listeners now. If all you want to do is replace the old event listener with a new one, you can still listen for a state change event and in the event handler, manually remove the old listener and add the new event listener. this.addEventListener(StateChangeEvent.CURRENT_STATE_CHANGE, handleStateChange); in the handleStateChange, you can check what the new state is and add/remove event listeners accordingly. --- In flexcoders@yahoogroups.com, mydarkspoon mydarkspoon@ wrote: Hi, first of all, thanks for the reply, I had a piece of my main app code commented, so if you just copied and paste it, you won't see the bug immediately, sorry, the fixed code is bellow. I tried to use actionscript addEventListener, yet, the problem with this approach is that SetEventHandlet purpose is to replace the handling function, however, it won't unregister actionscript event listeners, so the error won't show up but now we'll have 2 listeners instead of 1. The good code (still with the bug): ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute xmlns:local=* creationComplete=init() mx:Script ![CDATA[ import mx.controls.Alert; private function onClick1(evt:Event):void { Alert.show(chnaging from state 1 to state 2); currentState = myState } private function onClick2():void { Alert.show(state 2); } ]] /mx:Script mx:states mx:State name=myState mx:SetEventHandler target={bt} handler=onClick2() name=goPrevious / /mx:State /mx:states local:MyButton id=bt goPrevious=onClick1(event) / /mx:Application Thanks a lot, Almog Kurtser --- In flexcoders@yahoogroups.com, rueter007 rueter007@ wrote: Hey, I ran your code and I could reproduce the error you got. It seems like a bug in the SetEventHandler code. However, if you add the initial event listener in actionscript, it all works fine. private function init():void { trace(document.toString()); bt.addEventListener(change, onClick1); } - venkat http://www.venkatj.com --- In flexcoders@yahoogroups.com, mydarkspoon mydarkspoon@ wrote: Hi, I encountered an error using the SetEventHandler and made a simple test case to see what was the problem: In my app I have a component that contains button and dispatches a goPrevious event when the component::button is clicked. Following the goPrevious event, the main app changes its state. The new state uses the SetEventHandler to change the goPreviousHandler: My main app: ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute xmlns:local=* creationComplete=init() mx:Script ![CDATA[ import mx.controls.Alert; private function init():void { trace(document.toString()); } private function onClick1(evt:Event):void { Alert.show(chnaging from state 1 to state 2); currentState = myState } private function onClick2(evt:Event):void { Alert.show(state 2); } ]] /mx:Script mx:states mx:State name=myState mx:SetProperty target={bt} name=alpha value=0.2 / !--mx:SetEventHandler target={bt} handlerFunction=onClick2 name=goPrevious / -- /mx:State /mx:states local:MyButton id=bt goPrevious=onClick1(event) / !--mx:Button id=bt click=onClick1() / -- /mx:Application
[flexcoders] Re: Different approaches to Cairngorm view updates
Yes, it's even mentioned on Derrick's article, but it's just like using binding, ChangeWatcher, only with compile time checking for property's name. On the bottom line, it requires the view to know more than it should. Both approaches seems to solve it, but I'd like to see what other people than me think of each... Cheers, Almog Kurtser. http://www.kaltura.com --- In flexcoders@yahoogroups.com, Richard Rodseth [EMAIL PROTECTED] wrote: Have you looked into the Observe tag? On Dec 7, 2007 4:28 PM, mydarkspoon [EMAIL PROTECTED] wrote: Hi, I'm still new to cairngorm, and like almost everyone bumped into issues concerning updating the view when binding to the model won't be enough. I ran across 2 main approaches: 1. Derrick Grigg / Firemoss - use a view controller which listens to the CairngormEventDispatcher and dispatches his own view events which causes the view to react: http://www.dgrigg.com/post.cfm/04/12/2007/Cairngorm-Commands-Views-and-Harikiri http://www.firemoss.com/blog/index.cfm?mode=entryentry=A6A76F5E-3048-55C9-4301E81D24A361B6 2. Thomas Burleson - Thomas suggested that the view would send a proxy responder attached to the CairngormEvent. when the command's result() method is invoked by the business delegate, the command would simply call the proxy responder's onResult() / onFault() which in turn will invoke a call back function on the view which will response by changing the view: http://www.thomasburleson.biz/2007/06/cairngorm_view_notifications.html I can't decide which approach is better. in terms of mvc, both keeps the separation, both can be extended and re-used with different views and also both requires an extra event to code. I also read Thomas talk-back on Derrick's blog, but that also left me with no insight... Before I pick one with no real understanding of the outcome, I'd like to hear what you think is the better one, also if you know any other approach beside model-binding which I try to use as much as possible but that just won't always work, then I'd be happy to hear about it. Thanks in advance, Almog Kurtser, http://www.kaltura.com
[flexcoders] Re: Cairngorm Issue
Can you post the shole code for the component that hosts the view stack ? If you tested the model workflowState and it did changed I guess that the problem is with your model reference variable is not set to be bindable with the [Bindable] metadata tag (although the ModelLocater instance is set to be bindable, any reference to it must be bindable as well). If it's not the 2nd place I would check would be the getView()... Anyway, it would be much helpful to see your code. --- In flexcoders@yahoogroups.com, Manu Dhanda [EMAIL PROTECTED] wrote: Hii.. I am trying to learn how to use cairngorm. Now, I am creating Login/Register page. The structure is like below: mx:Panel mx:ViewStack id=validateView selectedChild={ getView( model.workflowState ) } loginview:LoginForm id=loginForm/ loginview:RegisterForm id=registerForm/ /mx:ViewStack loginview:LoginAndRegisterControlBar id=lnrControlBar/ /mx:Panel In the code, loginForm registerForm are two forms. and below them is a controlbar( which controls which form need to be displayed via a link button. The issue is, initially, login form displayed fine. But, when I click the link button to display the registerForm, it only displays the 'textfields' and none of the labels being displayed. First I thought, there might be an issue with registerForm code, but then I set the registerForm to be displayed as the application default it displays fine and then same problem happen with login form(i.e. only text fields displyed with none labels in front of them. Any help to resolve this issue will be great. Thanks. -- View this message in context: http://www.nabble.com/Cairngorm-Issue-tf4960151.html#a14206482 Sent from the FlexCoders mailing list archive at Nabble.com.
[flexcoders] Different approaches to Cairngorm view updates
Hi, I'm still new to cairngorm, and like almost everyone bumped into issues concerning updating the view when binding to the model won't be enough. I ran across 2 main approaches: 1. Derrick Grigg / Firemoss - use a view controller which listens to the CairngormEventDispatcher and dispatches his own view events which causes the view to react: http://www.dgrigg.com/post.cfm/04/12/2007/Cairngorm-Commands-Views-and-Harikiri http://www.firemoss.com/blog/index.cfm?mode=entryentry=A6A76F5E-3048-55C9-4301E81D24A361B6 2. Thomas Burleson - Thomas suggested that the view would send a proxy responder attached to the CairngormEvent. when the command's result() method is invoked by the business delegate, the command would simply call the proxy responder's onResult() / onFault() which in turn will invoke a call back function on the view which will response by changing the view: http://www.thomasburleson.biz/2007/06/cairngorm_view_notifications.html I can't decide which approach is better. in terms of mvc, both keeps the separation, both can be extended and re-used with different views and also both requires an extra event to code. I also read Thomas talk-back on Derrick's blog, but that also left me with no insight... Before I pick one with no real understanding of the outcome, I'd like to hear what you think is the better one, also if you know any other approach beside model-binding which I try to use as much as possible but that just won't always work, then I'd be happy to hear about it. Thanks in advance, Almog Kurtser, http://www.kaltura.com
[flexcoders] Re: Cairngorm Issue
I can't notice anything wrong with the code... Did you check the workflowState actually changes ? --- In flexcoders@yahoogroups.com, Manu Dhanda [EMAIL PROTECTED] wrote: Code for ValidatePanel.mxml : ?xml version=1.0 encoding=utf-8? mx:Panel xmlns:mx=http://www.adobe.com/2006/mxml; xmlns:loginview=com.mot.stir.view.loginview.* title=Login horizontalAlign=center verticalAlign=middle mx:Script ![CDATA[ import mx.core.Container; import com.adobe.cairngorm.control.CairngormEventDispatcher; import com.mot.stir.model.StirModelLocator; import com.mot.stir.event.ClickLoginEvent; import com.mot.stir.vo.LoginVO; import com.mot.stir.vo.RegisterVO; [Bindable] public var model : StirModelLocator = StirModelLocator.getInstance(); public function getView( workflowState : Number ) : Container { if( model.workflowState == StirModelLocator.VIEWING_REGISTER_SCREEN ) { this.title = Register; return registerForm; } else { this.title = Login; return loginForm; } } ]] /mx:Script mx:ViewStack id=validateView selectedChild={ getView( model.workflowState ) } loginview:LoginForm id=loginForm/ loginview:RegisterForm id=registerForm/ /mx:ViewStack loginview:LoginAndRegisterControlBar id=lnrControlBar/ /mx:Panel Thanks. Manu. mydarkspoon wrote: Can you post the shole code for the component that hosts the view stack ? If you tested the model workflowState and it did changed I guess that the problem is with your model reference variable is not set to be bindable with the [Bindable] metadata tag (although the ModelLocater instance is set to be bindable, any reference to it must be bindable as well). If it's not the 2nd place I would check would be the getView()... Anyway, it would be much helpful to see your code. --- In flexcoders@yahoogroups.com, Manu Dhanda manuraj.dhanda@ wrote: Hii.. I am trying to learn how to use cairngorm. Now, I am creating Login/Register page. The structure is like below: mx:Panel mx:ViewStack id=validateView selectedChild={ getView( model.workflowState ) } loginview:LoginForm id=loginForm/ loginview:RegisterForm id=registerForm/ /mx:ViewStack loginview:LoginAndRegisterControlBar id=lnrControlBar/ /mx:Panel In the code, loginForm registerForm are two forms. and below them is a controlbar( which controls which form need to be displayed via a link button. The issue is, initially, login form displayed fine. But, when I click the link button to display the registerForm, it only displays the 'textfields' and none of the labels being displayed. First I thought, there might be an issue with registerForm code, but then I set the registerForm to be displayed as the application default it displays fine and then same problem happen with login form(i.e. only text fields displyed with none labels in front of them. Any help to resolve this issue will be great. Thanks. -- View this message in context: http://www.nabble.com/Cairngorm-Issue-tf4960151.html#a14206482 Sent from the FlexCoders mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/Cairngorm-Issue-tf4960151.html#a14209723 Sent from the FlexCoders mailing list archive at Nabble.com.
[flexcoders] Re: Cairngorm design questions about Command-View communication
Hi, I'm a cairngorm newbie, and still not sure of what solution is appropriate for a certain situation but in case I want to update the view after a command has taken an action I would follow one of the following: 1. A direct data binding that is the most elegant I think but doesn't always fit. I've seen some cairngorm examples in which the model was built according to the view needs. In my opinion that's a bad design , the model should represent the business data, not the way the view use it. 2. When you can't use direct binding, the second best solution might be vinding the view to helper functions. for example, if I have an intro screen, and I want to show a welcome message according to the user's sex, I would do something like that: mx:Label: text={ getMessage(_mode.user.sex) } / That's pretty straight forward, but the problems comes when the link between the view needs and the model data is implicit, I don't like my view to guess what the state is according to the model, for example, I would consider this to be bad: mx:Label text={getMessage(_mode.user, _model.workflowState, _model.isReady, _model.isPending)} / That's just too much responsibilties to put into the view. That's kind of contradict what I stated in section 1, not to design the model by the view, I think that might be the most difficult part for me, to find the right balance between view responsibilities and model design and would really like to hear what other people have to say about it... 3. If you really have to take an action after some data was initialized, I would recommend not to use the Changewatcher if possible for it uses strings to reference object chains, which is bad for refactoring. for example, you have a model.files object that you listen to with the change watcher, then you decide to change its name to imageFiles, you won't get any compile time errors because it uses strings. You can use Paul Williams observe http://weblogs.macromedia.com/paulw/archives/2006/05/the_worlds_smal.cf\ m tag instead. Well, that's it, it far away form being perfect, I'm sure there are some better technique for certain situation, if any has some I would love to hear about it... Almog Kurtser, http://www.kaltura.com http://www.kaltura.com --- In flexcoders@yahoogroups.com, rmarples [EMAIL PROTECTED] wrote: As our product has gotten bigger, I have moved it from a standard Model-View-Controller design to a more strict Cairngorm-like Model-View-Dispatcher-Command design. But one particular aspect of it has left me a bit unsure as to the best practice. I'm hoping others can share their views on this. There are various times when a Command needs to make a non-data-related update to the view such as: - disabling/enabling buttons while a server operation runs - updating the focus of controls - changing component states - hiding/showing components We've had some debate about the best method to accomplish this. The easy scenario is changing states because we can simply have a model variable that the view's currentState property is data-bound to. So we can modify that model variable from within the Command which indirect updates the view. But there are other situations that are more tricky. For example, we have a login view with a username and password. We have a command that loads the stored username. If the stored username is not found, we'd like to set the focus on the username textbox, whereas if the username is found, then we want to put the focus on the password textbox. I don't believe you can set up focus using data-binding (if you can let me know). So we have postulated several different solutions to this, all of which work but we are trying to figure out which one is the most correct based on the design pattern. 1. Set up a ChangeWatcher to watch the a model username variable, in the handler set the focus based on whether that variable is null or not. 2. Dispatch an event from the command that the view listens to. This is used to notify the view when the username variable has been populated and thus when it can run it's focus logic. 3. Have the view object store a reference to itself in the model somewhere so that the command can update it directly. I know this seems like a very granular point but I'm just looking for the general practice in these types of situations because there are lots of them. Any thoughts? Ryan
[flexcoders] Cairngorm and FileReference best practice.
Hi, I'm doing my first cairngorm project, and trying to adapt best practices and conventions. Well, I have a screen in which the user should upload multiple files from his computer, much like flickr's one http://www.flickr.com/photos/upload/ . The view will contain a DataGrid, upload button and select files button, that allows the user to select files. When user selects one or more files, their details will be added to the DataGrid and upon clicking the upload button the upload process begins. This is a very simple case to do without cairngorm, but I can't find a decent way that follows the cairngorm mvc architecture. For the user to start selecting files he'll need to use the FileReferenceList.browse(), where would that object should reside ? I'm not sure if it should sit in the model, created by the view as a VO or... ? Lets say I have the FileReferenceList object. the file browsing smells like a view related as it interacts with the user, if so, and following the rule that dictates that only commands can change the model, then the FileReferenceList should be instantiated by the view so that it won't change a model object directly. That is one thing, the other one is keeping the business the only way data can be passed to the server. Upon clicking the upload button, how can the matching command us the business to upload the FileReferenceList ? Thanks a lot and good night. Cheers, Almog Kurtser.
[flexcoders] Flex transition won't affect a component with children .
Hello all, I had a problem with transitions which I isolated into a very simple case: I have a VBox with a text label and a button. When user clicks the button, the current state changes into a new state in which new component is added to my VBox which I expect to grow smoothly. This new component is just a canvas with a label. The child canvas is added but it appears without a transition. This is when the component is defined in a separate mxml file, BUT, if I define the exact same component, inline in the state definition, it works just as I expected. I then went to the component mxml and deleted the label leaving it to be a simple canvas and it works. it seems that whatever is added to the component when it's defined in a separate file will disable the transition. This is the main mxml: ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute xmlns:local=* mx:states mx:State name=myState mx:AddChild relativeTo={container} !-- mx:Canvas backgroundColor=0x678080 mx:Label text=I'm the new component, did I came in smoothly ? / /mx:Canvas -- local:MyComp / /mx:AddChild /mx:State /mx:states mx:transitions mx:Transition fromState=* toState=* mx:Sequence target={container} mx:Resize / /mx:Sequence /mx:Transition /mx:transitions mx:VBox id=container backgroundColor=0xFF mx:Label text=Some text goes here / mx:Button label=click me to add new component click=currentState = 'myState' / /mx:VBox /mx:Application And this is the very-simple component: ?xml version=1.0 encoding=utf-8? mx:Canvas backgroundColor=0x678080 xmlns:mx=http://www.adobe.com/2006/mxml; mx:Label text=I'm the new component, did I came in smoothly ? / /mx:Canvas Notice that if you comment the component definition in the state and uncomment the same exact inline-component definition , it works great. Thanks a lot ! Almog Kurtser
[flexcoders] Re: Cairngorm - what's you best practice on handling inital data from the server
Hi Nick, Thanks for the help, the reasons why I'm not satisfied with #5 are like that: The tabs naming is one operation that takes place, another one is creating a ViewStack object to correspond those tabs. Obviously, the view stack Can be built upon setting the TabBar dataProvider, however, I think it's not readable beacuse when I open an mxml component in search for a specific view control, the viewstack in this example, I would look first at the mx:ViewStack / tag instead, not at the TabBar, which should have nothing to do with the ViewStack leaving it to be loosely coupled as much as possible. Actually, this brings me the idea which I'll have to implement anyway, to bind the ViewStack object's selectedIndex to the model using a local helper function to get the selectedIndex, null checking the model for the config file, and eventually returning an index. This is not perfect but more elegant I think, yet I'd like to adapt best practices dealing with such issues so feel about it :) I almost forgot, my second drawback from the curly braces metjod is the dispatching of redundant event, which is the reason that causes the null checking to be essential. Thanks and best regards, Almog Kurtser. --- In flexcoders@yahoogroups.com, Uber_Nick [EMAIL PROTECTED] wrote: Almong, I don't see any problem with #5. The getTabsLabels() should contain a simple null check, so it will only perform an action when your serviceList object is populated. Client-side manipulation of the serviceList object should take place within the result method of the command retrieving the list. I'm not sure what you mean when you state but it shouldn't be there as it won't be readable. Can you clarify your concerns with this approach? -Nick Matelli Amentra, Inc --- In flexcoders@yahoogroups.com, mydarkspoon mydarkspoon@ wrote: Hello all, I'm new with Cairngorm, trying to develop a wizard RIA with flex, and I encountered an issue with data binding that went ugly: In my model I have an XML doc taht describes several available search services from the server. This XML is retrieved when the app start by using an appropriate command that uses business delegate. However, in the view I have a TabBar, that needs to manipulate the XML config file from the model, meaning that it has to know when this xml is retrieved. I found few approaches to this: 1. use a fake getter-setter binded to the model. My drawback from this approach is quite obvious, I don't really need a getter here, but a notification... 2. custom [Bindable(event=)]. This also not the best way as it introduces new complexity to the model and enforces the developer to dispatch an event... 3. Using a command to create the data for the TabBar in the view. I think this creates a tightly coupled connection between the controller and the view... 4. Using Paul Williams ac:ObserveValue / util. Although one might think this creates a slick binding to function by hiding the fake getter-setter, it actually dispatches redundant events because it handler can't be compared to the source property, and thus the handler is being called even when the source is null. 5. using curly braces: mx:TabBar dataProvider={getTabsLabels(_model.servicesList)} / This approach also introduces redundant events as its destination is not read-write enabled and it will get dispatched even when the servicesList is null. Moreover, I want to executes one more manipulation on the xml from the model, it can be created while calling the getTabsLabels() but it shouldn't be there as it won't be readable... I'll be more than happy to hear your ideas. Thanks a lot ! Almog Kurtser.
[flexcoders] Re: Cairngorm - what's you best practice on handling inital data from the server
Nick, thanks, that's just what I was looking for, and apparently tried to use incorrectly previously. I think that now on. I'll use this technique for binding to information that shouldn't be changed during the app lifetime, and curly braces to pass the binded value from the model to the helper function for situations where real binding is needed. My concerns are style related only (hopefully it'll stay that way during the development of this app) as it's my second day with Cairngorm and I wish not to currupt my mind just so early:) Good night for me, and best regards, Almog Kurtser. hopefully --- In flexcoders@yahoogroups.com, Uber_Nick [EMAIL PROTECTED] wrote: Hi Almog, I see your concern now. You're right in that the logic for creation of the view stack should remain in the view code, not the command or in some other binding. Here's how we handle that situation. On the component's creationComplete, we call init(): private function init():void { Changewatcher.watch(_model, servicesList, createViewStack) } private function createViewStack(event:PropertyChangeEvent):void { //do view stack creation logic here } This way, your view logic is in one place and built off the model. In terms of the redundant dispatching of events, it will fire once or twice on startup will a null value, but after that it should only fire the one time your property is set. That's how all binding works and it's nothing to worry about. Are your concerns performance-related, or more about style/elegance? -Nick Matelli Amentra, Inc --- In flexcoders@yahoogroups.com, mydarkspoon mydarkspoon@ wrote: Hi Nick, Thanks for the help, the reasons why I'm not satisfied with #5 are like that: The tabs naming is one operation that takes place, another one is creating a ViewStack object to correspond those tabs. Obviously, the view stack Can be built upon setting the TabBar dataProvider, however, I think it's not readable beacuse when I open an mxml component in search for a specific view control, the viewstack in this example, I would look first at the mx:ViewStack / tag instead, not at the TabBar, which should have nothing to do with the ViewStack leaving it to be loosely coupled as much as possible. Actually, this brings me the idea which I'll have to implement anyway, to bind the ViewStack object's selectedIndex to the model using a local helper function to get the selectedIndex, null checking the model for the config file, and eventually returning an index. This is not perfect but more elegant I think, yet I'd like to adapt best practices dealing with such issues so feel about it :) I almost forgot, my second drawback from the curly braces metjod is the dispatching of redundant event, which is the reason that causes the null checking to be essential. Thanks and best regards, Almog Kurtser.
[flexcoders] My first post here - styling the TabBar rollover colors
Hello all! I'm styling the flex TabBar using Adobe flex explorer, and facing a very annoying problem while trying to set the rollOver color of the tabs. At first place I thought I could set the rollover color using the tabStyleName's fillColors style, but this style can only get 2 colors that determines the default bg color, unlike the ButtonBar, whose fillColors can get 4 colors where the last 2 determines the rollover colors. Since TabBar extends ButtonBar, I thought that instead of using the .tabStyleName I could use the buttonStyleName , in which I can define rollover colors with the fillColors style which receives 4 colors, where the last two, determines the rollover color, as the buttonStyleName has no effect on the tabs. This is a link to a demo project that illustrates the problem: http://files-upload.com/files/616415/TabsRolloverColor.rar I will be very glad to get some ideas to get around this. Thanks a lot, Almog.
[flexcoders] Re: My first post here - styling the TabBar rollover colors
Hi Rico, thanks for the help, but I couldn't download the file attachment since that I wasn't registered to the mail notification. Could you please re-send it ? (subscribed now...) Thanks a lot! :) --- In flexcoders@yahoogroups.com, Rico Leuthold [EMAIL PROTECTED] wrote: Hi, I'm not sure if you can do it without a programmatic skin. Here is the as and the css part for how to do it with a programmatic skin (works for me):  _rico On 13.11.2007, at 14:21, mydarkspoon wrote: Hello all! I'm styling the flex TabBar using Adobe flex explorer, and facing a very annoying problem while trying to set the rollOver color of the tabs. At first place I thought I could set the rollover color using the tabStyleName's fillColors style, but this style can only get 2 colors that determines the default bg color, unlike the ButtonBar, whose fillColors can get 4 colors where the last 2 determines the rollover colors. Since TabBar extends ButtonBar, I thought that instead of using the .tabStyleName I could use the buttonStyleName , in which I can define rollover colors with the fillColors style which receives 4 colors, where the last two, determines the rollover color, as the buttonStyleName has no effect on the tabs. This is a link to a demo project that illustrates the problem: http://files-upload.com/files/616415/TabsRolloverColor.rar I will be very glad to get some ideas to get around this. Thanks a lot, Almog. ... Rico Leuthold [EMAIL PROTECTED] +41(0)76 512 05 50 ...