[flexcoders] Flex with IBM Websphere / DB2
I've been working with Flex using .NET HTTP/SOAP web services and MS SQL Server for a while. Recently I started a new project using IBM Websphere Application Server (6.1) and DB2. The environment is setup with a simple Apache/Linux web server (no Websphere or other app server components), then a Webspere App Server 6.1 behind a firewall, and finally a DB2 server (also behind the firewall). The only server that is accessible externally is the Apache/Linux web server. My Flex app requires data from the DB2 database, and I'm used to getting it via HTTP/SOAP web service calls. However, with nothing but a bare Apache/Linux web server that is accessible externally, I'm trying to figure out how to best create a simple server-side HTTP listener that will take data requests, communicate with the WAS/DB2 servers, then send the data back to the Flex client. What choices/options are there for this scenario? I do have the capability of installing some server-side components to the Apache/Linux web server.
[flexcoders] Resetting HSlider / VSlider
I have a UI with filters including an HSlider with 2 thumbs representing a start year and end year (range 1854-2008). The HSlider code looks like this: mx:HSlider id=slider_mfg_year minimum=1854 maximum=2008 thumbCount=2 values=[1854,2008] labels=[1854, 2008] width=250 tickInterval=10 snapInterval=1 dataTipFormatFunction={nf.format} liveDragging=false change=filter() horizontalCenter=0 bottom=5/ In addition, the UI has a reset button that is supposed to reset the filters to their default values. Everything is working *except* the HSlider -- I can't seem to get it to reset the thumbs to their default positions. I'm trying to do this by setting the thumb values: private function filter_reset():void { slider_mfg_year.values[0] = 1854; slider_mfg_year.values[1] = 2008; ... However, this doesn't seem to be resetting the thumb positions, just the HSlider control values, and the values/positions of the thumbs are now out of sync. How can I reset the HSlider thumbs back to their default positions/values?
[flexcoders] Link/Hand Cursor
Flex seems to be sporadic at changing the cursor to a link/hand cursor when rolled over components that allow clicks/linking. I can't find any properties that make it easy to change the cursor on roll-over of an image that is a link, for example. I don't need custom cursors or anything, I'm just interested in changing the default cursor into a hand/link cursor when the mouse is over a particular UI component. What's the best way to accomplish this?
[flexcoders] Re: Working with images of varying proportions
OK, this works great when I run the application locally, but when I upload to the server and run it from there the images aren't being resized (no error message - nothing happens). I tracked the problem down to: var img_width:int = img.content.loaderInfo.width; var img_height:int = img.content.loaderInfo.height; These statements work fine when running the Flex app locally, but they cause the function to stop execution when executing the Flex app from the web server. If I place an Alert before these statements it displays fine, but if I place an Alert after these statements it never shows up. Any ideas why the content.loaderInfo would work fine locally but end up null or undefined when running from the web server? Why the difference? What can I do to ensure this works on the server? Thanks! --- In flexcoders@yahoogroups.com, byte.sensei byte.sen...@... wrote: Thanks for the insight. I did something very similar, although I'm using HBox/VBox components to layout my app so I had to put a VBox wrapper around the image like this: mx:VBox id=image_01_wrapper width=100 height=100% verticalAlign=middle horizontalAlign=center mx:Image id=image_01 source={'http://media.basspro.com/'+current_product.image_url_01} complete={image_resize(image_01,100,75)} alpha=0/ /mx:VBox Then my image_resize() function takes an Image object and desired width/height as parameters: private function image_resize (img:Image,w:int,h:int):void { var img_width:int = img.content.loaderInfo.width; var img_height:int = img.content.loaderInfo.height; if (img_width/img_height = w/h) { //image is wider than box proportions - resize based on width img.width = w; img.height = w/img_width*img_height; } else { //image is taller than box proportions - resize based on height img.height = h; img.width = h/img_height*img_width; } //Alert.show(img.width.toString() + x + img.height.toString()); var fade_in:Fade = new Fade(); fade_in.target = img; fade_in.alphaFrom = 0; fade_in.alphaTo = 1; fade_in.play(); } I also added the fade in tween so that the images gradually fade in when they have been resized. Anyway, your code below got me going. Thanks! -Dan --- In flexcoders@yahoogroups.com, Fotis Chatzinikos fotis.chatzinikos@ wrote: For something similar i do the following, you should be able to change it to do what you want quite easily..: mx:Image id=selectedProductImageID verticalCenter=0 complete=imageLoaded() source={selectedPhoto} left=5 / Now the important bit is the complete=imageLoaded(): and the imageLoaded function: private function imageLoaded():void { if (selectedProductImageID.content.loaderInfo.width = selectedProductImageID.content.loaderInfo.height) { selectedProductImageID.width = 330; selectedProductImageID.height = 330*selectedProductImageID.content.loaderInfo.height/selectedProductIm ageID.content.loaderInfo.width ; } else { selectedProductImageID.height = 330 ; selectedProductImageID.width = 330*selectedProductImageID.content.loaderInfo.width/selectedProductIma geID.content.loaderInfo.height; } } On Mon, Feb 23, 2009 at 9:36 PM, byte.sensei byte.sensei@ wrote: I have an app that loads several images into mx:Image tags with scaleContent=true and width=160 / height=120. The problem is not all of my images have these proportions, and for odd sized images they end up being loaded into the upper left hand corner instead of centered in the restricting image box. All I'm trying to do is have a box 160x120 pixels, then load in images of various sizes dynamically and have them 1) scale to fit within this box, and 2) render centered vertically/horizontally in this box. Is there any way I can do this not knowing the actual image sizes (and using images of different proportions)? Thanks! -- Fotis Chatzinikos, Ph.D. Founder, Phinnovation Fotis.Chatzinikos@,
[flexcoders] Working with images of varying proportions
I have an app that loads several images into mx:Image tags with scaleContent=true and width=160 / height=120. The problem is not all of my images have these proportions, and for odd sized images they end up being loaded into the upper left hand corner instead of centered in the restricting image box. All I'm trying to do is have a box 160x120 pixels, then load in images of various sizes dynamically and have them 1) scale to fit within this box, and 2) render centered vertically/horizontally in this box. Is there any way I can do this not knowing the actual image sizes (and using images of different proportions)? Thanks!
[flexcoders] Re: Working with images of varying proportions
Yes, when I try that the images don't scale into my 160x120 box. The images are a wide variety of sizes (e.g. 300x700, 1280x1024, 150x50) they are really inconsistent in proportion. When I take off the image width/height I get the full image size and not a scaled 160x120 version. -Dan --- In flexcoders@yahoogroups.com, oneworld95 oneworl...@... wrote: Have you tried taking the width/height off of the component and see how it handles the images of varying sizes? - Alex C --- In flexcoders@yahoogroups.com, byte.sensei byte.sensei@ wrote: I have an app that loads several images into mx:Image tags with scaleContent=true and width=160 / height=120. The problem is not all of my images have these proportions, and for odd sized images they end up being loaded into the upper left hand corner instead of centered in the restricting image box. All I'm trying to do is have a box 160x120 pixels, then load in images of various sizes dynamically and have them 1) scale to fit within this box, and 2) render centered vertically/horizontally in this box. Is there any way I can do this not knowing the actual image sizes (and using images of different proportions)? Thanks!
[flexcoders] Re: Working with images of varying proportions
Thanks for the insight. I did something very similar, although I'm using HBox/VBox components to layout my app so I had to put a VBox wrapper around the image like this: mx:VBox id=image_01_wrapper width=100 height=100% verticalAlign=middle horizontalAlign=center mx:Image id=image_01 source={'http://media.basspro.com/'+current_product.image_url_01} complete={image_resize(image_01,100,75)} alpha=0/ /mx:VBox Then my image_resize() function takes an Image object and desired width/height as parameters: private function image_resize (img:Image,w:int,h:int):void { var img_width:int = img.content.loaderInfo.width; var img_height:int = img.content.loaderInfo.height; if (img_width/img_height = w/h) { //image is wider than box proportions - resize based on width img.width = w; img.height = w/img_width*img_height; } else { //image is taller than box proportions - resize based on height img.height = h; img.width = h/img_height*img_width; } //Alert.show(img.width.toString() + x + img.height.toString()); var fade_in:Fade = new Fade(); fade_in.target = img; fade_in.alphaFrom = 0; fade_in.alphaTo = 1; fade_in.play(); } I also added the fade in tween so that the images gradually fade in when they have been resized. Anyway, your code below got me going. Thanks! -Dan --- In flexcoders@yahoogroups.com, Fotis Chatzinikos fotis.chatzini...@... wrote: For something similar i do the following, you should be able to change it to do what you want quite easily..: mx:Image id=selectedProductImageID verticalCenter=0 complete=imageLoaded() source={selectedPhoto} left=5 / Now the important bit is the complete=imageLoaded(): and the imageLoaded function: private function imageLoaded():void { if (selectedProductImageID.content.loaderInfo.width = selectedProductImageID.content.loaderInfo.height) { selectedProductImageID.width = 330; selectedProductImageID.height = 330*selectedProductImageID.content.loaderInfo.height/selectedProductIm ageID.content.loaderInfo.width ; } else { selectedProductImageID.height = 330 ; selectedProductImageID.width = 330*selectedProductImageID.content.loaderInfo.width/selectedProductIma geID.content.loaderInfo.height; } } On Mon, Feb 23, 2009 at 9:36 PM, byte.sensei byte.sen...@... wrote: I have an app that loads several images into mx:Image tags with scaleContent=true and width=160 / height=120. The problem is not all of my images have these proportions, and for odd sized images they end up being loaded into the upper left hand corner instead of centered in the restricting image box. All I'm trying to do is have a box 160x120 pixels, then load in images of various sizes dynamically and have them 1) scale to fit within this box, and 2) render centered vertically/horizontally in this box. Is there any way I can do this not knowing the actual image sizes (and using images of different proportions)? Thanks! -- Fotis Chatzinikos, Ph.D. Founder, Phinnovation fotis.chatzini...@...,
[flexcoders] Synchronous web service calls
OK, so I understand that Flex web service calls are asynchronous, and I understand the many cases where this makes sense since you don't have to hold up the UI experience while waiting for a web service or remote procedure to return a result. However, I keep running into instances where this makes my life hell. One example is the submission of an order on a Flex site I have. Because of the way the order is handled, it is split into multiple (smaller) orders and then each order is submitted/saved via a web service call. This means that one order could have 10+ web service calls. I have a Print Receipt button which then uses the saved order data to produce a PDF receipt. The problem is, if a user clicks Print Receipt before all the save order web services have finished, then they only get a partial receipt. There's also not an easy way to determine if all the web service calls are finished, so I can't disable/enable the button based on that. Is there any easy way to implement synchronous web service calls in Flex? Man, if I had the option of specifying with a property whether or not a web service should be synchronous or asynchronous, it would make my life *so* much easier!
[flexcoders] Re: Synchronous web service calls
Thanks for the replies. This is (sort of) the direction I was headed, although I like your specific idea below. I guess I'm still holding on to the synchronous world of coding I came from. ;) I feel like I'm always having to come up with ways to deal with Flex's asynchronous behavior, and it seems to require alot of additional code/handling (in my opinion). Anyway, thanks for the specific counter idea below -- I'll give it a shot! --- In flexcoders@yahoogroups.com, jerusalem_pilgrim [EMAIL PROTECTED] wrote: Why can't you just use a web service calls counter in your code? Every time a request goes out, increment it, every time you get a response, decrement it. The Print Receipt button only gets enabled if the counter is back to 0. --- In flexcoders@yahoogroups.com, byte.sensei byte.sensei@ wrote: data to produce a PDF receipt. The problem is, if a user clicks Print Receipt before all the save order web services have finished, then they only get a partial receipt. There's also not an easy way to determine if all the web service calls are finished, so I can't disable/enable the button based on that.
[flexcoders] Re: Flash Player 9.0.124.0 - Web Services Stopped Working
I read the security update URL, and tried the URL below but it threw an error (also tried searching Adobe KB on using kb403184 but that threw an error too). Here's an example of code that works in 9.0.115.0 but not in 9.0.124.0: var ws : WebService = new mx.rpc.soap.WebService(); ws.loadWSDL(model_locator.APPLICATION_WEB_SERVICE_URL); ws.makeObjectsBindable = false; ws.useProxy = false; ws.login.resultFormat = e4x; ws.login.addEventListener(ResultEvent.RESULT, login_result); ws.login.addEventListener(FaultEvent.FAULT, app_commander.web_service_fault); ws.login.arguments.username = username.text; ws.login.arguments.password = password.text; ws.login(); So does this fall into the category of xml sockets? How do I know what port(s) it is using for the socket communication? Also, it looks like setting up a master sockets file requires port 843 to be open -- my ISP is very strict about what ports they allow and it may take several days to get this port open and directed to my master file (if it is even approved at all). So, it sounds like in my case I'll need to create my own sockets policy file and then manually call loadPolicyFile(), correct? If that's the case, what ports do I need to allow? I'm more confused that before I read the security update. Help! --- In flexcoders@yahoogroups.com, Glenn Williams [EMAIL PROTECTED] wrote: and maybe this http://kb.adobe.com/selfservice/viewContent.do? externalId=kb403184sliceId=1 Glenn www.flex-ria.com www.tinylion.co.uk www.our-little-secret.com From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of byte.sensei Sent: Monday, April 14, 2008 8:12 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Flash Player 9.0.124.0 - Web Services Stopped Working I've got a live Flex 3 site that uses SOAP web services. I've had a number of users over the weekend who updated to Flash Player 9.0.124.0 and now they can't get past the login screen -- it's like the login web service is not being called at all. The site works fine with version 9.0.115.0 (and older versions of Flash Player 9). Was there some type of change in 9.0.124.0 that would cause this type of issue?
[flexcoders] SOAP Web Services not working in Flash Player 9.0.124.0
OK, I've been reading all the web content on the security changes that were implemented in 9.0.124.0. I'm more confused than ever. The security updates seem to apply to XMLSockets, and I'm not using these *unless* they are implicitly used by SOAP Web Services. Here is an example of web service code that works fine in versions prior to 9.0.124.0 but not since: var ws : WebService = new mx.rpc.soap.WebService(); ws.loadWSDL(model_locator.APPLICATION_WEB_SERVICE_URL); ws.makeObjectsBindable = false; ws.useProxy = false; ws.login.resultFormat = e4x; ws.login.addEventListener(ResultEvent.RESULT, login_result); ws.login.addEventListener(FaultEvent.FAULT, app_commander.web_service_fault); ws.login.arguments.username = username.text; ws.login.arguments.password = password.text; ws.login(); From what I'm reading, it sounds like I need a sockets policy file, although I'm not sure because this is a SOAP web service call over HTTP and as far as I can tell shouldn't be affected by the XML Sockets security update. To implement a master socket policy file seems like it requires me to configure the server with a special xmlsockets server that listens/responds on port 843. Any examples of implementing this on IIS/Windows Server? Am I missing something? Maybe I just need to update my crossdomain.xml file? I tried adding the to-ports to that but it's still not working. What do I need to do to get the soap web services working again?
[flexcoders] Flash Player 9.0.124.0 - Web Services Stopped Working
I've got a live Flex 3 site that uses SOAP web services. I've had a number of users over the weekend who updated to Flash Player 9.0.124.0 and now they can't get past the login screen -- it's like the login web service is not being called at all. The site works fine with version 9.0.115.0 (and older versions of Flash Player 9). Was there some type of change in 9.0.124.0 that would cause this type of issue?
[flexcoders] Simple Image Rotator
I'm trying to implement a simple image rotator that just rotates among 5 different images. I have it working except that I want a smooth fade out/in between each image. To keep things simple, I implemented this using mx:states / mx:transitions, as follows: mx:states mx:State name=image01 mx:SetProperty target={button_image} name=source value=assets/images/image01.jpg/ /mx:State mx:State name=image02 mx:SetProperty target={button_image} name=source value=assets/images/image02.jpg/ /mx:State mx:State name=image03 mx:SetProperty target={button_image} name=source value=assets/images/image03.jpg/ /mx:State mx:State name=image04 mx:SetProperty target={button_image} name=source value=assets/images/image04.jpg/ /mx:State mx:State name=image05 mx:SetProperty target={button_image} name=source value=assets/images/image05.jpg/ /mx:State /mx:states mx:transitions mx:Transition id=image_transition fromState=* toState=* mx:Sequence target={button_image} mx:Fade duration=1000 alphaFrom=1 alphaTo=0 / mx:Fade duration=1000 alphaFrom=0 alphaTo=1 / /mx:Sequence /mx:Transition /mx:transitions The problem I'm having is that the image source is getting replaced before the transition starts, so the image pops to the next image and then the new image does a fade in/out. I understand why it's doing this, what I don't know is how to change it so that the fade out happens *before* the image source is changed, and then the fade in happens *after* the image source is changed. I can think of way(s) this might be done by scrapping the states/transitions approach and just writing ActionScript, but I was wondering if there's any easy way to modify what I've already got instead of scrapping it and going in a new direction. Thanks in advance for any feedback.
[flexcoders] Load HTML from URL into Flex Component (via iframe)
I've got a Flex site with several pages that load HTML content from an older HTML version of the site into an iframe that I then place over the Flash movie so it looks like the content has been embedded into the Flex UI even though it's still being loaded from the old HTML site. I've got the following Javascript function to load the HTML content into the iframe: function loadIFrame(url){ document.getElementById(myFrame).innerHTML = iframe id='myIFrame' src=' + url + ' frameborder='0'/iframe; Alert.show(url); } I added the Alert.show for testing so I'd get a Javascript alert box if/when this Javascript function fires. Inside my Flex app, I'm using the following code to refresh the iframe based on a URL: ExternalInterface.call(loadIFrame, source); I'm using the show event of a VBox component to make the ExternalInterface.call to the Javascript function. I've verified via trace that the show event is firing and the ExternalInterface.call() function is executing, but the iframe never loads the URL nor does the Javascript Alert.show() function execute. It seems to work some of the time, but not consistently and not in any pattern I can distinguish. Am I missing something here? Is there a different/better approach for loading HTML content via an HTTP GET into a Flex UI? If not, how can I get this to work properly/consistently? Cheers!
[flexcoders] Re: Load HTML from URL into Flex Component (via iframe)
OK, so I fixed the Javascript to use the correct alert box code (I've got Flex syntax on the brain): alert(url); Now I see that loadIFrame() is executing -- but it executes 3 times, or at least I'm getting 3 javascript alert boxes each time I load the iframe page. --- In flexcoders@yahoogroups.com, byte.sensei [EMAIL PROTECTED] wrote: I've got a Flex site with several pages that load HTML content from an older HTML version of the site into an iframe that I then place over the Flash movie so it looks like the content has been embedded into the Flex UI even though it's still being loaded from the old HTML site. I've got the following Javascript function to load the HTML content into the iframe: function loadIFrame(url){ document.getElementById(myFrame).innerHTML = iframe id='myIFrame' src=' + url + ' frameborder='0'/iframe; Alert.show(url); } I added the Alert.show for testing so I'd get a Javascript alert box if/when this Javascript function fires. Inside my Flex app, I'm using the following code to refresh the iframe based on a URL: ExternalInterface.call(loadIFrame, source); I'm using the show event of a VBox component to make the ExternalInterface.call to the Javascript function. I've verified via trace that the show event is firing and the ExternalInterface.call() function is executing, but the iframe never loads the URL nor does the Javascript Alert.show() function execute. It seems to work some of the time, but not consistently and not in any pattern I can distinguish. Am I missing something here? Is there a different/better approach for loading HTML content via an HTTP GET into a Flex UI? If not, how can I get this to work properly/consistently? Cheers!
[flexcoders] Strange Page Titles with HistoryMangement
Ever since I enabled HistoryManagement on a Flex app the HTML Page Titles have been messed up. Instead of my normal page titles, the page title becomes something like #app=e75-action=... I thought that putting a hard-coded Page title into my index.template.html would fix the problem (and always use my static page title) but this didn't work, either. In index.template.html I changed: title${title}/title to titleTESTING/title. When I FIRST load the Flex app, it shows the TESTING page title, but as soon as I start using the site it reverts back to the garbled titles. When I view source on the page (via IE) I see the titleTESTING/title in the head of my HTML wrapper, but IE is *still* showing the garbled page titles. How can I set the Page Title so it doesn't get messed up?
[flexcoders] Browser window size
This is probably a simple question but is there an easy way to get the current browser window size? I have a Flex app with the application height/width set to 100%, and then I divide that up into various vbox/hbox elements. However, in some instances I create a pop-up with PopUpManager. The problem I'm having is that the pop-up might end up being too tall for the browser window size, and it ends up going off the screen without any way to scroll. There's a vertical scrollbar on the main screen, but since it's behind the pop-up there's no way to use it. In other words, the application height may be larger than the browser window height (which just engages a vertical scroll bar) but the pop- up *thinks* it can use up to the application height when in reality I want to limit it to the (current) browser window height. For now, I've set a maximum height of 400 pixels (which I know will fit on an 800x600 screen) but when the user has a higher resolution I want to be able to make the pop-up height larger than 400. Ultimately what I want to do is create a VBox pop-up and then on creationComplete check its height against the current browser window height, and if it's larger, reset the height (which turns on the vertical scroll bar) but otherwise leave the height alone (no vertical scroll bar).
[flexcoders] Re: Browser window size
Both suggestions worked -- I implemented the javascript / ExternalInterface method first, then saw the other reply and that worked out, too. I kept the systemManager.screen version since it doesn't require Javascript, and the Javascript code I was using to detect the size of the current browser window isn't exactly bullet- proof. Thanks to both of you for the replies!
[flexcoders] Save/Recall a Password field?
I have a Flex app where the first screen is a Login page. This is replacing an ASPX/HTML site, and one thing I never realized was how much users rely on the browser's ability to remember passwords. Now that I've launched the new site, a lot of users are asking why it doesn't save their password for the next time they come back. Has anyone tried to interface with the browser's password save/recall capability? This happens automatically on HTML/.NET forms. I'm exploring other possibilities, like making the Login page an HTML form and *then* loading the Flex app *or* saving the username/password in a local shared object and recalling it the next time the user comes back (emulating the browser's built-in password save/recall).
[flexcoders] VBox content not refreshing on scroll
I've noticed in several places that when scroll bars are used that the content in whatever component is being scrolled doesn't get updated. I have several different Canvas and VBox/HBox screens with a vertical scroll bar, and when you scroll up and down it seems to jumble up the content and even after you stop scrolling the content remains jumbled -- like it needs to be refreshed to draw everything in the correct positions. I'd really like to understand *why* the content isn't keeping up with the scroll and ends up all jumbled up. Of course I'd also *really* like to know how to fix this issue...
[flexcoders] Re: VBox content not refreshing on scroll
Sure, try http://www.symetri.com/flex_test/test.html http://www.symetri.com/flex_test/test.html If you use the vbar to scroll up/down you should see what I'm talking about -- the form content gets messed up. Then, if you roll the mouse around the VBox after scrolling it usually refreshes the item as you roll over it, causing it to jump as it shifts from the jumbled position to the actual position. I've even seen it where the buttons are totally gone and then you roll the mouse over and they suddenly reappear. While putting together is test case, I figured out the source of the problem. I had added wmode,opaque to my AC_FL_RunContent in index.template.html. On the actual site/project I've added more stuff, but for this test case I used the base index.template.html and only addded that one line (after I figured out that was causing the issue). I added the wmode,opaque for a reason (to fix a previous issue) -- I just can't recall what that issue was. I hesitate to take it out, but I might not have a choice. Any reason this change to AC_FL_RunContent would be causing this issue? --- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: Can you post a simple test case? From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of byte.sensei Sent: Tuesday, January 08, 2008 10:28 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] VBox content not refreshing on scroll I've noticed in several places that when scroll bars are used that the content in whatever component is being scrolled doesn't get updated. I have several different Canvas and VBox/HBox screens with a vertical scroll bar, and when you scroll up and down it seems to jumble up the content and even after you stop scrolling the content remains jumbled -- like it needs to be refreshed to draw everything in the correct positions. I'd really like to understand *why* the content isn't keeping up with the scroll and ends up all jumbled up. Of course I'd also *really* like to know how to fix this issue...
[flexcoders] Re: VBox content not refreshing on scroll
Quick addendum: I remembered why I added wmode,opaque to my AC_FL_RunContent -- I'm using a hidden iframe in the HTML wrapper to pull in content from another site on certain pages. I had read that for this to work properly you had to add wmode=opaque to the html wrapper...
[flexcoders] Enabling/Disabling Components
What's the easiest way to make components visible/invisible in a VBox/HBox so that they collapse their real estate. When you just set visible=false, the space for the component is still reserved in the associated VBox/HBox. In addition, setting width=0 or height=0 collapses the space for the component but doesn't collapse the gap space between components. Is there an easy way to keep components in a VBox/HBox so they are still available via Actionscript but make them invisible *AND* also collapse their real estate (including gap space)? A common example: I have a form that shows either a combo box *or* a text box depending on selections made by the user. When the form changes from one to the other, I want to keep both controls but make one invisible (and collapse the associated space). I can do this with a Canvas using absolute layout (I just make the controls overlap and then set one visible and the other invisible), but I'm tyring to get it to work in a VBox/HBox form if possible.
[flexcoders] Re: Enabling/Disabling Components
Sweet - Thanks! --- In flexcoders@yahoogroups.com, rueter007 [EMAIL PROTECTED] wrote: includeInLayout=false visible=false - venkat http://www.venkatj.com --- In flexcoders@yahoogroups.com, byte.sensei byte.sensei@ wrote: What's the easiest way to make components visible/invisible in a VBox/HBox so that they collapse their real estate. When you just set visible=false, the space for the component is still reserved in the associated VBox/HBox. In addition, setting width=0 or height=0 collapses the space for the component but doesn't collapse the gap space between components. Is there an easy way to keep components in a VBox/HBox so they are still available via Actionscript but make them invisible *AND* also collapse their real estate (including gap space)? A common example: I have a form that shows either a combo box *or* a text box depending on selections made by the user. When the form changes from one to the other, I want to keep both controls but make one invisible (and collapse the associated space). I can do this with a Canvas using absolute layout (I just make the controls overlap and then set one visible and the other invisible), but I'm tyring to get it to work in a VBox/HBox form if possible.
[flexcoders] Specifying Component Height/Width Percentages via Actionscript
Is there an easy way to specify a component height/width in percentages rather than pixels via Actionscript? I have a UI that has 2 VBox components. By default, the height of the top is set to 100% and the height of the bottom is 0. However, I want to be able to dynamically change the heights to 85% / 15% using an Actionscript function. I tried setting height/width using a formula to calculate the correct height in pixels, which seemed to work until I resized the browser and realized that Flex had changed the VBox heights to static pixels, so they no longer scaled as the browser window was resized (i.e. their heights where now static pixels instead of percentages).
[flexcoders] Re: Preserving History when leaving and returning to Flex
Yes, I believe that might be a good option in this case -- thanks for the suggestion. --- In flexcoders@yahoogroups.com, Ben Marchbanks [EMAIL PROTECTED] wrote: What about using local shared object, is that an option for you ? byte.sensei wrote: While working on a small test case for this, I realized what was happening. The pages beyond the Login screen have a security check that looks for a user_id variable (stored in the application model). When the user leaves the Flex app and then returns, the model variables are lost and so trying to go directly back to the page results in the user being redirected to the Login page. So, I'm now storing some session info in the database then passing the session id back into the Flex app and having that re-establish the necessary model variables so that the user ends up back on the correct page. --- In flexcoders@yahoogroups.com mailto:flexcoders% 40yahoogroups.com, Alex Harui aharui@ wrote: Flex should reload the saved state. Can you create a small test case? From: flexcoders@yahoogroups.com mailto:flexcoders% 40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders% 40yahoogroups.com] On Behalf Of byte.sensei Sent: Wednesday, November 28, 2007 2:37 PM To: flexcoders@yahoogroups.com mailto:flexcoders% 40yahoogroups.com Subject: [flexcoders] Preserving History when leaving and returning to Flex I have History Management working on a Flex app (ViewStack), but then I've got a NavigateToURL() call that leaves the Flex app and opens an external URL. The problem is, when you click Back after leaving Flex, it looks like the History Manager no longer works and it just returns you to the default/initial state instead of the saved/history state. I noticed the URL still has the state URL variables/data in it (e.g. #app=a1ceeac2-selectedIndex=4) but Flex seems to be ignoring this URL data and just loads the default/initial state. Is there a way to have Flex reload the saved state when returning from an external URL? To say this another way, assume the following path of a User: 1) Login Page 2) Main Menu Page 3) Product Category Page 4) Product Detail Page 5) External Product Link [NOT Flex -- uses NavigateToURL()] The forward/back buttons work fine between #1 and #4, but once the user navigates to #5, the back button returns them to #1 instead of #4 -- but I want to take the user back to #4. Note: one workaround to this would be to open a new window by using _blank for the target of NavigateToURL(), but in my scenario this is undesirable. -- Ben Marchbanks ::: alQemy ::: transforming information into intelligence http://www.alQemy.com ::: magazooms ::: digital magazines http://www.magazooms.com Greenville, SC 864.284.9918
[flexcoders] Re: Preserving History when leaving and returning to Flex
While working on a small test case for this, I realized what was happening. The pages beyond the Login screen have a security check that looks for a user_id variable (stored in the application model). When the user leaves the Flex app and then returns, the model variables are lost and so trying to go directly back to the page results in the user being redirected to the Login page. So, I'm now storing some session info in the database then passing the session id back into the Flex app and having that re-establish the necessary model variables so that the user ends up back on the correct page. --- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: Flex should reload the saved state. Can you create a small test case? From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of byte.sensei Sent: Wednesday, November 28, 2007 2:37 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Preserving History when leaving and returning to Flex I have History Management working on a Flex app (ViewStack), but then I've got a NavigateToURL() call that leaves the Flex app and opens an external URL. The problem is, when you click Back after leaving Flex, it looks like the History Manager no longer works and it just returns you to the default/initial state instead of the saved/history state. I noticed the URL still has the state URL variables/data in it (e.g. #app=a1ceeac2-selectedIndex=4) but Flex seems to be ignoring this URL data and just loads the default/initial state. Is there a way to have Flex reload the saved state when returning from an external URL? To say this another way, assume the following path of a User: 1) Login Page 2) Main Menu Page 3) Product Category Page 4) Product Detail Page 5) External Product Link [NOT Flex -- uses NavigateToURL()] The forward/back buttons work fine between #1 and #4, but once the user navigates to #5, the back button returns them to #1 instead of #4 -- but I want to take the user back to #4. Note: one workaround to this would be to open a new window by using _blank for the target of NavigateToURL(), but in my scenario this is undesirable.
[flexcoders] Load HTML from URL into Flex Component
I have a Flex 3 application that generates HTML, PDF, and Excel reports from SQL Server Reporting Services. In the case of HTML, I've been using navigateToURL() to load the result into the browser. This works fine, but I'd really like to embed the HTML into a Flex container and wrap the application navigation/header/footer around it so that the user stays in the Flex app and has access to all of the site navigation, etc. In the Flex/AIR documentation there's lots of examples that use HTMLControl / URLRequest to load the HTML content of a URL and then add the HTMLControl display object. However, the required flash.html.HTMLControl library is not available in Flex. I tried using flash.display.Loader / URLRequest and then used this.rawChildren.addChild() but that doesn't seem to work either - the page is just blank. I thought maybe I needed to specify the height/width but that didn't make any difference. Here's the code I'm using: import flash.display.Loader; import flash.net.URLRequest; private function load_html() : void { var html:Loader = new Loader(); var urlReq:URLRequest = new URLRequest(http://www.symetri.com/;); html.width = 900; html.height = 900; html.load(urlReq); html_box.rawChildren.addChild(html); } The function runs on creationComplete() of the html_box VBox container. Isn't there some type of HTMLLoader Flex component similar to SWFLoader out there somewhere that will do this sort of thing? If not, any other suggestions?
[flexcoders] Preserving History when leaving and returning to Flex
I have History Management working on a Flex app (ViewStack), but then I've got a NavigateToURL() call that leaves the Flex app and opens an external URL. The problem is, when you click Back after leaving Flex, it looks like the History Manager no longer works and it just returns you to the default/initial state instead of the saved/history state. I noticed the URL still has the state URL variables/data in it (e.g. #app=a1ceeac2-selectedIndex=4) but Flex seems to be ignoring this URL data and just loads the default/initial state. Is there a way to have Flex reload the saved state when returning from an external URL? To say this another way, assume the following path of a User: 1) Login Page 2) Main Menu Page 3) Product Category Page 4) Product Detail Page 5) External Product Link [NOT Flex -- uses NavigateToURL()] The forward/back buttons work fine between #1 and #4, but once the user navigates to #5, the back button returns them to #1 instead of #4 -- but I want to take the user back to #4. Note: one workaround to this would be to open a new window by using _blank for the target of NavigateToURL(), but in my scenario this is undesirable.
[flexcoders] Re: Load HTML from URL into Flex Component
Works great - Thanks! The only issue I've had with this approach is having to manually manage the iframe visible property when navigating between different states of my application. --- In flexcoders@yahoogroups.com, Derrick Anderson [EMAIL PROTECTED] wrote: maybe this link can be of some help to you http://www.deitte.com/IFrameDemo3/IFrameDemo.html d. On Nov 28, 2007 10:48 AM, byte.sensei [EMAIL PROTECTED] wrote: I have a Flex 3 application that generates HTML, PDF, and Excel reports from SQL Server Reporting Services. In the case of HTML, I've been using navigateToURL() to load the result into the browser. This works fine, but I'd really like to embed the HTML into a Flex container and wrap the application navigation/header/footer around it so that the user stays in the Flex app and has access to all of the site navigation, etc. In the Flex/AIR documentation there's lots of examples that use HTMLControl / URLRequest to load the HTML content of a URL and then add the HTMLControl display object. However, the required flash.html.HTMLControl library is not available in Flex. I tried using flash.display.Loader / URLRequest and then used this.rawChildren.addChild() but that doesn't seem to work either - the page is just blank. I thought maybe I needed to specify the height/width but that didn't make any difference. Here's the code I'm using: import flash.display.Loader; import flash.net.URLRequest; private function load_html() : void { var html:Loader = new Loader(); var urlReq:URLRequest = new URLRequest(http://www.symetri.com/;); html.width = 900; html.height = 900; html.load(urlReq); html_box.rawChildren.addChild(html); } The function runs on creationComplete() of the html_box VBox container. Isn't there some type of HTMLLoader Flex component similar to SWFLoader out there somewhere that will do this sort of thing? If not, any other suggestions?
[flexcoders] Flex 3 Beta 2 Expires in 4 days
I was recently forced to upgrade from Flex 2 to Flex 3 because of a bug in Flex 2 that was fixed in Flex 3 that was affecting a couple of projects I'm working on. Flex 3 Beta 2 has been great, however it looks like it's set to expire in 4 days (not sure if that's just my machine or a fixed date for all beta 2). The problem is, I can't buy Flex 3 (yet), and I don't see a new beta/version of Flex 3 with a later expiration date. What can I do to keep developing in Flex 3? I purchased Flex 2 last year and I have that serial, but I'm not sure if Flex 3 will accept it. Will there be another beta update before the current one expires?
[flexcoders] Re: Flex 3 Beta 2 Expires in 4 days
I tried my old Flex 2 serial number and it didn't take it the first time (said it was invalid). On a whim, I pasted it again and the second time it said it was valid and now I have 109 days left (instead of 4). Go figure... --- In flexcoders@yahoogroups.com, Tianzhen Lin [EMAIL PROTECTED] wrote: If you go to Help - Manage Flex Licenses, you may enter a valid Flex 2 serial number, it should extend your trial period. At least mine has more than a few days to go. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Paul Andrews Sent: Tuesday, November 27, 2007 12:13 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Flex 3 Beta 2 Expires in 4 days - Original Message - From: byte.sensei [EMAIL PROTECTED] mailto:byte.sensei% 40yahoo.com To: flexcoders@yahoogroups.com mailto:flexcoders% 40yahoogroups.com Sent: Tuesday, November 27, 2007 4:58 PM Subject: [flexcoders] Flex 3 Beta 2 Expires in 4 days I was recently forced to upgrade from Flex 2 to Flex 3 because of a bug in Flex 2 that was fixed in Flex 3 that was affecting a couple of projects I'm working on. Flex 3 Beta 2 has been great, however it looks like it's set to expire in 4 days (not sure if that's just my machine or a fixed date for all beta 2). The problem is, I can't buy Flex 3 (yet), and I don't see a new beta/version of Flex 3 with a later expiration date. What can I do to keep developing in Flex 3? I purchased Flex 2 last year and I have that serial, but I'm not sure if Flex 3 will accept it. There's only one way to find out. Far quicker than typing out a post asking if it'll work.. Will there be another beta update before the current one expires? Is the Beta expiring, or the trial period?
[flexcoders] Flex Builder 3 - internal build error
I've been working with Flex Builder 3 beta 2 fine for the past several days, and then all of the sudden I got a message saying, an internal build error has occurred. Please check the Error log. So I opened the error log (at {Workspace Dir}\.metadata\.log) and have been trying to figure out how to correct the problem. Here's what is in the .log file (condensed version): !SESSION 2007-10-05 16:51:48.125 - -- eclipse.buildId=unknown java.version=1.5.0_11 java.vendor=Sun Microsystems Inc. BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US Command-line arguments: -os win32 -ws win32 -arch x86 !ENTRY org.eclipse.jface 4 0 2007-10-05 16:51:51.093 !MESSAGE The command (com.adobe.flexbuilder.exportimport.flexprojectexportaction) is undefined !STACK 0 java.lang.Exception at org.eclipse.jface.action.ExternalActionManager$CommandCallback.isActiv e(ExternalActionManager.java:297) at org.eclipse.jface.action.ActionContributionItem.isCommandActive (ActionContributionItem.java:588) !ENTRY org.eclipse.jface 4 0 2007-10-05 16:51:51.109 !MESSAGE The command (com.adobe.flexbuilder.exportimport.skinartworkimportaction) is undefined !STACK 0 java.lang.Exception at org.eclipse.jface.action.ExternalActionManager$CommandCallback.isActiv e(ExternalActionManager.java:297) at org.eclipse.jface.action.ActionContributionItem.isCommandActive (ActionContributionItem.java:588) !ENTRY org.eclipse.jface 4 0 2007-10-05 16:51:51.109 !MESSAGE The command (com.adobe.flexbuilder.exportimport.webserviceimportaction) is undefined !STACK 0 java.lang.Exception at org.eclipse.jface.action.ExternalActionManager$CommandCallback.isActiv e(ExternalActionManager.java:297) at org.eclipse.jface.action.ActionContributionItem.isCommandActive (ActionContributionItem.java:588) !ENTRY com.adobe.flexbuilder.project 4 43 2007-10-05 16:52:08.062 !MESSAGE Uncaught exception in compiler !STACK 0 java.lang.NullPointerException at macromedia.asc.semantics.ConfigurationEvaluator.evaluate (Unknown Source) at macromedia.asc.parser.SwitchStatementNode.evaluate(Unknown Source) Any idea how to fix this problem? Do I need to re-install Flex 3?
[flexcoders] Re: Flex Builder 3 - internal build error
Note: I already tried Project Clean and running Flex from the command line with the -clean option, but it's still giving me the internal build error. I also tried dropping the entire project and re- creating it from scratch, but still no luck... --- In flexcoders@yahoogroups.com, byte.sensei [EMAIL PROTECTED] wrote: I've been working with Flex Builder 3 beta 2 fine for the past several days, and then all of the sudden I got a message saying, an internal build error has occurred. Please check the Error log. So I opened the error log (at {Workspace Dir}\.metadata\.log) and have been trying to figure out how to correct the problem. Here's what is in the .log file (condensed version):
[flexcoders] Re: Flex Builder 3 - internal build error
I tried un-installing, deleting the My Documents\Flex Builder 3\ folder, then re-installing and adding the project from scratch again. Still no luck. I closed that project and made a new Flex project and it will compile/run fine, so I *think* it has something to do with the project (and not the general IDE / compiler) but I can't figure out what. I'm at a loss... Anyone out there experienced anything like this? --- In flexcoders@yahoogroups.com, byte.sensei [EMAIL PROTECTED] wrote: Note: I already tried Project Clean and running Flex from the command line with the -clean option, but it's still giving me the internal build error. I also tried dropping the entire project and re- creating it from scratch, but still no luck... --- In flexcoders@yahoogroups.com, byte.sensei byte.sensei@ wrote: I've been working with Flex Builder 3 beta 2 fine for the past several days, and then all of the sudden I got a message saying, an internal build error has occurred. Please check the Error log. So I opened the error log (at {Workspace Dir}\.metadata\.log) and have been trying to figure out how to correct the problem. Here's what is in the .log file (condensed version):
[flexcoders] Re: Flex Builder 3 - internal build error
This whole thing ended up being caused by the following statement I had added as a placeholder: switch (event.oldIndex) {} ...as soon as I commented that out (on a hunch) the error went away and everything compiled normally. Sure enough, I was able to repeat the problem in a blank test.mxml Flex project by adding the following code to the mx:Application: mx:Script ![CDATA[ import mx.events.StateChangeEvent; public function my_function(event:StateChangeEvent) : void { switch (event.oldIndex) {} } ]] /mx:Script Is it just me or does this seem like a pretty harsh error for an empty switch() statement! ;) Then again, Flex Builder 3 is still in beta... --- In flexcoders@yahoogroups.com, byte.sensei [EMAIL PROTECTED] wrote: I tried un-installing, deleting the My Documents\Flex Builder 3\ folder, then re-installing and adding the project from scratch again. Still no luck. I closed that project and made a new Flex project and it will compile/run fine, so I *think* it has something to do with the project (and not the general IDE / compiler) but I can't figure out what. I'm at a loss... Anyone out there experienced anything like this? --- In flexcoders@yahoogroups.com, byte.sensei byte.sensei@ wrote: Note: I already tried Project Clean and running Flex from the command line with the -clean option, but it's still giving me the internal build error. I also tried dropping the entire project and re- creating it from scratch, but still no luck... --- In flexcoders@yahoogroups.com, byte.sensei byte.sensei@ wrote: I've been working with Flex Builder 3 beta 2 fine for the past several days, and then all of the sudden I got a message saying, an internal build error has occurred. Please check the Error log. So I opened the error log (at {Workspace Dir}\.metadata\.log) and have been trying to figure out how to correct the problem. Here's what is in the .log file (condensed version):
[flexcoders] Re: Flash CS3 Components - Tweens in Flex
Downloaded/Insalled Flex 3 B2 and it works, so you were right. I wasn't quite ready to migrate to Flex 3 but this forced the issue. I guess the timing was good since B2 was just updated! ;) Thanks for your help (as always) Alex! --- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: I think that's a bug that's been fixed in 3.0 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of byte.sensei Sent: Monday, October 01, 2007 2:04 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Flash CS3 Components - Tweens in Flex Here's the stack trace: TypeError: Error #1006: effectStarted is not a function. at mx.effects::EffectInstance/startEffect() at mx.effects::Effect/play() at com.symetri.elf_island.ui.view::room_forest/::moveImage() at com.symetri.elf_island.ui.view::room_forest/::mouse_down_handler() at com.symetri.elf_island.ui.view::room_forest/__myRoom_mouseDown() --- In flexcoders@yahoogroups.com mailto:flexcoders% 40yahoogroups.com , Alex Harui aharui@ wrote: Please compile a debug version and show the whole stack trace.
[flexcoders] Flash CS3 Components - Custom Properties Methods
I've been experimenting with Flex SWC Components developed in Flash CS3 (using Flex Component Kit for Flash CS3). I've successfully created some custom properties/methods on these that I can use in Flex. Here's a quick example of a UIMovieClip class extension: package { import mx.flash.UIMovieClip; public dynamic class forestDragon extends UIMovieClip { public var current_state : String = ; public var my_name : String = ; public var my_color : String = ; public function forestDragon():void { } public function fly_begin():void { gotoAndPlay(1); } public function fly_end():void { gotoAndStop(1); } } } So, in Flex I can then get/set the current_state variable and call the fly_begin() and fly_end() methods as needed to start/stop the component animations. All of this works great, but I'm now faced with a new challenge. For example, I want to be able to set my_color and/or my_name via Flex and then have it change the color of the Flash object or change the text underneath the animation to whatever my_name is set to, etc. However, I can't figure out how I can reference these properties or use them to control aspects of the Flash movie clip. I first tried creating a dynamic text instance on the Flash movie clip but whenever I publish the SWC it's throwing an error. I can add dynamic text elements to the Flash movie clip, but if I give it an instance name it won't compile/export. Obviously, the real strength of Flex Components developed in Flash CS3 comes when you can take advantage of custom properties/methods to change aspects of the Flash movie clip dynamically via Flex. Am I approaching this the right way, and if so (or not) can anyone provide some direction/insight on how to accomplish this? Thanks!
[flexcoders] Re: Flash CS3 Components - Tweens in Flex
Here's the stack trace: TypeError: Error #1006: effectStarted is not a function. at mx.effects::EffectInstance/startEffect() at mx.effects::Effect/play() at com.symetri.elf_island.ui.view::room_forest/::moveImage() at com.symetri.elf_island.ui.view::room_forest/::mouse_down_handler() at com.symetri.elf_island.ui.view::room_forest/__myRoom_mouseDown() --- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: Please compile a debug version and show the whole stack trace.
[flexcoders] Flash CS3 Components - Tweens in Flex
I have some Flash CS3 animations (characters walking/running) that I have exported as Flex 2 components (SWC files) using the Flex Component Kit for Flash CS3. I create an instance of the component in Flex, then need to be able to have the character move to the mouse position when a user clicks. As an initial test, I used a PNG image and setup a move tween, which works great. However, as soon as I try and use the Flex component, I get an Error #1006 -- apparently the tween doesn't work on the Flex component object type. Basically, what I'm trying to do when a user clicks is: Put the Flex component into an animated walking state (from a static/standing position) then have the character move across the screen to where the mouse was clicked. I've got the first part working great (the character starts the walking animation loop) but the Flex move tween is throwing the error. Any ideas on how to accomplish this? Note: I also need a simultaneous zoom tween to scale the character slightly for perspective -- again this works when I use a static image but throws the same Error #1006 when I try and apply it to the animation Flex component.
[flexcoders] Motion/Zoom Tweens on Flash CS3 Components
I have a Flex app with some animated characters that (are supposed to) move around the screen when you click the mouse. The animations are done in Flash CS3, then exported as Flex SWC Components using the Flex Component Kit for Flash CS3. Initially, I used static JPG/PNG images for characters, and created Move/Zoon tweens in Flex that would move the images around the screen. However, when I replaced the static images with the SWC components, it didn't work. The characters properly change from a standing state to a walking state (looping animation) but when I try to play the move/zoom tweens it throws an error (Error #1006). Researching this error it seems it can happen when the object you are applying a method to is the wrong type. But shouldn't I be able to use this method to move the SWC components around the screen? If not, how can I move/zoom the SWC components when a user clicks the mouse? Essentially, a mouse click should cause the character to enter the walking state/animation, then play the move/zoom tweens to take the component to the mouse click position, then return the character to a standing state. Any insight is appreciated!
[flexcoders] DataGrid itemRenderer
I've been pulling my hair out trying to figure out the best way to format numbers in a DataGrid. I've got a dataProvider with fields used in the grids that are of type Number -- some are currency, some are integers, and some are numbers that need to be formatted to 1 decimal point. In other places in my application, I'm using a custom function to format numbers: public function format_number(num : Number, format : String) : String { var formatter : NumberFormatter = new NumberFormatter(); var str : String; switch (format) { case currency: formatter.precision = 2; formatter.useThousandsSeparator = true; str = $ + formatter.format(num); break; case percent: formatter.precision = 1; formatter.useThousandsSeparator = true; str = formatter.format(num*100) + %; break; case decimal2: formatter.precision = 2; formatter.useThousandsSeparator = false; str = formatter.format(num); break; case cuft: formatter.precision = 1; formatter.useThousandsSeparator = true; if (num 0) { num = 0 } str = formatter.format(num); break; default: str = String(num); break; } return str; } However, I can't figure out a way to utilize this function on my DataGrid columns. I've tried creating both inline and external itemRenderer components, but in both cases I don't see a way to inject the required Actionscript into the itemRenderer component -- I keep getting compile errors when I try to use an mx:Script block in the component. Anyone know of a way to make this work?
[flexcoders] Re: DataGrid itemRenderer
Awesome - works great. Thanks Alex - sometimes the biggest problem is figuring out that something like labelFunction exists. I read through the Flex help docs but must've somehow overlooked this. --- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: read up on labelFunction From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of byte.sensei Sent: Wednesday, September 26, 2007 7:59 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] DataGrid itemRenderer I've been pulling my hair out trying to figure out the best way to format numbers in a DataGrid. I've got a dataProvider with fields used in the grids that are of type Number -- some are currency, some are integers, and some are numbers that need to be formatted to 1 decimal point. In other places in my application, I'm using a custom function to format numbers: public function format_number(num : Number, format : String) : String { var formatter : NumberFormatter = new NumberFormatter(); var str : String; switch (format) { case currency: formatter.precision = 2; formatter.useThousandsSeparator = true; str = $ + formatter.format(num); break; case percent: formatter.precision = 1; formatter.useThousandsSeparator = true; str = formatter.format(num*100) + %; break; case decimal2: formatter.precision = 2; formatter.useThousandsSeparator = false; str = formatter.format(num); break; case cuft: formatter.precision = 1; formatter.useThousandsSeparator = true; if (num 0) { num = 0 } str = formatter.format(num); break; default: str = String(num); break; } return str; } However, I can't figure out a way to utilize this function on my DataGrid columns. I've tried creating both inline and external itemRenderer components, but in both cases I don't see a way to inject the required Actionscript into the itemRenderer component -- I keep getting compile errors when I try to use an mx:Script block in the component. Anyone know of a way to make this work?
[flexcoders] tabNavigator - dynamic tabs?
I have a tabNavigator with 3 mx:Canvas tabs, each containing a dataGrid for a different user/customer. Above the tabNavigator you can select up to 3 different users/customers, and this populates the associated grid in the tabNavigator. Pretty straightforward -- *except* that I don't want the tabs in the tabNavigator to be visible until you've selected a user/customer above. I tried setting the visible property of my mx:Canvas containers, but the tab still shows up regardless of whether the child is visible or not. Is there a way to prevent tabs in the tabNavigator from showing up? I could always dynamically add/remove the child mx:Canvas objects via actionscript, but in this case it's always 0-3 and I'd rather just create 3 mx:Canvas objects in MXML and then show/hide them as needed. I'm just baffled that visible=false on the mx:Canvas child objects doesn't take away the tab in the tabNavigator! Is this by design?
[flexcoders] Embedded SWF in Flex 2
I have a Flex 2 app with an embedded SWF file that I'm loading into Flex with mx:SWFLoader. The swf file is a fairly complex form written in Flash 8 / AS 2.0 that uses xml web services to pull data into a form which is edited and then re-submitted. Once a user is finished with the embedded swf form, (s)he clicks a button which saves all the form data via another web service call, then I *want* to pass control back to the Flex app with an event or trigger that I can recognize to continue the data entry process. How can I get the embedded swf form to trigger an event and/or function in the parent Flex 2 application? I also need to pass a variable back to the Flex app. So, in a nutshell, when a user clicks the submit button of the embedded swf form, I need it to save the form data then pass a variable (e.g. CartID) back to the Flex app and let Flex handle the process from there. Any thoughts on how to accomplish this? NOTE: I've set trustContent=true in the mx:SWFLoader, but I can't seem to find any decent documentation on how to access the parent Flex app functions/events or pass data back and forth, etc.
[flexcoders] Flex / Web Integration
I have a Flex 2.0 app that has to open a URL used to configure a shopping cart item. When finished configuring an item and you return to Flex, Flex calls a web service to retrieve the item configuration and all is good. Currently, I'm opening a new browser window using navigateToURL() with _blank for the target. This presents a couple of problems: 1) When the item configuration is done and the window is closed (using Javascript) I get the annoying The webpage you are using is trying to close the window and you have to verify that you want to close the window. 2) I don't have any good way to detect the window was closed and then fire off the web service to get the item configuration -- I basically have to wait for the user to do something back in the Flex app that causes an event to fire that I can trigger on. (I'm currently using the focusOut event of the Quantity field in the item data grid, but there's no guarantee the user will click/tab into a quantity field and then back out after configuring an item...) So, does anyone know of a way I could open a new window/url for the item configuration, but then return to the Flex app without the Do you want to close this window? dialog box AND in a way that would fire a Flex event I can use to trigger the web service call? I don't have any control over the item configuration URL/code -- it's a 3rd party application I'm integrating with... Thanks in advance for any insight/help!
[flexcoders] Re: Flex / Web Integration
I solved my own problem and thought I'd post the result here for posterity... For #1 below, I switched to using the javascript window.open command instead of navigateToURL() with _blank for the target. Specifically, I'm using the following AS 3 code: import flash.external.ExternalInterface; public function open_window(url : String, window : String = _blank, features : String = ) : void { ExternalInterface.call(window.open, url, window, features); } For problem #2 below, I found the activate event and use it to detect when Flash Player receives focus after the pop-up window is closed, and then call the web service -- works great! --- In flexcoders@yahoogroups.com, byte.sensei [EMAIL PROTECTED] wrote: I have a Flex 2.0 app that has to open a URL used to configure a shopping cart item. When finished configuring an item and you return to Flex, Flex calls a web service to retrieve the item configuration and all is good. Currently, I'm opening a new browser window using navigateToURL() with _blank for the target. This presents a couple of problems: 1) When the item configuration is done and the window is closed (using Javascript) I get the annoying The webpage you are using is trying to close the window and you have to verify that you want to close the window. 2) I don't have any good way to detect the window was closed and then fire off the web service to get the item configuration -- I basically have to wait for the user to do something back in the Flex app that causes an event to fire that I can trigger on. (I'm currently using the focusOut event of the Quantity field in the item data grid, but there's no guarantee the user will click/tab into a quantity field and then back out after configuring an item...) So, does anyone know of a way I could open a new window/url for the item configuration, but then return to the Flex app without the Do you want to close this window? dialog box AND in a way that would fire a Flex event I can use to trigger the web service call? I don't have any control over the item configuration URL/code -- it's a 3rd party application I'm integrating with... Thanks in advance for any insight/help!