[flexcoders] Hiring for senior flex developer
Rain in American Fork, Utah is currently looking for a senior-level Flex developer. This is for a full-time employee or contractor (but must be local). There are a lot of great benefits and it's an awesome company to work for. Rain's website: http://mediarain.com Job Listing: http://www.authenticjobs.com/jobs/5244 Aaron http://mediarain.com/us/employment/flexdeveloper
Re: [flexcoders] how to find redundant classes?
FlexPMD would probably do the trick: http://opensource.adobe.com/wiki/display/flexpmd/FlexPMD Aaron On Thu, Apr 22, 2010 at 1:51 PM, Nick Middleweek n...@middleweek.co.ukwrote: Hi, Is there a quick way to find Classes that I no longer need? I'm sure I've asked this before but I can't find the thread... Unless I thought about asking it but didn't :-) I'm going through a project, some of it was inherited and some I don't know if I need anymore... Is there a good way of doing this from Eclipse or otherwise? I'm using the FB4 plugin with the 3.4 SDK. Thanks, Nick
Re: [flexcoders] Re: Updating renderer properties
I know this is an old thread, but for those who come across this in the future, this is a great article that sums up the problem and solutions quite well: http://www.adobe.com/devnet/flex/articles/itemrenderers_pt3_02.html Aaron On Fri, Jan 8, 2010 at 10:47 PM, Aaron Hardy aaronius...@gmail.com wrote: Thanks for sharing your thoughts and examples. In my case I decided to pass in a model with a property into the renderers. The model is passed into the renderer by specifying it as a property value in the renderer class factory. The model doesn't ever get replaced after that, but the property inside the model does. I can't say any solution really strikes my fancy, but this seemed to be the most appropriate. Again, thanks for the discussion. Aaron On Fri, Jan 8, 2010 at 9:07 AM, valdhor valdhorli...@embarqmail.comwrote: I set up a quick test bed based on your original post and using a static variable in the renderer(s) and it worked rather well. It may not be what you are after but I will post the example here for others that may want to use this. Application: ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=vertical width=700 mx:Script ![CDATA[ import mx.collections.ArrayCollection; import Renderers.CityRenderer; import Renderers.CompanyRenderer; [Bindable] public var initDG:ArrayCollection = new ArrayCollection([ {Company: 'Acme', Contact: 'Bob Jones', Phone: '413-555-1212', City: 'Boston', State: 'MA'}, {Company: 'Allied', Contact: 'Jane Smith', Phone: '617-555-3434', City: 'SanFrancisco', State: 'CA'}, {Company: 'Acme', Contact: 'Bob Jones', Phone: '413-555-1212', City: 'Boston', State: 'MA'}, {Company: 'Allied', Contact: 'Jane Smith', Phone: '617-555-3434', City: 'SanFrancisco', State: 'CA'}, {Company: 'Acme', Contact: 'Bob Jones', Phone: '413-555-1212', City: 'Boston', State: 'MA'}, {Company: 'Allied', Contact: 'Jane Smith', Phone: '617-555-3434', City: 'SanFrancisco', State: 'CA'}, {Company: 'Acme', Contact: 'Bob Jones', Phone: '413-555-1212', City: 'Boston', State: 'MA'}, {Company: 'Allied', Contact: 'Jane Smith', Phone: '617-555-3434', City: 'SanFrancisco', State: 'CA'}, {Company: 'Acme', Contact: 'Bob Jones', Phone: '413-555-1212', City: 'Boston', State: 'MA'}, ]); private function setColors():void { CityRenderer.textColor = #FF; CompanyRenderer.textColor = #FF; initDG.refresh(); } private function resetColors():void { CityRenderer.textColor = #00; CompanyRenderer.textColor = #00; initDG.refresh(); } ]] /mx:Script mx:DataGrid id=myGrid rowHeight=22 dataProvider={initDG} rowCount={initDG.length} mx:columns mx:DataGridColumn dataField=Company itemRenderer=Renderers.CompanyRenderer/ mx:DataGridColumn dataField=Contact/ mx:DataGridColumn dataField=Phone/ mx:DataGridColumn dataField=City width=150 itemRenderer=Renderers.CityRenderer/ /mx:columns /mx:DataGrid mx:HBox mx:Button label=Set Colors click=setColors()/ mx:Button label=Reset Colors click=resetColors()/ /mx:HBox /mx:Application CityRenderer.as: package Renderers { import mx.controls.*; import mx.controls.dataGridClasses.DataGridListData; public class CityRenderer extends Text { public static var textColor:String = #00; public function CityRenderer() { super(); } override public function set data(value:Object):void { super.data = value; if(value != null) { text = value[DataGridListData(listData).dataField]; } } override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { super.updateDisplayList(unscaledWidth, unscaledHeight); setStyle(color, CityRenderer.textColor); } } } CompanyRenderer.as: package Renderers { import mx.controls.*; import mx.controls.dataGridClasses.DataGridListData; public class CompanyRenderer extends Text { public static var textColor:String = #00; public function CompanyRenderer() { super(); } override public function set data(value:Object):void { super.data = value; if(value != null) { text = value[DataGridListData(listData).dataField]; } } override protected function
Re: [flexcoders] Bitmap width/height 0 when loading image from hard drive
Thanks Alex for the follow-up. Your questions prompted me to dig into the memory load more and it looks like we had some bad memory issues. Specifically, when the user selects a bunch of photos, we load those images in using file.load() and then generate small thumbnails from the loaded data. The problem was we were keeping around the file references while the files were also being uploaded. The full file data (stored in the data property on FileReference) was no longer needed in the app after the thumbnail was generated but we were hanging onto it anyway. By calling file.data.clear() after generating each thumbnail we were able to free up that memory...which was a LOT of memory. So, the short story is there DOES seem to be some funky business in Loader when Flash Player is under a lot of memory stress. On the flip side we've reduced the memory stress sufficiently to hopefully not run into the issue in the first place. To answer your questions anyway: The process memory was up around 1 GB before we starting running into trouble (with proper memory cleanup this is dramatically lower). This is on a 4 GB memory Windows Vista machine and I had quite a few other applications open (Flex Builder, Illustrator, etc.) I had loaded in 450 images with each being roughly 1.5 MB each as compressed JPGs and we were creating thumbnails at about 150x100 pixels each (~60k in BitmapData each or ~27MB for 450 thumbnails). Reports from other people show they were getting problems with less than 200 images but we haven't dug into the details of the size of their images, etc. In our test, all 450 thumbnails were still around which took up around 27 MB. And, because of improper memory cleanup, 450 full bitmaps loaded from the hard drive were still in memory also. Thanks for the help. Hopefully that will clear up our problems. Aaron On Mon, Feb 22, 2010 at 11:15 PM, Alex Harui aha...@adobe.com wrote: How much process memory is the browser using when you run into trouble? How many images have you loaded? How many of those images are still around? On 2/22/10 4:48 PM, Aaron Hardy aaronius...@gmail.com wrote: And yet another update. Sorry for the large number of emails. It looks like the more and more I use the application and add stress to the Flash Player the smaller the image must be in order to avoid the 0 dimensions issue. In other words, if the Flash Player doesn't have much stress I can load an image that's 24 million pixels just fine. As I add more stress and then attempt to load the same image, I'll start to get 0 width and height, but I'll be able to load a 14 million pixel image (4350x3263=14.1 million pixels) just fine. If I continue adding stress to the Flash Player and I continue to load the same 14 million pixel image I'll start to get 0 width and height for that image, even if it's under the bitmap limits. At that point I can load a 12 million pixel image fine. If I continue to use the app and add stress, I'll soon not be not even be able to load the same 12 million pixel image. This imaginary limit seems to get smaller and smaller over time and has very little, if anything, to do with Flash's max bitmap dimensions. Aaron On Mon, Feb 22, 2010 at 5:12 PM, Aaron Hardy aaronius...@gmail.com wrote: I've gathered additional information. It appears that it's due to bitmaps that are over the supported size (16,777,215 pixels). While the bitmaps load in fine when the Flash Player isn't under much stress, the width/height choke when there is stress. Again, it isn't consistent, but that seems to be the issue. I read somewhere that when loading a bitmap in using Loader that the maximum dimensions didn't apply, but that appears to not be the case and from Adobe I've only heard that all bets are off with bitmaps over 16,777,215 pixels. I'll update the thread if it turns out to be something different. Aaron On Mon, Feb 22, 2010 at 4:28 PM, Aaron Hardy aaronius...@gmail.com wrote: It's not any particular photo or set of photos. Sometimes we can run the app and load the photos just fine then the next day we'll attempt to load the same files and the width/height will return 0. It seems that once the issue starts to occur that any time we try to upload any photo within that session it continues reporting width/height of 0. There's not a very reproducible pattern though it seems to occur more frequently when the Flash Player is under heavy stress like when it's trying to load in many files at the same time. It also seems to happen more frequently if we have two tabs open with the same application loaded in both and we're attempting to load the same images in both tabs (this may be related to the stress the Flash Player is under rather than some sort of file locking issue). Again, it doesn't always happen, just more frequently under those scenarios. We've created a queue so only one photo is loading in at a time and we even threw
[flexcoders] Bitmap width/height 0 when loading image from hard drive
Flexers, We have an app that allows a user to upload images. When the user selects an image, we load the bitmap from the hard drive and create a thumbnail from it. However, every once in a while the bitmap will return 0 for both width and height which causes issues later on. That vast majority of the time the width/height are returned correctly. Here's the basic code of the image loading--it's nothing special: override public function execute():void { file.addEventListener(Event.COMPLETE, fileLoadedHandler); file.addEventListener(IOErrorEvent.IO_ERROR, fileLoadErrorHandler); file.load(); } /** * The files bytes were loaded successfully. */ protected function fileLoadedHandler(event:Event):void { file.removeEventListener(Event.COMPLETE, fileLoadedHandler); file.removeEventListener(IOErrorEvent.IO_ERROR, fileLoadErrorHandler); var ba:ByteArray = file.data; loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, bitmapLoadedHandler); loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, bitmapLoadFailedHandler); loader.loadBytes(ba); } /** * The bitmap was successfully loaded from the file's bytes. */ protected function bitmapLoadedHandler(event:Event):void { loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, bitmapLoadedHandler); loader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, bitmapLoadFailedHandler); try { var fullSizeBitmap:Bitmap = Bitmap(loader.content); if (fullSizeBitmap.width == 0 || fullSizeBitmap.height == 0) { // There's a problem. } ... Any idea why this would be the case? Is it a Flash Player bug? Any help is much appreciated. Aaron
Re: [flexcoders] Bitmap width/height 0 when loading image from hard drive
It's not any particular photo or set of photos. Sometimes we can run the app and load the photos just fine then the next day we'll attempt to load the same files and the width/height will return 0. It seems that once the issue starts to occur that any time we try to upload any photo within that session it continues reporting width/height of 0. There's not a very reproducible pattern though it seems to occur more frequently when the Flash Player is under heavy stress like when it's trying to load in many files at the same time. It also seems to happen more frequently if we have two tabs open with the same application loaded in both and we're attempting to load the same images in both tabs (this may be related to the stress the Flash Player is under rather than some sort of file locking issue). Again, it doesn't always happen, just more frequently under those scenarios. We've created a queue so only one photo is loading in at a time and we even threw in the Grant Skinner hack of forcing garbage collection between each load to see if that would help. That did actually decrease the frequency of the issue quite a bit but not sufficiently. Since posting we've tweaked the code slightly to use the width/height properties on the bitmapdata instead of the bitmap itself. I doubt it will make any difference but at least it narrows it down a bit. Aaron On Mon, Feb 22, 2010 at 1:05 PM, Alex Harui aha...@adobe.com wrote: Is there a particular file that gives you trouble or wil it load successfully at some other point? On 2/22/10 10:06 AM, Aaron Hardy aaronius...@gmail.com wrote: Flexers, We have an app that allows a user to upload images. When the user selects an image, we load the bitmap from the hard drive and create a thumbnail from it. However, every once in a while the bitmap will return 0 for both width and height which causes issues later on. That vast majority of the time the width/height are returned correctly. Here's the basic code of the image loading--it's nothing special: override public function execute():void { file.addEventListener(Event.COMPLETE, fileLoadedHandler); file.addEventListener(IOErrorEvent.IO_ERROR, fileLoadErrorHandler); file.load(); } /** * The files bytes were loaded successfully. */ protected function fileLoadedHandler(event:Event):void { file.removeEventListener(Event.COMPLETE, fileLoadedHandler); file.removeEventListener(IOErrorEvent.IO_ERROR, fileLoadErrorHandler); var ba:ByteArray = file.data; loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, bitmapLoadedHandler); loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, bitmapLoadFailedHandler); loader.loadBytes(ba); } /** * The bitmap was successfully loaded from the file's bytes. */ protected function bitmapLoadedHandler(event:Event):void { loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, bitmapLoadedHandler); loader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, bitmapLoadFailedHandler); try { var fullSizeBitmap:Bitmap = Bitmap(loader.content); if (fullSizeBitmap.width == 0 || fullSizeBitmap.height == 0) { // There's a problem. } ... Any idea why this would be the case? Is it a Flash Player bug? Any help is much appreciated. Aaron -- Alex Harui Flex SDK Team Adobe System, Inc. http://blogs.adobe.com/aharui
Re: [flexcoders] Bitmap width/height 0 when loading image from hard drive
I've gathered additional information. It appears that it's due to bitmaps that are over the supported size (16,777,215 pixels). While the bitmaps load in fine when the Flash Player isn't under much stress, the width/height choke when there is stress. Again, it isn't consistent, but that seems to be the issue. I read somewhere that when loading a bitmap in using Loader that the maximum dimensions didn't apply, but that appears to not be the case and from Adobe I've only heard that all bets are off with bitmaps over 16,777,215 pixels. I'll update the thread if it turns out to be something different. Aaron On Mon, Feb 22, 2010 at 4:28 PM, Aaron Hardy aaronius...@gmail.com wrote: It's not any particular photo or set of photos. Sometimes we can run the app and load the photos just fine then the next day we'll attempt to load the same files and the width/height will return 0. It seems that once the issue starts to occur that any time we try to upload any photo within that session it continues reporting width/height of 0. There's not a very reproducible pattern though it seems to occur more frequently when the Flash Player is under heavy stress like when it's trying to load in many files at the same time. It also seems to happen more frequently if we have two tabs open with the same application loaded in both and we're attempting to load the same images in both tabs (this may be related to the stress the Flash Player is under rather than some sort of file locking issue). Again, it doesn't always happen, just more frequently under those scenarios. We've created a queue so only one photo is loading in at a time and we even threw in the Grant Skinner hack of forcing garbage collection between each load to see if that would help. That did actually decrease the frequency of the issue quite a bit but not sufficiently. Since posting we've tweaked the code slightly to use the width/height properties on the bitmapdata instead of the bitmap itself. I doubt it will make any difference but at least it narrows it down a bit. Aaron On Mon, Feb 22, 2010 at 1:05 PM, Alex Harui aha...@adobe.com wrote: Is there a particular file that gives you trouble or wil it load successfully at some other point? On 2/22/10 10:06 AM, Aaron Hardy aaronius...@gmail.com wrote: Flexers, We have an app that allows a user to upload images. When the user selects an image, we load the bitmap from the hard drive and create a thumbnail from it. However, every once in a while the bitmap will return 0 for both width and height which causes issues later on. That vast majority of the time the width/height are returned correctly. Here's the basic code of the image loading--it's nothing special: override public function execute():void { file.addEventListener(Event.COMPLETE, fileLoadedHandler); file.addEventListener(IOErrorEvent.IO_ERROR, fileLoadErrorHandler); file.load(); } /** * The files bytes were loaded successfully. */ protected function fileLoadedHandler(event:Event):void { file.removeEventListener(Event.COMPLETE, fileLoadedHandler); file.removeEventListener(IOErrorEvent.IO_ERROR, fileLoadErrorHandler); var ba:ByteArray = file.data; loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, bitmapLoadedHandler); loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, bitmapLoadFailedHandler); loader.loadBytes(ba); } /** * The bitmap was successfully loaded from the file's bytes. */ protected function bitmapLoadedHandler(event:Event):void { loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, bitmapLoadedHandler); loader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, bitmapLoadFailedHandler); try { var fullSizeBitmap:Bitmap = Bitmap(loader.content); if (fullSizeBitmap.width == 0 || fullSizeBitmap.height == 0) { // There's a problem. } ... Any idea why this would be the case? Is it a Flash Player bug? Any help is much appreciated. Aaron -- Alex Harui Flex SDK Team Adobe System, Inc. http://blogs.adobe.com/aharui
Re: [flexcoders] Bitmap width/height 0 when loading image from hard drive
And yet another update. Sorry for the large number of emails. It looks like the more and more I use the application and add stress to the Flash Player the smaller the image must be in order to avoid the 0 dimensions issue. In other words, if the Flash Player doesn't have much stress I can load an image that's 24 million pixels just fine. As I add more stress and then attempt to load the same image, I'll start to get 0 width and height, but I'll be able to load a 14 million pixel image (4350x3263=14.1 million pixels) just fine. If I continue adding stress to the Flash Player and I continue to load the same 14 million pixel image I'll start to get 0 width and height for that image, even if it's under the bitmap limits. At that point I can load a 12 million pixel image fine. If I continue to use the app and add stress, I'll soon not be not even be able to load the same 12 million pixel image. This imaginary limit seems to get smaller and smaller over time and has very little, if anything, to do with Flash's max bitmap dimensions. Aaron On Mon, Feb 22, 2010 at 5:12 PM, Aaron Hardy aaronius...@gmail.com wrote: I've gathered additional information. It appears that it's due to bitmaps that are over the supported size (16,777,215 pixels). While the bitmaps load in fine when the Flash Player isn't under much stress, the width/height choke when there is stress. Again, it isn't consistent, but that seems to be the issue. I read somewhere that when loading a bitmap in using Loader that the maximum dimensions didn't apply, but that appears to not be the case and from Adobe I've only heard that all bets are off with bitmaps over 16,777,215 pixels. I'll update the thread if it turns out to be something different. Aaron On Mon, Feb 22, 2010 at 4:28 PM, Aaron Hardy aaronius...@gmail.comwrote: It's not any particular photo or set of photos. Sometimes we can run the app and load the photos just fine then the next day we'll attempt to load the same files and the width/height will return 0. It seems that once the issue starts to occur that any time we try to upload any photo within that session it continues reporting width/height of 0. There's not a very reproducible pattern though it seems to occur more frequently when the Flash Player is under heavy stress like when it's trying to load in many files at the same time. It also seems to happen more frequently if we have two tabs open with the same application loaded in both and we're attempting to load the same images in both tabs (this may be related to the stress the Flash Player is under rather than some sort of file locking issue). Again, it doesn't always happen, just more frequently under those scenarios. We've created a queue so only one photo is loading in at a time and we even threw in the Grant Skinner hack of forcing garbage collection between each load to see if that would help. That did actually decrease the frequency of the issue quite a bit but not sufficiently. Since posting we've tweaked the code slightly to use the width/height properties on the bitmapdata instead of the bitmap itself. I doubt it will make any difference but at least it narrows it down a bit. Aaron On Mon, Feb 22, 2010 at 1:05 PM, Alex Harui aha...@adobe.com wrote: Is there a particular file that gives you trouble or wil it load successfully at some other point? On 2/22/10 10:06 AM, Aaron Hardy aaronius...@gmail.com wrote: Flexers, We have an app that allows a user to upload images. When the user selects an image, we load the bitmap from the hard drive and create a thumbnail from it. However, every once in a while the bitmap will return 0 for both width and height which causes issues later on. That vast majority of the time the width/height are returned correctly. Here's the basic code of the image loading--it's nothing special: override public function execute():void { file.addEventListener(Event.COMPLETE, fileLoadedHandler); file.addEventListener(IOErrorEvent.IO_ERROR, fileLoadErrorHandler); file.load(); } /** * The files bytes were loaded successfully. */ protected function fileLoadedHandler(event:Event):void { file.removeEventListener(Event.COMPLETE, fileLoadedHandler); file.removeEventListener(IOErrorEvent.IO_ERROR, fileLoadErrorHandler); var ba:ByteArray = file.data; loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, bitmapLoadedHandler); loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, bitmapLoadFailedHandler); loader.loadBytes(ba); } /** * The bitmap was successfully loaded from the file's bytes. */ protected function bitmapLoadedHandler(event:Event):void
[flexcoders] Reason for image list flickering
Hey flexers, When scrolling a list of images up and down there is some flickering that goes on. I know how to fix it, but I'd really like to know the underlying reason it occurs. Ely Greenfield ( http://www.quietlyscheming.com/blog/2007/01/23/some-thoughts-on-doubt-on-flex-as-the-best-option-orhow-i-made-my-flex-images-stop-dancing/) says because of some of the details of the Flash Player’s networking layer, there is always a delay of at least a frame between when you request an image url, and when it is actually loaded. What exactly are those details? Flash Player doesn't seem to be reloading the images from the browser cache so it seems like that's not part of the equation. I ask mainly because I'm preparing a related presentation for 360|Flex and want to provide a more in-depth explanation if necessary. Thanks! Aaron
Re: [flexcoders] Augmented reality in Flex
Try the is your question once again more please. Aaron On Sat, Feb 6, 2010 at 3:44 PM, Christophe christophe_jacque...@yahoo.frwrote: Hello, Does there is augmented reality projects for Ecommerce developped in Flex ? Thank you, Christophe,
Re: [flexcoders] Re: Dealing with images larger than Flash Player 10 limit
Scratch that. Although we see it very frequently when using the Flex debugger, we're still seeing it albeit less frequently in regular running mode of the app when it's on a production server. It doesn't seem to be related to the size of the bitmap being loaded in either. It occurs in a random pattern, but more frequently when flash player is ramping up memory (like when we're loading in a lot of images within a short period of time). From all indications it seems to be a Flash Player bug, but making it reproducible enough for the Flash Player devs to fix is another challenge. If anyone encounters this issue in the future let me know. Thanks. Aaron On Tue, Dec 15, 2009 at 1:09 PM, Aaron Hardy aaronius...@gmail.com wrote: Thank you very much for the response. Your code looked eerily similar to the code I was already using, but I plugged your code into a fresh project and it worked. It baffled my mind. I went back to my project and I got the same issue I was seeing before--the bitmap data would return 0 for both width and height. The flex debugger showed Error #2015: Invalid BitmapData. for both getters. I assumed it was due to the 16.7 million limit (which doesn't seem to apply to bitmaps created by loaders) because I consistently saw the issue with images over that size. On a whim I tried our project without the debugger (just a normal run) and it worked! If that isn't crazy enough, I started noticing that the longer I used Flex builder the more common the issue became--that is, images at 13,000,000 pixels even started reporting 0 width and height (and the invalid bitmap error in the variables debugger view). Thanks for taking the time to send your code and prompting me to look deeper. Aaron On Tue, Dec 15, 2009 at 11:43 AM, jamesfin james.alan.finni...@gmail.comwrote: This example refines the image down to 80x80. SmoothImage is derived from Image. I tested it against a 7000x6000 8.5mb jpg with no problems. It also scales to the smaller side if they aren't equal. main code... private var uploadReference:FileReference = new FileReference(); uploadReference.addEventListener(Event.SELECT, loadImage); uploadReference.addEventListener(Event.CANCEL, cancelImage); uploadReference.addEventListener(Event.COMPLETE, uploadCompleted); private function loadPicture(evt:MouseEvent):void{ var imageArray:Array = new Array(); imageArray.push(new FileFilter(My Image, .png;*.jpg;*.jpeg;*.gif)); uploadReference.browse(imageArray); } private function loadImage(evt:Event):void{ uploadReference.load(); } private function uploadCompleted(e:Event):void{ if(FileReference(e.target).data.length == 0){ return; } var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onImageLoad); loader.loadBytes(FileReference(e.target).data); } private function onImageLoad(e:Event):void { var imageBitmapData:BitmapData = Bitmap(e.target.content).bitmapData; var loader:Loader = Loader(e.target.loader); var smoother:SmoothImage = new SmoothImage(); smoother.load(new Bitmap(imageBitmapData, auto, true)); smoother.content.width = 80; smoother.content.height = 80; smoother.width = 80; smoother.height = 80; if(imageBitmapData.width 80 || imageBitmapData.height 80){ var imageSmoothed:SmoothImage = new SmoothImage(); imageSmoothed.maintainAspectRatio = true; imageSmoothed.load(new Bitmap(imageBitmapData, auto, true)); var maxSize:Number = Math.max(imageBitmapData.width, imageBitmapData.height); if(maxSize == imageBitmapData.width){ var widthScale:Number = 80 / imageBitmapData.width; var newWidth:Number = imageBitmapData.width * widthScale; var newHeight:Number = imageBitmapData.height * widthScale; imageSmoothed.content.width = newWidth; imageSmoothed.content.height = newHeight; imageSmoothed.width = newWidth; imageSmoothed.height = newHeight; var finalBitmap:BitmapData = new BitmapData(newWidth, newHeight); finalBitmap.draw(imageSmoothed); imageBitmapData = null; imageBitmapData = finalBitmap; }else{ var heightScale:Number = 80 / imageBitmapData.height; var newWidth2:Number = imageBitmapData.width * heightScale; var newHeight2:Number = imageBitmapData.height * heightScale; imageSmoothed.content.width = newWidth2; imageSmoothed.content.height = newHeight2; imageSmoothed.width = newWidth2; imageSmoothed.height = newHeight2; var finalBitmap2:BitmapData = new BitmapData(newWidth2, newHeight2); finalBitmap2.draw(imageSmoothed); imageBitmapData = null; imageBitmapData = finalBitmap2; } } // some image... imageToDisplay.source = new Bitmap(imageBitmapData); } --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Aaron Hardy aaronius...@... wrote: Hey flexers, We're working on a project currently where we would like to allow users to add photos from their local drive to the stage. We also want to support gigantic photos. I understand the max bitmap size
Re: [flexcoders] TextField caret moving two letters at a time
It looks like it's a combination of Firefox and a transparent wmode as can be seen here ( http://www.5etdemi.com/blog/archives/2005/06/firefox-wmodetransparent-is-completely-screwy-and-breaks-textfields/) in Firefox 3.5.7 and Flash Player 10. The blog post wasn't created to demonstrate the double-character movement, but the issue reveals itself in the example anyway. Thanks for the wmode tip. I knew the wmode had issues, but didn't think it could intervene with text fields in such a manner. Aaron On Tue, Jan 26, 2010 at 11:03 PM, Alex Harui aha...@adobe.com wrote: Try a new project with just a couple of controls. Could be a non-standard wmode, or problem with the HTML wrapper. On 1/26/10 4:25 PM, Aaron Hardy aaronius...@gmail.com wrote: Hey flexers, We're having a strange problem on one of our projects. We have a textfield that is selectable. Once the textfield has focus and the caret is blinking, if we hit left on the keyboard the caret moves left across two letters instead of one. It's as if we hit the left button twice. Hitting right on the keyboard has the same affect but in the other direction. If I attach an event listener to the textfield to watch for KEY_UP events I only get one every time I hit the key yet the caret moves twice. I've tried to narrow down our project-specific code but nothing has changed. Here's another part of the picture. This behavior is only seen when running the swf on a remote server. If I'm running it off my hard drive locally (not using a local web server) I don't see the issue...regardless of whether I'm debugging or not. Is this some sort of Flash Player bug any of you have ran into before? Thanks. Aaron -- Alex Harui Flex SDK Team Adobe System, Inc. http://blogs.adobe.com/aharui
[flexcoders] TextField caret moving two letters at a time
Hey flexers, We're having a strange problem on one of our projects. We have a textfield that is selectable. Once the textfield has focus and the caret is blinking, if we hit left on the keyboard the caret moves left across two letters instead of one. It's as if we hit the left button twice. Hitting right on the keyboard has the same affect but in the other direction. If I attach an event listener to the textfield to watch for KEY_UP events I only get one every time I hit the key yet the caret moves twice. I've tried to narrow down our project-specific code but nothing has changed. Here's another part of the picture. This behavior is only seen when running the swf on a remote server. If I'm running it off my hard drive locally (not using a local web server) I don't see the issue...regardless of whether I'm debugging or not. Is this some sort of Flash Player bug any of you have ran into before? Thanks. Aaron
Re: [flexcoders] Re: Read svg file in FLEX
Yeah, spit out some code or an error or something so we can help. On Thu, Jan 21, 2010 at 11:40 PM, flexlearner flexlear...@yahoo.com wrote: I have some attributes in my svg file which I am not able to read using flex builder. Can you help me out in this regard ? Actually I have one svg file which I want to load it then parse it and get the x,y coordinates of path or rectangle which is there in svg file. --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Aaron Hardy aaronius...@... wrote: Hey flexlearner, What's your question exactly? How to parse XML? After you parse the XML (you can use e4x) you'll convert SVG attributes into actionscript graphics functions like graphics.lineTo(). Are you having trouble with something in particular? Aaron On Thu, Jan 21, 2010 at 3:30 AM, flexlearner flexlear...@... wrote: Hi, I am new to flex and am using svg file for one of my application which basically contains 2-3 rectangles and few paths. Now I want to parse this svg file in my application and get rect coordinates. Kindly let me know how to achieve this.
Re: [flexcoders] Read svg file in FLEX
Hey flexlearner, What's your question exactly? How to parse XML? After you parse the XML (you can use e4x) you'll convert SVG attributes into actionscript graphics functions like graphics.lineTo(). Are you having trouble with something in particular? Aaron On Thu, Jan 21, 2010 at 3:30 AM, flexlearner flexlear...@yahoo.com wrote: Hi, I am new to flex and am using svg file for one of my application which basically contains 2-3 rectangles and few paths. Now I want to parse this svg file in my application and get rect coordinates. Kindly let me know how to achieve this.
Re: [flexcoders] question about inheritance and events and overriding methods
I just tried it on my machine and it compiled without any problems after I took out the dependencies I didn't have access to. I never got the error you mentioned. Maybe it's referring to something else? Cut everything out of your project (maybe make a new one) except the onResult function you believe may be the cause and see if you still get the error. I suspect you won't. Good luck! Aaron On Mon, Jan 18, 2010 at 7:29 AM, Tim Romano tim_rom...@yahoo.com wrote: I am having trouble with an override, getting Method marked override must override another method. No problem at all doing this: in the BASE CLASS: protected function foo(): void{} in the SUBCLASS override protected function foo(): void{} But the error given above occurs here: in the BASE CLASS protected function onResult(e:ResultEvent, token:Object=null):void {} in the SUBCLASS override protected function onResult(e:ResultEvent, token:Object=null):void {} I don't see why it's not working. All of the requirements set out here seem to be satisfied: http://livedocs.adobe.com/flex/3/html/help.html?content=04_OO_Programming_11.html I've included the class implementations below. Is the cause of the error evident? Thanks again for the help, it's appreciated doubly because I'm stumped by this. Tim === BASE CLASS == package TESTREST { import mx.rpc.http.HTTPService; import mx.rpc.AsyncResponder; import mx.rpc.AsyncToken; import mx.rpc.events.FaultEvent; import mx.rpc.events.ResultEvent; import OEREST.events.*; import OEUTIL.BindableArrayCollection; import json.*; import OEUTIL.SearchConstants; public class MYHTTPSERVICEBASE extends HTTPService { private var _params: Object; private function get Params(): Object {return _params;} public function MYHTTPSERVICEBASE(destination: String, params:Object = null) { var _params: Object=params; var baseURL: String; if ( SearchConstants.DEBUGMODE) { baseURL = SearchConstants.DEBUG_BASEURL ; }else{ baseURL= SearchConstants.RELEASE_BASEURL ; } super(baseURL, destination); } public function execute(): void { var myResponder : AsyncResponder= new AsyncResponder(onResult, onFault); this.resultFormat= HTTPService.RESULT_FORMAT_TEXT; var token: AsyncToken; if ( this.Params == null) { this.method=GET; token = this.send(); } else { this.method=POST; token = this.send(Params); } token.addResponder(myResponder); } protected function foo(): void {} protected function onResult(e:ResultEvent, token:Object=null):void {} protected function onFault(evt:FaultEvent, token: Object=null):void {} } } == SUBCLASS package TESTREST { public class TestService extends TESTREST.MYHTTPSERVICEBASE { import mx.rpc.events.ResultEvent; protected const DEBUGMODE:Boolean = CONFIG::debug; protected const DEBUG_BASEURL:String = http://localhost/OESharpDeploy/; http://localhost/OESharpDeploy/ protected const RELEASE_BASEURL:String = ; import TESTREST.events.*; import json.JParser; public function TestService() { var dest: String =getServiceURL(); var selTitles : Array =new Array(1,2,3,4,5,6,7,8,9,10,11,12); var ss:String = JParser.encode(selTitles); var params:Object = {selectedTitles: ss}; super( dest, params); } private function getServiceURL(): String { if (DEBUGMODE) { return DEBUG_BASEURL + /SSQ.ashx ; }else{ return RELEASE_BASEURL + /SSQ.ashx ; } } override protected function foo(): void{} override protected function onResult(e:ResultEvent, token:Object=null):void {} } } On 1/17/2010 10:49 PM, Aaron Hardy wrote: I'm not sure I understand your question clearly but if I assume correctly I think the answer will be yes, there is no need for each descendant to instantiate its own responder. Aaron On Sun, Jan 17, 2010 at 6:37 PM, Tim Romano tim_rom...@yahoo.com wrote: Thank you, Aaron, for the helpful answers. My intention would be to have each of the descendants of MYHTTPSERVICEBASE point to a different destination and raise an event specific to that destination, and to have a separate listeners for each kind of event. If I've understood you correctly, there is no need for each of the descendants to instantiate their own Responder and no requirement
Re: [flexcoders] question about inheritance and events and overriding methods
I'll take a crack at it. Can the event object be dispatched from within the MYHTTPSERVICEBASE? Sure. I think there may be a separate underlying question here though. Are you asking how? Maybe you can clarify? Will the GUI hear it if it's dispatched from the base class? First of all, if the service classes you're talking about aren't on a display list (it's very likely they are NOT) then an event doesn't bubble in the traditional sense. Nothing will hear the event unless it specifically has added an event listener to your service object. So if you want any view component to hear the event being dispatched by your service object, the view component will need to add an event listener to your service object. Depending on the framework you're using, there may be some other mechanism whereby the view can hear about a command's completion. Something else you can do (though some architecture developers will cringe) is dispatch the event off the stage, the system manager, or the base application from your command and then the view would add an event listener to whichever object that is. In a class that extends MYHTTPSERVICEBASE, can I override the onResult() method that has been registered with the Responder by the base class? Yes. In the case of your sample code, if you override onResult in your class that extends MYHTTPSERVICEBASE, it is the overriding function that is passed into the responder. That is, when you reference onResult, you're referencing the most extended onResult function, not just the onResult function in the class from which onResult is referenced. I hope that makes sense. It's very likely I misinterpreted your questions. Aaron On Sun, Jan 17, 2010 at 5:30 AM, Tim Romano tim_rom...@yahoo.com wrote: Let's say I have a class MYHTTPSERVICEBASE which extends mx.rpc.http.HTTPService. This base class of mine checks whether it is being run in debug mode or release, and sets the base URL to localhost or the remote host. Then I have individual http service classes that extend MYHTTPSERVICEBASE. I want my http service layer to dispatch messages that my GUI layer will be listening for: public function execute() : void { myResponder = new AsyncResponder(onResult, onFault); this.resultFormat= HTTPService.RESULT_FORMAT_TEXT; var token: AsyncToken = this.send(); token.addResponder(myResponder); } private function onResult(e:ResultEvent, token:Object=null):void { // Got Data? then instantiate and dispatch a bubbling event object that encapsulates the data // the GUI layer will be listening for this event } Questions: Can the event object be dispatched from within the MYHTTPSERVICEBASE? Will the GUI hear it if it's dispatched from the base class? In a class that extends MYHTTPSERVICEBASE, can I override the onResult() method that has been registered with the Responder by the base class? Thanks for the help!
Re: [flexcoders] Can a canvas be scrollable without the scrollbars?
I recently posted this in response to a similar question--sorry about that, not trying to spam. But this could help you out: http://aaronhardy.com/flex/standalone-scrollbar/ If, in the example, you set the scroll policies to false on the canvas you'll see the canvas scrolling without internal scrollbars. Good luck! Aaron On Fri, Jan 15, 2010 at 1:11 PM, flexaustin flexaus...@yahoo.com wrote: Anyone know of a way to set the horizontalScrollPolicy and verticalScrollPolicy both to false so that the scrollbars don't show, but still have the canvas scroll? I have content that inside the canvas that will always be larger than the canvas so I want to be able to scroll without showing any scrollbars. This is like the little zoom panel/control in the bottom right-hand corner of Google maps. thx, j
Re: [flexcoders] question about inheritance and events and overriding methods
I'm not sure I understand your question clearly but if I assume correctly I think the answer will be yes, there is no need for each descendant to instantiate its own responder. Aaron On Sun, Jan 17, 2010 at 6:37 PM, Tim Romano tim_rom...@yahoo.com wrote: Thank you, Aaron, for the helpful answers. My intention would be to have each of the descendants of MYHTTPSERVICEBASE point to a different destination and raise an event specific to that destination, and to have a separate listeners for each kind of event. If I've understood you correctly, there is no need for each of the descendants to instantiate their own Responder and no requirement for them to override the base execute() method too. Tim /* this method is in the descendant class and overrides the base method */ private overrides function onResult(e:ResultEvent, token:Object=null):void { // raise a specific event } /* these two methods are in the base class */ publicfunction execute() : void { myResponder = new AsyncResponder(onResult, onFault); this.resultFormat= HTTPService.RESULT_FORMAT_TEXT; var token: AsyncToken = this.send(); token.addResponder(myResponder); } privatefunction onResult(e:ResultEvent, token:Object=null):void { // this method is overridden by descendants } On 1/17/2010 3:38 PM, Aaron Hardy wrote: I'll take a crack at it. Can the event object be dispatched from within the MYHTTPSERVICEBASE? Sure. I think there may be a separate underlying question here though. Are you asking how? Maybe you can clarify? Will the GUI hear it if it's dispatched from the base class? First of all, if the service classes you're talking about aren't on a display list (it's very likely they are NOT) then an event doesn't bubble in the traditional sense. Nothing will hear the event unless it specifically has added an event listener to your service object. So if you want any view component to hear the event being dispatched by your service object, the view component will need to add an event listener to your service object. Depending on the framework you're using, there may be some other mechanism whereby the view can hear about a command's completion. Something else you can do (though some architecture developers will cringe) is dispatch the event off the stage, the system manager, or the base application from your command and then the view would add an event listener to whichever object that is. In a class that extends MYHTTPSERVICEBASE, can I override the onResult() method that has been registered with the Responder by the base class? Yes. In the case of your sample code, if you override onResult in your class that extends MYHTTPSERVICEBASE, it is the overriding function that is passed into the responder. That is, when you reference onResult, you're referencing the most extended onResult function, not just the onResult function in the class from which onResult is referenced. I hope that makes sense. It's very likely I misinterpreted your questions. Aaron
Re: [flexcoders] Re: Updating renderer properties
I have no idea if it would work but why not just create a static variable inside your renderer class and change that as required? --- In flexcoders@yahoogroups.com, Aaron Hardy aaronius9er@ wrote: I think there might be a misunderstanding. If it's a transient property on the data objects that come through the data provider, I would have to change the property for all the objects in the data provider to be the same value since I want all the renderers to change in the same way. For example, let's say all my renderers say Woot: and then the data's text value. Then at runtime, the user, in a different part of the app, enters Niner into a text input and therefore I want all my renderers to now say Niner: and then the data's text value. In my case, the word Niner really has nothing to do with the data, it's almost more about the style of the renderers--or what the renderers look like around the actual data. If I were to use the transient property of the data provider objects, I'd have to loop through all of them and set the property's value to Niner. I'm not sure if that's what you were suggesting, but that seems dirtier to me than referencing a separate model from the renderers. I'm interested in understanding your analysis of this though even if we may disagree in the end. Aaron On Thu, Jan 7, 2010 at 5:13 PM, turbo_vb TimHoff@ wrote: Sure, but you don't necessarily need a model to use a VO; it can just be the strongly typed object that the dataProvider uses for its items. If you then change the transient properties of that VO, the set data method of the itemRenderer will work out of the box; and you can then adjust the renderer. You're right in feeling dirty having an itemRenderer reference a model. But reacting to changes in the data is fine. IMHO. -TH --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Aaron Hardy aaronius9er@ wrote: Yes, I suppose the line of what is or is not a style can be blurry at times. In any case, using transient properties inside a VO is what I was eluding in the first item of things I've thought of, the downside being that a model/VO of some type is needed in order to keep the renderer notified of updates to the property. In other words, I don't see a viable way of creating a foobar property inside the renderer and keeping it updated from an external source. Instead, the renderer would need access to a model that was set at instantiation through the renderer class factory. The renderer would then watch the model for changes to its foobar property. Aaron On Thu, Jan 7, 2010 at 2:58 PM, turbo_vb TimHoff@ wrote: If it's a pure style, then yes that is a viable approach. However, if it's something like changing text (characters, not styles), then you might want to use [Transient] properties in a VO and/or use states in the itemRenderer. -TH --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com flexcoders% 40yahoogroups.com, Aaron Hardy aaronius9er@ wrote: Good point. So maybe I have to categorize everything as being data (in which case it hangs out with the data object) or style (in which case it would be applied to all the renderers and can be ran through the various style mechanisms). To be clear, the changes (that aren't data-dependent) being made to the renderers in my case can even be text and other such things which may not normally be thought of as styles but in reality it seems they actually are styles and could be treated as such. Thanks. Aaron On Thu, Jan 7, 2010 at 1:23 PM, turbo_vb TimHoff@ wrote: One thought, since you're taking about a style, is to assign a styleName to the itemRenderer and update the backgroundColor style of the StyleDeclaration when the user changes the color. You may need to override the styleChanged() method the itemRenderer, to handle the update. -TH --- In flexcoders@yahoogroups.com flexcoders% 40yahoogroups.comflexcoders% 40yahoogroups.comflexcoders% 40yahoogroups.com, Aaron Hardy aaronius9er@ wrote: Hey folks. I have a renderer that needs information that is not based on the data object it's associated with. Essentially what I have is in View A of the app is a color selector. In View B, I have a tilelist with a custom renderer. All the renderers in the tile list display their data using the color that was selected in Part A. The way I see
[flexcoders] Updating renderer properties
Hey folks. I have a renderer that needs information that is not based on the data object it's associated with. Essentially what I have is in View A of the app is a color selector. In View B, I have a tilelist with a custom renderer. All the renderers in the tile list display their data using the color that was selected in Part A. The way I see it, the color selected in Part A should be kept separate from the data object that gets injected into the item renderers. The color is just to make the data pretty in some way, it's not really data itself nor is it specific to an individual data object--it applies to all renderers in the list. This leads me to somehow keep the renderers updated with a separate color property. What's your preferred way of handling this scenario? Things I've thought of so far: (1) If I have an application-wide model (like in Cairngorm) I can set a color property there and either access it using the singleton accesor from within the renderer (cringe) or pass the model into the renderer using a class factory. Since the model instance shouldn't really ever change, I can then watch the model for changes to the color property. (2) Whenever the color changes, I can grab all the renderers for the given list and set their color property (cringe). Thoughts? Aaron
Re: [flexcoders] using custom scrollbars
This should give you the information you're looking for: http://aaronhardy.com/flex/standalone-scrollbar/ Aaron On Tue, Jan 5, 2010 at 3:17 PM, Slackware selecter...@gmail.com wrote: Hi all, happy new year!! I'm using a mx:VScrollBar to manage the scroll for a Canvas (with verticalScrollPolicy=off), since I need to place the scrollbar off-setted from the Canvas. This code works as expected (the canvas scrolls based on my vertical scroll bar): MyCanvas.verticalScrollPosition = event.currentTarget.scrollPosition; //currentTarget is my VScrollBar But this way, I still need to set the verticalScrollProperties by hand. I mean, if I have a really big Canvas my scrollBar doesn't reflect the height on its thumb for example. Is there any easy way to achieve this? Many thanks.
Re: [flexcoders] Re: Updating renderer properties
Good point. So maybe I have to categorize everything as being data (in which case it hangs out with the data object) or style (in which case it would be applied to all the renderers and can be ran through the various style mechanisms). To be clear, the changes (that aren't data-dependent) being made to the renderers in my case can even be text and other such things which may not normally be thought of as styles but in reality it seems they actually are styles and could be treated as such. Thanks. Aaron On Thu, Jan 7, 2010 at 1:23 PM, turbo_vb timh...@aol.com wrote: One thought, since you're taking about a style, is to assign a styleName to the itemRenderer and update the backgroundColor style of the StyleDeclaration when the user changes the color. You may need to override the styleChanged() method the itemRenderer, to handle the update. -TH --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Aaron Hardy aaronius...@... wrote: Hey folks. I have a renderer that needs information that is not based on the data object it's associated with. Essentially what I have is in View A of the app is a color selector. In View B, I have a tilelist with a custom renderer. All the renderers in the tile list display their data using the color that was selected in Part A. The way I see it, the color selected in Part A should be kept separate from the data object that gets injected into the item renderers. The color is just to make the data pretty in some way, it's not really data itself nor is it specific to an individual data object--it applies to all renderers in the list. This leads me to somehow keep the renderers updated with a separate color property. What's your preferred way of handling this scenario? Things I've thought of so far: (1) If I have an application-wide model (like in Cairngorm) I can set a color property there and either access it using the singleton accesor from within the renderer (cringe) or pass the model into the renderer using a class factory. Since the model instance shouldn't really ever change, I can then watch the model for changes to the color property. (2) Whenever the color changes, I can grab all the renderers for the given list and set their color property (cringe). Thoughts? Aaron
Re: [flexcoders] Re: Updating renderer properties
Yes, I suppose the line of what is or is not a style can be blurry at times. In any case, using transient properties inside a VO is what I was eluding in the first item of things I've thought of, the downside being that a model/VO of some type is needed in order to keep the renderer notified of updates to the property. In other words, I don't see a viable way of creating a foobar property inside the renderer and keeping it updated from an external source. Instead, the renderer would need access to a model that was set at instantiation through the renderer class factory. The renderer would then watch the model for changes to its foobar property. Aaron On Thu, Jan 7, 2010 at 2:58 PM, turbo_vb timh...@aol.com wrote: If it's a pure style, then yes that is a viable approach. However, if it's something like changing text (characters, not styles), then you might want to use [Transient] properties in a VO and/or use states in the itemRenderer. -TH --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Aaron Hardy aaronius...@... wrote: Good point. So maybe I have to categorize everything as being data (in which case it hangs out with the data object) or style (in which case it would be applied to all the renderers and can be ran through the various style mechanisms). To be clear, the changes (that aren't data-dependent) being made to the renderers in my case can even be text and other such things which may not normally be thought of as styles but in reality it seems they actually are styles and could be treated as such. Thanks. Aaron On Thu, Jan 7, 2010 at 1:23 PM, turbo_vb timh...@... wrote: One thought, since you're taking about a style, is to assign a styleName to the itemRenderer and update the backgroundColor style of the StyleDeclaration when the user changes the color. You may need to override the styleChanged() method the itemRenderer, to handle the update. -TH --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.comflexcoders% 40yahoogroups.com, Aaron Hardy aaronius9er@ wrote: Hey folks. I have a renderer that needs information that is not based on the data object it's associated with. Essentially what I have is in View A of the app is a color selector. In View B, I have a tilelist with a custom renderer. All the renderers in the tile list display their data using the color that was selected in Part A. The way I see it, the color selected in Part A should be kept separate from the data object that gets injected into the item renderers. The color is just to make the data pretty in some way, it's not really data itself nor is it specific to an individual data object--it applies to all renderers in the list. This leads me to somehow keep the renderers updated with a separate color property. What's your preferred way of handling this scenario? Things I've thought of so far: (1) If I have an application-wide model (like in Cairngorm) I can set a color property there and either access it using the singleton accesor from within the renderer (cringe) or pass the model into the renderer using a class factory. Since the model instance shouldn't really ever change, I can then watch the model for changes to the color property. (2) Whenever the color changes, I can grab all the renderers for the given list and set their color property (cringe). Thoughts? Aaron
Re: [flexcoders] Re: Updating renderer properties
I think there might be a misunderstanding. If it's a transient property on the data objects that come through the data provider, I would have to change the property for all the objects in the data provider to be the same value since I want all the renderers to change in the same way. For example, let's say all my renderers say Woot: and then the data's text value. Then at runtime, the user, in a different part of the app, enters Niner into a text input and therefore I want all my renderers to now say Niner: and then the data's text value. In my case, the word Niner really has nothing to do with the data, it's almost more about the style of the renderers--or what the renderers look like around the actual data. If I were to use the transient property of the data provider objects, I'd have to loop through all of them and set the property's value to Niner. I'm not sure if that's what you were suggesting, but that seems dirtier to me than referencing a separate model from the renderers. I'm interested in understanding your analysis of this though even if we may disagree in the end. Aaron On Thu, Jan 7, 2010 at 5:13 PM, turbo_vb timh...@aol.com wrote: Sure, but you don't necessarily need a model to use a VO; it can just be the strongly typed object that the dataProvider uses for its items. If you then change the transient properties of that VO, the set data method of the itemRenderer will work out of the box; and you can then adjust the renderer. You're right in feeling dirty having an itemRenderer reference a model. But reacting to changes in the data is fine. IMHO. -TH --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Aaron Hardy aaronius...@... wrote: Yes, I suppose the line of what is or is not a style can be blurry at times. In any case, using transient properties inside a VO is what I was eluding in the first item of things I've thought of, the downside being that a model/VO of some type is needed in order to keep the renderer notified of updates to the property. In other words, I don't see a viable way of creating a foobar property inside the renderer and keeping it updated from an external source. Instead, the renderer would need access to a model that was set at instantiation through the renderer class factory. The renderer would then watch the model for changes to its foobar property. Aaron On Thu, Jan 7, 2010 at 2:58 PM, turbo_vb timh...@... wrote: If it's a pure style, then yes that is a viable approach. However, if it's something like changing text (characters, not styles), then you might want to use [Transient] properties in a VO and/or use states in the itemRenderer. -TH --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.comflexcoders% 40yahoogroups.com, Aaron Hardy aaronius9er@ wrote: Good point. So maybe I have to categorize everything as being data (in which case it hangs out with the data object) or style (in which case it would be applied to all the renderers and can be ran through the various style mechanisms). To be clear, the changes (that aren't data-dependent) being made to the renderers in my case can even be text and other such things which may not normally be thought of as styles but in reality it seems they actually are styles and could be treated as such. Thanks. Aaron On Thu, Jan 7, 2010 at 1:23 PM, turbo_vb TimHoff@ wrote: One thought, since you're taking about a style, is to assign a styleName to the itemRenderer and update the backgroundColor style of the StyleDeclaration when the user changes the color. You may need to override the styleChanged() method the itemRenderer, to handle the update. -TH --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.comflexcoders% 40yahoogroups.comflexcoders% 40yahoogroups.com, Aaron Hardy aaronius9er@ wrote: Hey folks. I have a renderer that needs information that is not based on the data object it's associated with. Essentially what I have is in View A of the app is a color selector. In View B, I have a tilelist with a custom renderer. All the renderers in the tile list display their data using the color that was selected in Part A. The way I see it, the color selected in Part A should be kept separate from the data object that gets injected into the item renderers. The color is just to make the data pretty in some way, it's not really data itself nor is it specific to an individual data object--it applies to all renderers in the list. This leads me to somehow keep the renderers updated with a separate color property. What's your preferred way of handling this scenario? Things I've thought of so far: (1) If I have an application-wide
Re: [flexcoders] Question about flex source
See here under asdoc tags: http://livedocs.adobe.com/flex/3/html/help.html?content=asdoc_1.html The @eventType tells the ASDoc generator that what it's seeing on that line is something special and needs to be dealt with in a special way. It shouldn't affect your application's code execution in any way. I'm not from Adobe though so my response is nothing official...it's just what I've gathered from experience. Aaron On Sun, Jan 3, 2010 at 7:55 PM, ztpi1 zt...@yahoo.com wrote: I notice that the flex source files have commented out sections like this one: ** * Dispatched after the Application has been initialized, * processed by the LayoutManager, and attached to the display list. * * @eventType mx.events.FlexEvent.APPLICATION_COMPLETE */ Is the @ symbol significant here? Does the compiler see the line with the @ symbol or is it merely for reader information? It is my understanding that the @ symbol denotes an XML attribute, is that the correct interpretation?
Re: [flexcoders] Getting the Y value for a line at a given point
Have you tried something this: 100+(15/39)*(140-100) 100 being Jan 1 balance 140 being Feb 8 balance 15 being the number of days from the first data provider date point 39 being the total number of days between the first and second data provider date points That should give you the y balance for the widget. Aaron Ryan wrote: I've got a line chart showing a dollar value over time. Think of it as the balance of a savings account. It goes up and down every month or so. What I'm trying to do is overlay little widgets on top of that line on the chart to represent events that may or may not have affected the line's value. This is actually similar to the Yahoo Finance stock chart with the event overlays. Anyway, it's easy enough to add a CartesianDataCanvas as an annotation element to my line chart and then add children to it. It has a nice little addDataChild method that allows you to specify an x axis value and a y axis value and it figures out what the corresponding x and y coordinates are and places the child there. Great so far. Say my line series data provider looks like this: {date:new Date(2009, 1, 1), balance:100} {date:new Date(2009, 2, 8), balance:140} {date:new Date(2009, 3, 5), balance:95} If I have an event for 1/1/2009, I can look up that the balance was 100 on that day and place the event widget at [1/1/2009, 100]. However, if I have an event on 1/15/2009, from looking at the data provider above, I know that the balance was still 100, but because the line is diagonally vectoring towards the next value of 140, my data point is misplaced if I put it at [1/15/2009, 100]. Is there a way to get the line's y value given an x value? or Can I change my line chart to not draw diagonal lines and instead draw square lines so I won't have this problem? Ryan -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Alternative FAQ location: https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847 Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * Your email settings: Individual Email | Traditional * To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) * To change settings via email: flexcoders-dig...@yahoogroups.com flexcoders-fullfeatu...@yahoogroups.com * To unsubscribe from this group, send an email to: flexcoders-unsubscr...@yahoogroups.com * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
[flexcoders] Dealing with images larger than Flash Player 10 limit
Hey flexers, We're working on a project currently where we would like to allow users to add photos from their local drive to the stage. We also want to support gigantic photos. I understand the max bitmap size is 4095x4095 (or dimensions that equal the same number of pixels) in flash player 10. If the user has a photo bigger than this, we'd be happy to size the image down to this limit and allow the user to work with their image at the restricted size. However, I'm stuck trying to figure out how to size down the image before creating a bitmap object. I have a bytearray of the image data but now I need the image resized down to the bitmap limit before creating a bitmap from the bytearray. Somewhat a chicken-or-the-egg problem. Does anyone have a nice tool or method to accomplish this? Anyone know how Buzzword does this? Thanks. Aaron
Re: [flexcoders] Re: Dealing with images larger than Flash Player 10 limit
Thank you very much for the response. Your code looked eerily similar to the code I was already using, but I plugged your code into a fresh project and it worked. It baffled my mind. I went back to my project and I got the same issue I was seeing before--the bitmap data would return 0 for both width and height. The flex debugger showed Error #2015: Invalid BitmapData. for both getters. I assumed it was due to the 16.7 million limit (which doesn't seem to apply to bitmaps created by loaders) because I consistently saw the issue with images over that size. On a whim I tried our project without the debugger (just a normal run) and it worked! If that isn't crazy enough, I started noticing that the longer I used Flex builder the more common the issue became--that is, images at 13,000,000 pixels even started reporting 0 width and height (and the invalid bitmap error in the variables debugger view). Thanks for taking the time to send your code and prompting me to look deeper. Aaron On Tue, Dec 15, 2009 at 11:43 AM, jamesfin james.alan.finni...@gmail.comwrote: This example refines the image down to 80x80. SmoothImage is derived from Image. I tested it against a 7000x6000 8.5mb jpg with no problems. It also scales to the smaller side if they aren't equal. main code... private var uploadReference:FileReference = new FileReference(); uploadReference.addEventListener(Event.SELECT, loadImage); uploadReference.addEventListener(Event.CANCEL, cancelImage); uploadReference.addEventListener(Event.COMPLETE, uploadCompleted); private function loadPicture(evt:MouseEvent):void{ var imageArray:Array = new Array(); imageArray.push(new FileFilter(My Image, .png;*.jpg;*.jpeg;*.gif)); uploadReference.browse(imageArray); } private function loadImage(evt:Event):void{ uploadReference.load(); } private function uploadCompleted(e:Event):void{ if(FileReference(e.target).data.length == 0){ return; } var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onImageLoad); loader.loadBytes(FileReference(e.target).data); } private function onImageLoad(e:Event):void { var imageBitmapData:BitmapData = Bitmap(e.target.content).bitmapData; var loader:Loader = Loader(e.target.loader); var smoother:SmoothImage = new SmoothImage(); smoother.load(new Bitmap(imageBitmapData, auto, true)); smoother.content.width = 80; smoother.content.height = 80; smoother.width = 80; smoother.height = 80; if(imageBitmapData.width 80 || imageBitmapData.height 80){ var imageSmoothed:SmoothImage = new SmoothImage(); imageSmoothed.maintainAspectRatio = true; imageSmoothed.load(new Bitmap(imageBitmapData, auto, true)); var maxSize:Number = Math.max(imageBitmapData.width, imageBitmapData.height); if(maxSize == imageBitmapData.width){ var widthScale:Number = 80 / imageBitmapData.width; var newWidth:Number = imageBitmapData.width * widthScale; var newHeight:Number = imageBitmapData.height * widthScale; imageSmoothed.content.width = newWidth; imageSmoothed.content.height = newHeight; imageSmoothed.width = newWidth; imageSmoothed.height = newHeight; var finalBitmap:BitmapData = new BitmapData(newWidth, newHeight); finalBitmap.draw(imageSmoothed); imageBitmapData = null; imageBitmapData = finalBitmap; }else{ var heightScale:Number = 80 / imageBitmapData.height; var newWidth2:Number = imageBitmapData.width * heightScale; var newHeight2:Number = imageBitmapData.height * heightScale; imageSmoothed.content.width = newWidth2; imageSmoothed.content.height = newHeight2; imageSmoothed.width = newWidth2; imageSmoothed.height = newHeight2; var finalBitmap2:BitmapData = new BitmapData(newWidth2, newHeight2); finalBitmap2.draw(imageSmoothed); imageBitmapData = null; imageBitmapData = finalBitmap2; } } // some image... imageToDisplay.source = new Bitmap(imageBitmapData); } --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Aaron Hardy aaronius...@... wrote: Hey flexers, We're working on a project currently where we would like to allow users to add photos from their local drive to the stage. We also want to support gigantic photos. I understand the max bitmap size is 4095x4095 (or dimensions that equal the same number of pixels) in flash player 10. If the user has a photo bigger than this, we'd be happy to size the image down to this limit and allow the user to work with their image at the restricted size. However, I'm stuck trying to figure out how to size down the image before creating a bitmap object. I have a bytearray of the image data but now I need the image resized down to the bitmap limit before creating a bitmap from the bytearray. Somewhat a chicken-or-the-egg problem. Does anyone have a nice tool or method to accomplish this? Anyone know how Buzzword does this? Thanks. Aaron
[flexcoders] Kerning tables in TextField
Hey flexers, I'm using a font that has a kerning table with a TextField object to display text. However, it appears the kerning table is never being used. Here's the code: var textField:TextField = new TextField(); textField.embedFonts = true; textField.text = 'New Text'; var tf:TextFormat = new TextFormat(); tf.font = 'MyFont'; tf.size = 24; tf.kerning = true; textField.setTextFormat(tf); textField.width = 2000; textField.height = 100; uic.addChild(textField); Am I doing something wrong? I figured kerning=true would force the text field to abide by the font's kerning table. If I use the same font with the new Flash text rendering engine it seems to respect the kerning tables as expected, but at this point we can't switch to the new rendering engine. Any ideas? Aaron
[flexcoders] Garbage collection crashing flash player
Hey flexers, My team has been building an application that's graphically heavy. The heaviest portion consists of two sprites that are ~4000x4000 pixels and have a bunch of sprite children and ~20 bitmaps each. The content ends up being ~30 MB for both sprites total, give or take 20 MB. When it's time to switch to new sprites with new content we make sure there are no more references to the two old sprites. I've verified that garbage collection does clean up the old content each time and memory stays about even. However, quite commonly (maybe 1 out of 3 times) when switching to two new sprites the Flash Player will crash. I have good reason to believe it's the act of garbage collection that is causing this crash. Here's why: (1) If I'm in the Flex Profiler and I've switched to two new sprites and then I hit run garbage collection it will sometimes crash right at that moment. (2) If I use Grant Skinner's posted hack of forcing garbage collection it will sometimes crash right when the garbage collection is forced. (3) If I keep a reference to all the old sprites (so garbage collection won't collect them) it doesn't crash even after switching to new sprites over 25 times, however the application uses more and more memory. Can someone provide some enlightenment as to how we proceed? We don't want the application crashing frequently but we also don't want to hog the user's memory (and eventually cause a crash anyway). Making the sprites smaller is an obvious route but one of the last routes we want to take because they're that large for a reason. Thanks. We appreciate any help offered! Aaron
Re: [flexcoders] Delaying a function's execution
Thanks Alex for answering my question and all my previous questions you've answered and I've forgot to thank you for. Aaron On 10/29/09, Alex Harui aha...@adobe.com wrote: callLater is used to defer the function call to as soon as possible. That's why it hooks both enterFrame and render. Timers are used to wait, especially when we know we don't need to run that function right away. Alex Harui Flex SDK Developer Adobe Systems Inc.http://www.adobe.com/ Blog: http://blogs.adobe.com/aharui From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Aaron Hardy Sent: Thursday, October 29, 2009 7:47 PM To: flexcoders Subject: [flexcoders] Delaying a function's execution Hey flexers, I've been researching the various ways that one can delay a function's execution. A few ways I've found/used are: (1) Use a Timer object with 0 delay as is done in StyleManagerImpl.loadStyleDeclarations2(). (2) Use setTimeout() (supposedly deprecated?) (3) Use callLater if you're in a UIComponent. (does it actually wait a frame or just till rendering beings?) (4) If you're not in a UIComponent, use the same logic that's found in UIComponent's callLater. It appears to add an event listener to the stage (using SystemManager to access the stage) for Event.RENDER and Event.ENTER_FRAME then invalidates the stage. First, is callLater meant to wait until the next frame or just until the render segment of the elastic racetrack? Second, which would you recommend and why? Third, why does the Flex framework use varying methods of waiting a frame (see #1 and #4)? The answer to my first question might answer this one. Fourth, why does callLater watch for both Event.RENDER and Event.ENTER_FRAME event types and not just one or the other? Thanks for answering my questions. I appreciate it. Aaron
[flexcoders] Delaying a function's execution
Hey flexers, I've been researching the various ways that one can delay a function's execution. A few ways I've found/used are: (1) Use a Timer object with 0 delay as is done in StyleManagerImpl.loadStyleDeclarations2(). (2) Use setTimeout() (supposedly deprecated?) (3) Use callLater if you're in a UIComponent. (does it actually wait a frame or just till rendering beings?) (4) If you're not in a UIComponent, use the same logic that's found in UIComponent's callLater. It appears to add an event listener to the stage (using SystemManager to access the stage) for Event.RENDER and Event.ENTER_FRAME then invalidates the stage. First, is callLater meant to wait until the next frame or just until the render segment of the elastic racetrack? Second, which would you recommend and why? Third, why does the Flex framework use varying methods of waiting a frame (see #1 and #4)? The answer to my first question might answer this one. Fourth, why does callLater watch for both Event.RENDER and Event.ENTER_FRAME event types and not just one or the other? Thanks for answering my questions. I appreciate it. Aaron
[flexcoders] Detecting loader.close()
Hey all, I have a Loader instance, I call the load() method, and then sometime thereafter but before the loading is complete I call the close() method. Is there any sort of event I can watch that will tell me the loader has been closed? As a very simple test, I tried the following but it never gets to the stop() method for any of the events. In my real app I have a reference to the loader/loaderInfo in a different part of the app and need to know when the loader is closed. ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute creationComplete=go(); mx:Script ![CDATA[ import flash.utils.setTimeout; protected var loader:Loader; protected function go():void { loader = new Loader(); loader.load(new URLRequest(' http://aaronhardy.com/wp-content/themes/thefunk/images/Mast.gif')); myUI.addChild(loader); loader.addEventListener(Event.DEACTIVATE, stop); loader.addEventListener(Event.CLOSE, stop); loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, stop); loader.contentLoaderInfo.addEventListener(HTTPStatusEvent.HTTP_STATUS, stop); loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, stop); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, stop); loader.contentLoaderInfo.addEventListener(Event.DEACTIVATE, stop); loader.contentLoaderInfo.addEventListener(Event.UNLOAD, stop); loader.close(); } protected function stop(event:Event):void { trace(event); } ]] /mx:Script mx:UIComponent id=myUI/ /mx:Application Thanks for any help! Aaron
Re: [flexcoders] Flex Library and and MXML component
Right-click project -- Properties -- Flex Library Build Path -- Select All -- OK. Make sure it rebuilds and you should be good to go. Aaron Mike Oliver wrote: I have an MXML Component Canvas that I want to put into a Flex Library SWC. I created a Flex Library Project with /src and /bin I added the /images folder with the image in it that the Component Canvas uses to /src. I added the mxml source file for the Component to the /src The /bin gets the MyLibProject.swc but the mxml component isn't inside. I am sure I am missing a step but can't find what it is. I want to use this swc in several projects as a component on other screens. -- View this message in context: http://www.nabble.com/Flex-Library-and-and-MXML-component-tp24233741p24233741.html http://www.nabble.com/Flex-Library-and-and-MXML-component-tp24233741p24233741.html Sent from the FlexCoders mailing list archive at Nabble.com.
Re: [flexcoders] matrix help
It seems like you should just be able to do this: var scaleFactor:Number = .1; image1.scaleX *= (1 + scaleFactor); image1.scaleY *= (1 + scaleFactor); image2.scaleX *= (1 - scaleFactor); image2.scaleY *= (1 - scaleFactor); That should affect your matrices as necessary. If you're scale factor is like 1.1, 1.2, etc. as you describe, you should be able to do this instead: image1.scaleX *= scaleFactor; image1.scaleY *= scaleFactor; image2.scaleX *= (1 - (scaleFactor - 1)); image2.scaleY *= (1 - (scaleFactor - 1)); I didn't actually try it out, but it seems like it should work. Let me know. Aaron grimmwerks wrote: Argh. Still can't get it - like if I have something coming in from 1 to 4 (ie 1.1, 1.2, 1.3 etc) - I can make the one image scale UP fine but can't figure out how the other image scales down the same percentage... On Jun 18, 2009, at 3:38 PM, grimmwerks wrote: Ok I must be having a brain fart here. Imagine two opposing rectangles; as one scales UP the other scales DOWN - ie as one scales up 10% the other scales DOWN 10%. How's the best way of doing that using matrices? I seriously must be missing something simple... -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Alternative FAQ location: https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847 https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847 Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo ! Groups Links
Re: [flexcoders] You can now download peerApp
Nevermind...got this link. Thanks. otunazero wrote: I have posted a link to the peerApp stratus based app. If you wanna test or track progress on the development go to http://otunazero.wordpress.com http://otunazero.wordpress.com . I would appreciate some feedback from members of this group
Re: [flexcoders] argh: matrices and dragging
I guess you figured it out? Your demo works for me. Aaron grimmwerks wrote: Argh -- still struggling. What am I missing? On Jun 19, 2009, at 5:03 PM, grimmwerks wrote: But I need that to get the current state of the large transform matrix. What I'm having problems with is this idea that the smaller area maps to the larger area; in Director there was an actual map() function that doesn't seem to be in flash. It'd be great if the adobe guys could weigh in on this; ie I can't be the only person having trouble with Matrices / Transforms otherwise I'd be getting a lot more responses. I'll try it as you say Thomas; thanks for responding. On Jun 19, 2009, at 4:28 PM, thomas parquier wrote: I think you should move var bigM:Matrix = big.transform.matrix.clone(); out of your box move handler, because box.x and box.y are positive even when moving to left or top. thomas --- http://www.web-attitude.fr/ http://www.web-attitude.fr/ msn : thomas.parqu...@web-attitude.fr mailto:thomas.parqu...@web-attitude.fr softphone : sip:webattit...@ekiga.net mailto:sip%3awebattit...@ekiga.net téléphone portable : +33601 822 056 2009/6/19 grimmwerks gr...@grimmwerks.com mailto:gr...@grimmwerks.com I've got a little app that is the same old small viewer / large image type thing we all know and love. I've got a slider that sets the scale - ie when the user zooms up, the large image zooms up and the 'box' canvas does the invert so that it shows what view the user is seeing -- dig? Now I'm trying to allow the user to move the small box around and see that same view with the large image; I've tried the following which ALMOST works --when the user moves the box to the right (ie x++ and y++) the large image goes to the left; but when the user moves it BACK the large image doesn't move back to the right. private function boxMouseDrag(e:MouseEvent):void{ borderBox.transform = box.transform; var bigM:Matrix = big.transform.matrix.clone(); var boxM:Matrix = new Matrix(); boxM.translate(box.x, box.y); boxM.invert(); bigM.concat(boxM); big.transform.matrix = bigM; //big.transform.matrix.translate(box.x, box.y); out.text = dragging + box.transform.matrix; } You can see an example here: http://grimmwerks.com/examples/matrix/ http://grimmwerks.com/examples/matrix/ **next up how to make the small view box locked to the viewer area in the startDrag...
Re: [flexcoders] argh: matrices and dragging
I'm referring to this statement: --- Now I'm trying to allow the user to move the small box around and see that same view with the large image; I've tried the following which ALMOST works --when the user moves the box to the right (ie x++ and y++) the large image goes to the left; but when the user moves it BACK the large image doesn't move back to the right. --- When I move the border box left and right, the large image is moving in the opposite direction. That part seems to be working. The part that doesn't seem to be working is when moving the border box, the large box should be moving more than it actually is. From looking at your code, I think you're trying to take scale into account but just doing it incorrectly. I'm not a matrix pro (few people are, which is probably the reason you're getting few responses) and I haven't tested what I'm about to say, but here's my shot at it from my experience: An object's tx and ty are unaffected by the object's scale. In other words, if you translate an image that's a normal scale by 10 on both the x and y axis, it's the same as if you translate and image that's at 2x scale by 10 on both the x and y axis. They're both still going to end up at 10, 10 in their parent. So I think there are a couple ways to do what you're trying to do. For starters I think you could get the x-change of your border box, multiply it by the large image's scaleX, then use that number to translate the large image. Do the same kind of thing with Y. Does that make sense? Aaron grimmwerks wrote: It can't possibly -- ie what you're seeing under the small viewer when scaled down doesn't match the large view at all. On Jun 20, 2009, at 11:21 AM, Aaron Hardy wrote: I guess you figured it out? Your demo works for me. Aaron grimmwerks wrote: Argh -- still struggling. What am I missing? On Jun 19, 2009, at 5:03 PM, grimmwerks wrote: But I need that to get the current state of the large transform matrix. What I'm having problems with is this idea that the smaller area maps to the larger area; in Director there was an actual map() function that doesn't seem to be in flash. It'd be great if the adobe guys could weigh in on this; ie I can't be the only person having trouble with Matrices / Transforms otherwise I'd be getting a lot more responses. I'll try it as you say Thomas; thanks for responding. On Jun 19, 2009, at 4:28 PM, thomas parquier wrote: I think you should move var bigM:Matrix = big.transform.matrix.clone(); out of your box move handler, because box.x and box.y are positive even when moving to left or top. thomas --- http://www.web-attitude.fr/ http://www.web-attitude.fr/ http://www.web-attitude.fr/ http://www.web-attitude.fr/ msn : thomas.parqu...@web-attitude.fr mailto:thomas.parquier%40web-attitude.fr mailto:thomas.parqu...@web-attitude.fr mailto:thomas.parquier%40web-attitude.fr softphone : sip:webattit...@ekiga.net mailto:webattitude%40ekiga.net mailto:sip%3awebattit...@ekiga.net mailto:sip%253Awebattitude%40ekiga.net téléphone portable : +33601 822 056 2009/6/19 grimmwerks gr...@grimmwerks.com mailto:grimm%40grimmwerks.com mailto:gr...@grimmwerks.com mailto:grimm%40grimmwerks.com I've got a little app that is the same old small viewer / large image type thing we all know and love. I've got a slider that sets the scale - ie when the user zooms up, the large image zooms up and the 'box' canvas does the invert so that it shows what view the user is seeing -- dig? Now I'm trying to allow the user to move the small box around and see that same view with the large image; I've tried the following which ALMOST works --when the user moves the box to the right (ie x++ and y++) the large image goes to the left; but when the user moves it BACK the large image doesn't move back to the right. private function boxMouseDrag(e:MouseEvent):void{ borderBox.transform = box.transform; var bigM:Matrix = big.transform.matrix.clone(); var boxM:Matrix = new Matrix(); boxM.translate(box.x, box.y); boxM.invert(); bigM.concat(boxM); big.transform.matrix = bigM; //big.transform.matrix.translate(box.x, box.y); out.text = dragging + box.transform.matrix; } You can see an example here: http://grimmwerks.com/examples/matrix/ http://grimmwerks.com/examples/matrix/ http://grimmwerks.com/examples/matrix/ http://grimmwerks.com/examples/matrix/ **next up how to make the small view box locked to the viewer area in the startDrag... -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Alternative FAQ location: https://share.acrobat.com/adc/document.do?docid=942dbdc8
Re: [flexcoders] Tooltip anchoring in Flex
I think I understand what you're asking, but I might miss. Have you tried making your lnotification component and then just popping it up using PopUpManager? As far as I'm aware, anything that's popped up with PopUpManager shouldn't move when the user scrolls, resizes the browser, etc. You can pull some ideas from my callout component if that would help: http://aaronhardy.com/flex/advanced-callout-component/ If you're talking about anchoring your trigger button (the button that pops up the tooltip), then that's different. Make sure your main application is set to absolute layout, then set your button's bottom property like so: bottom=0. Here's an example: mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute mx:Button bottom=0 label=show popup/ /mx:Application That will always keep it at the bottom of your application. Aaron creativepragmatic wrote: Hello Everyone, I want to create a notification icon like the the red one in the bottom right-hand corner of Facebook. I tried using a ToolTipManager to create a tooltip but since Tooltips appear in their own layer in Flex and, as far as I am able to figure, cannot be anchored to any part of the page. When the user uses the browser's scrollbar, they move. Thank you in advance for any assistance, Orville
[flexcoders] File Transfer with AFCS
Hey guys. I hope you don't mind me asking an AFCS question. Traffic is pretty low in the AFCS web forum (which I already posted to) so I'm hoping one of you can help me out. I'm strategizing on a new app. It seems like a client can use a FilePublisher to upload a file to the AFCS server, then, after the file is uploaded, a different client can use a FileSubscriber to download the file. What I'd like to do is make that somewhat simultaneous, in other words, rather than having my app act like an FTP client, make it act like a P2P client (so one client uploads while another client downloads). I realize I can do this in true P2P fashion with RTMFP and the Stratus service, but it's based of UDP which I believe means I lose file integrity. How would I go about doing this while maintaining file integrity? Have I misunderstood anything? Thanks. Aaron
Re: [flexcoders] Compile error
It means it can't find the source for the class with the name classname. It's likely that either you didn't import the class or the class isn't in your project. Aaron markgoldin_2000 wrote: What does that error mean? could not find source for class classname Thanks
Re: [flexcoders] Re: Tracking a sprite's position
Tim, I would need to test it out, but off the top of my head I don't think binding would do the job. Let's say Sprite A was scaled up. Even though Sprite C's coordinates in relation to UIComponent B have changed, its actual coordinates in relation to Sprite B (its parent) have not changed, therefore I don't think any bindings would trigger. Alex, that would work. I won't be able to just watch the event coming from Sprite C since it may actually be one of its parents that changes its scale or position, but if I take a broader approach of where I watch for bubbling events I think it would do the trick. Its unfortunate I can't do it just with regular sprites but I guess that's why they're lightweight. Thanks guys. I don't want to use much more of your time. I really appreciate your input and you've given me some good fuel to work with. Aaron On Thu, May 7, 2009 at 11:40 PM, Tim Hoff timh...@aol.com wrote: This all sounds like overkill; since you are really only interested in UIComponentB knowing the position of SpriteC. If you make SpriteC public, is it possible to bind the x/y values for UIComponentB to uiComponentA.spriteC.x and y (localToContent)? -TH --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Alex Harui aha...@... wrote: If you can use a subclass of Sprite that dispatches the events you need, that will be the least expensive solution in terms of CPU usage. If you can't use a subclass or you won't have so many Sprites that polling will matter, polling will probably be sufficient. Alex Harui Flex SDK Developer Adobe Systems Inc.http://www.adobe.com/ Blog: http://blogs.adobe.com/aharui From: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com [mailto: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com] On Behalf Of Tim Hoff Sent: Thursday, May 07, 2009 9:32 PM To: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com Subject: [flexcoders] Re: Tracking a sprite's position My thought was that since all of the Sprites of UIComponentA were children, they would invalidate the display list of UIComponentA whenever they were changed. I forget that Sprites are their own beast. If you can't find a way to listen for changes to all of the Sprite's position/size, and trigger action on the common canvas, enterframe starts to sound more and more appealing. I'm still wondering though, what you plan to do onEnterFrame, in order to re-position UIComponentB. For a parent or sibling to know about a component's state (or it's children), events and public vars/methods are usually employed. I'm interested to hear what you end up doing for this edge-case. Challenging for me, I can say. -TH --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.commailto: flexcoders%40yahoogroups.com flexcoders%2540yahoogroups.com, Aaron Hardy aaronius9er@ wrote: What would be invalidating UIComponent A's display list? It's my understanding that if Sprite B were to be scaled (which is likely--it is a graphic editing app afterall) but not Sprite A, the display list of UIComponent A would never be invalidated, so updateDisplayList wouldn't be called in that case. The same is true if Sprite C were scaled or moved but not any members of its parent chain. Yet UIComponent B still needs to stay stuck to Sprite C. Again, I definitely could be wrong. I guess the simple answer would be to make any tool or button or anything that scales or moves anything inside UIComponent A trigger UIComponent B to update its location, but I can already think of quite a fiew places that would have to happen and it seems like future developers would intrinsically have to know that if they make a new tool that modifies the position/scale of any of the elements that they need to trigger UIComponent B to update its position. Ugh. That's what I'm trying to avoid. Keep 'em coming if you've got 'em. It's not a dire situation so I'll save my dire need credits for later if needed. :) Aaron Tim Hoff wrote: Actually, in thinking about it a bit more, why not dispatch a custom event in the updateDisplayList function of UIComponentA; that contains the coordinates of SpriteC. This will happen a lot less frequently than listening for the enterFrame event. -TH --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.commailto: flexcoders%40yahoogroups.com flexcoders%2540yahoogroups.com mailto:flexcoders%40yahoogroups.comflexcoders%2540yahoogroups.com, Tim Hoff TimHoff@ wrote: Batting .000 so far. The only other thing that I can think of, is to move UIComponentB into UIComponnentA, same level as SpriteC, and bind the position of UIComponentB to the x and y (plus any offset) of SpriteC. Sorry that I couldn't have offered more useful help. It sounds like you have an interesting use
Re: [flexcoders] Re: Tracking a sprite's position
Maybe I'm missing something really fundamental then; I didn't think Sprites dispatched move and size events and the documentation doesn't show any such events either. I'll do some more research later, but please correct me if you know something I don't. Thanks for the response. Aaron Tim Hoff wrote: Using enterFrame is pretty expensive. I'd probably listen for SpriteC's move and resize events in the common canvas and position UIComponentB; based on the event.currentTarget.x and y coordinates. The events will have to be bubbled up from SpriteC to UIComponentA to the common canvas. Use localToGlobal to find the desired coordinates to position UIComponentB. You might experience a little lag; so the two may not look like they are connected though. -TH --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com, Aaron Hardy aaronius...@... wrote: Hey flexers, I have Sprite C which is inside of Sprite B which is inside of Sprite A which is inside of UIComponent A. UIComponent A and UIComponent B are both children of a common Canvas. I need UIComponentB to always be positioned over the top-left of Sprite C (so it appears to be stuck to Sprite C). ALWAYS. So if Sprite C is scaled or moved, if Sprite B is scaled or moved, if Sprite A is scaled or moved, if UIComponent A is scaled or moved or ANYTHING happens that would affect Sprite C's position, I need UIComponent B to always follow its position. Is there a good way to do this? My first thought is to poll SpriteC's coordinates on every enterFrame event, but it seems like it might be overkill. Thoughts? Thanks! Aaron
Re: [flexcoders] Re: Tracking a sprite's position
Unfortunately that isn't a great option in our case. The sprite in question is part of a graphical editor where dozens and dozens of sprites may be on the stage and they only provide a simple graphical representation so converting them to uicomponents would probably be more overkill than watching the sprite's position on each enter_frame. If you come up with any other ideas, please let me know. Aaron Tim Hoff wrote: No, you're right. My suggestion was more theoretical more than anything else. You may need to change the Sprites to UIComponents; to get those events. -TH --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com, Aaron Hardy aaronius...@... wrote: Maybe I'm missing something really fundamental then; I didn't think Sprites dispatched move and size events and the documentation doesn't show any such events either. I'll do some more research later, but please correct me if you know something I don't. Thanks for the response. Aaron Tim Hoff wrote: Using enterFrame is pretty expensive. I'd probably listen for SpriteC's move and resize events in the common canvas and position UIComponentB; based on the event.currentTarget.x and y coordinates. The events will have to be bubbled up from SpriteC to UIComponentA to the common canvas. Use localToGlobal to find the desired coordinates to position UIComponentB. You might experience a little lag; so the two may not look like they are connected though. -TH --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com, Aaron Hardy aaronius9er@ wrote: Hey flexers, I have Sprite C which is inside of Sprite B which is inside of Sprite A which is inside of UIComponent A. UIComponent A and UIComponent B are both children of a common Canvas. I need UIComponentB to always be positioned over the top-left of Sprite C (so it appears to be stuck to Sprite C). ALWAYS. So if Sprite C is scaled or moved, if Sprite B is scaled or moved, if Sprite A is scaled or moved, if UIComponent A is scaled or moved or ANYTHING happens that would affect Sprite C's position, I need UIComponent B to always follow its position. Is there a good way to do this? My first thought is to poll SpriteC's coordinates on every enterFrame event, but it seems like it might be overkill. Thoughts? Thanks! Aaron
Re: [flexcoders] Re: Tracking a sprite's position
What would be invalidating UIComponent A's display list? It's my understanding that if Sprite B were to be scaled (which is likely--it is a graphic editing app afterall) but not Sprite A, the display list of UIComponent A would never be invalidated, so updateDisplayList wouldn't be called in that case. The same is true if Sprite C were scaled or moved but not any members of its parent chain. Yet UIComponent B still needs to stay stuck to Sprite C. Again, I definitely could be wrong. I guess the simple answer would be to make any tool or button or anything that scales or moves anything inside UIComponent A trigger UIComponent B to update its location, but I can already think of quite a fiew places that would have to happen and it seems like future developers would intrinsically have to know that if they make a new tool that modifies the position/scale of any of the elements that they need to trigger UIComponent B to update its position. Ugh. That's what I'm trying to avoid. Keep 'em coming if you've got 'em. It's not a dire situation so I'll save my dire need credits for later if needed. :) Aaron Tim Hoff wrote: Actually, in thinking about it a bit more, why not dispatch a custom event in the updateDisplayList function of UIComponentA; that contains the coordinates of SpriteC. This will happen a lot less frequently than listening for the enterFrame event. -TH --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com, Tim Hoff timh...@... wrote: Batting .000 so far. The only other thing that I can think of, is to move UIComponentB into UIComponnentA, same level as SpriteC, and bind the position of UIComponentB to the x and y (plus any offset) of SpriteC. Sorry that I couldn't have offered more useful help. It sounds like you have an interesting use-case. Good luck Aaron. -TH --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com, Aaron Hardy aaronius9er@ wrote: Unfortunately that isn't a great option in our case. The sprite in question is part of a graphical editor where dozens and dozens of sprites may be on the stage and they only provide a simple graphical representation so converting them to uicomponents would probably be more overkill than watching the sprite's position on each enter_frame. If you come up with any other ideas, please let me know. Aaron Tim Hoff wrote: No, you're right. My suggestion was more theoretical more than anything else. You may need to change the Sprites to UIComponents; to get those events. -TH --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com, Aaron Hardy aaronius9er@ wrote: Maybe I'm missing something really fundamental then; I didn't think Sprites dispatched move and size events and the documentation doesn't show any such events either. I'll do some more research later, but please correct me if you know something I don't. Thanks for the response. Aaron Tim Hoff wrote: Using enterFrame is pretty expensive. I'd probably listen for SpriteC's move and resize events in the common canvas and position UIComponentB; based on the event.currentTarget.x and y coordinates. The events will have to be bubbled up from SpriteC to UIComponentA to the common canvas. Use localToGlobal to find the desired coordinates to position UIComponentB. You might experience a little lag; so the two may not look like they are connected though. -TH --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com, Aaron Hardy aaronius9er@ wrote: Hey flexers, I have Sprite C which is inside of Sprite B which is inside of Sprite A which is inside of UIComponent A. UIComponent A and UIComponent B are both children of a common Canvas. I need UIComponentB to always be positioned over the top-left of Sprite C (so it appears to be stuck to Sprite C). ALWAYS. So if Sprite C is scaled or moved, if Sprite B is scaled or moved, if Sprite A is scaled or moved, if UIComponent A is scaled or moved or ANYTHING happens that would affect Sprite C's position, I need UIComponent B to always follow its position. Is there a good way to do this? My first thought is to poll SpriteC's coordinates on every enterFrame event, but it seems like it might be overkill. Thoughts? Thanks! Aaron
[flexcoders] Tracking a sprite's position
Hey flexers, I have Sprite C which is inside of Sprite B which is inside of Sprite A which is inside of UIComponent A. UIComponent A and UIComponent B are both children of a common Canvas. I need UIComponentB to always be positioned over the top-left of Sprite C (so it appears to be stuck to Sprite C). ALWAYS. So if Sprite C is scaled or moved, if Sprite B is scaled or moved, if Sprite A is scaled or moved, if UIComponent A is scaled or moved or ANYTHING happens that would affect Sprite C's position, I need UIComponent B to always follow its position. Is there a good way to do this? My first thought is to poll SpriteC's coordinates on every enterFrame event, but it seems like it might be overkill. Thoughts? Thanks! Aaron
Re: [flexcoders] How to rotate text while keeping one eng fixed
Try embedding your font. Aaron shubhra wrote: Hi All, I am trying it using mx:rotate but the text dissapears even on 1 degree rotation..and when it had rotated to 360 degree it again appear.. I am newbie to FLEx please do suggest me something.
Re: [flexcoders] Re: Lightweight framework
Hey, lay off your punches. I'm talking about the amount of time/code it takes to implement, not the number of classes inside the library. P.S. I'm not sure where you're getting 24 classes for Nimbus anyway. I'm counting 12 (the four files in the utils directory aren't classes.) Get back to me when you get your scales fixed. Aaron On Mon, Apr 20, 2009 at 8:36 AM, Cliff Hall cl...@futurescale.com wrote: PS, PureMVC is only 21 classes because there are 11 interfaces, corresponding to their implementations. There are only 11 actual classes in PureMVC. Get back to me when you get your scales fixed :) -=Cliff --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Cliff Hall cl...@... wrote: Humorous that you say PureMVC ( 21 classes )is on the heavy side, instead suggesting Nimbus ( 24 classes ) as an alternative. -=Cliff --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Aaron Hardy aaronius9er@ wrote: I'd consider those still being on the heavy side. One we use is called Nimbus and can be found here: http://code.google.com/p/nimbus-as3/ Don't use the available swc since it hasn't been updated in a while. Nimbus is similar to Cairngorm but lighter and cuts out a lot of the plumbing. It also adds undo/redo history and handling of complex macro commands. For example, a parallel command runs a bunch of commands in parallel and a sequence command runs a bunch of commands in sequence. You can also have a parallel command inside of a sequence command inside of a sequence command, for example. The ASDoc inside the code is pretty thorough but there isn't additional documentation yet since the codebase has just reached a fairly stable state. I'm not saying it's for everyone, but you might want to give it a shot. Aaron Jeffry Houser wrote: Flex is a UI framework; I'd hardly consider it the answer to every one of your programming needs. I suspect that the original poster was looking for MVC alternatives. PureMVC ( http://puremvc.org/ ) and Mate ( http://mate.asfusion.com/ ) seem to be the most popular alternatives in terms of MVC frameworks for Flex. EasyMVC ( http://projects.simb.net/easyMVC ) is another one I've heard of. dnk wrote: On 18-Apr-09, at 10:07 PM, zuurl8 wrote: Flex is a lightweight framework. Do you need more then what Flex provides in interface, events, and modules? Well I think that I am talking about things more like code structure, methods of doing things, etc. There are obviously benefits from these other frameworks, otherwise people would not have written them. I do understand where you are coming from, but in my case, I am looking for something a little more than the Flex framework itself. d -- Jeffry Houser, Technical Entrepreneur Adobe Community Expert: http://tinyurl.com/684b5h http://www.twitter.com/reboog711 | Phone: 203-379-0773 -- Easy to use Interface Components for Flex Developers http://www.flextras.com?c=104 -- http://www.theflexshow.com http://www.jeffryhouser.com -- Part of the DotComIt Brain Trust
Re: [flexcoders] Re: Lightweight framework
I'd consider those still being on the heavy side. One we use is called Nimbus and can be found here: http://code.google.com/p/nimbus-as3/ Don't use the available swc since it hasn't been updated in a while. Nimbus is similar to Cairngorm but lighter and cuts out a lot of the plumbing. It also adds undo/redo history and handling of complex macro commands. For example, a parallel command runs a bunch of commands in parallel and a sequence command runs a bunch of commands in sequence. You can also have a parallel command inside of a sequence command inside of a sequence command, for example. The ASDoc inside the code is pretty thorough but there isn't additional documentation yet since the codebase has just reached a fairly stable state. I'm not saying it's for everyone, but you might want to give it a shot. Aaron Jeffry Houser wrote: Flex is a UI framework; I'd hardly consider it the answer to every one of your programming needs. I suspect that the original poster was looking for MVC alternatives. PureMVC ( http://puremvc.org/ ) and Mate ( http://mate.asfusion.com/ ) seem to be the most popular alternatives in terms of MVC frameworks for Flex. EasyMVC ( http://projects.simb.net/easyMVC ) is another one I've heard of. dnk wrote: On 18-Apr-09, at 10:07 PM, zuurl8 wrote: Flex is a lightweight framework. Do you need more then what Flex provides in interface, events, and modules? Well I think that I am talking about things more like code structure, methods of doing things, etc. There are obviously benefits from these other frameworks, otherwise people would not have written them. I do understand where you are coming from, but in my case, I am looking for something a little more than the Flex framework itself. d -- Jeffry Houser, Technical Entrepreneur Adobe Community Expert: http://tinyurl.com/684b5h http://www.twitter.com/reboog711 | Phone: 203-379-0773 -- Easy to use Interface Components for Flex Developers http://www.flextras.com?c=104 -- http://www.theflexshow.com http://www.jeffryhouser.com -- Part of the DotComIt Brain Trust
Re: [flexcoders] Re: Lightweight framework
You can download the source a build a new swc. By the way, I got your email to my personal address. Unfortunately there currently aren't any public project samples using Nimbus. They'll come as time and priority permit. Good luck! Aaron Dnk wrote: Which swc to use then ? If one was to try it out. On 19-Apr-09, at 9:11 AM, Aaron Hardy aaronius...@gmail.com mailto:aaronius...@gmail.com wrote: I'd consider those still being on the heavy side. One we use is called Nimbus and can be found here: http://code.google.com/ http://google.com/p/nimbus-as3/ Don't use the available swc since it hasn't been updated in a while. Nimbus is similar to Cairngorm but lighter and cuts out a lot of the plumbing. It also adds undo/redo history and handling of complex macro commands. For example, a parallel command runs a bunch of commands in parallel and a sequence command runs a bunch of commands in sequence. You can also have a parallel command inside of a sequence command inside of a sequence command, for example. The ASDoc inside the code is pretty thorough but there isn't additional documentation yet since the codebase has just reached a fairly stable state. I'm not saying it's for everyone, but you might want to give it a shot. Aaron Jeffry Houser wrote: Flex is a UI framework; I'd hardly consider it the answer to every one of your programming needs. I suspect that the original poster was looking for MVC alternatives. PureMVC ( http://puremvc.org/ ) and Mate ( http://mate.asfusion.com/ ) seem to be the most popular alternatives in terms of MVC frameworks for Flex. EasyMVC ( http://projects.simb.net/ http://simb.net/easyMVC ) is another one I've heard of. dnk wrote: On 18-Apr-09, at 10:07 PM, zuurl8 wrote: Flex is a lightweight framework. Do you need more then what Flex provides in interface, events, and modules? Well I think that I am talking about things more like code structure, methods of doing things, etc. There are obviously benefits from these other frameworks, otherwise people would not have written them. I do understand where you are coming from, but in my case, I am looking for something a little more than the Flex framework itself. d -- Jeffry Houser, Technical Entrepreneur Adobe Community Expert: http://tinyurl.com/684b5h http://www.twitter.com/reboog711 | Phone: 203-379-0773 -- Easy to use Interface Components for Flex Developers http://www.flextras.com?c=104 -- http://www.theflexshow.com http://www.jeffryhouser.com -- Part of the DotComIt Brain Trust div#ygrp-mlmsg #ygrp-msg p a span.yshortcuts { font-family: Verdana; font-size: 10px; font-weight: normal; } #ygrp-msg p a { font-family: Verdana; font-size: 10px; } #ygrp-mlmsg a { color: #1E66AE; } div.attach-table div div a { text-decoration: none; } div.attach-table { width: 400px; } -- tml
[flexcoders] Slider bug? Programmatic change event
Hey flexers, I've been dealing with the Slider recently and I think I'm seeing a bug, but I'd like a confirmation. I understand that when I set the value of the slider programmatically it's not supposed to dispatch a change event. This is what I want, however I'm not seeing that behavior. Looking at the Slider.value setter, I see it calls setValueAt(val, 0, true) where true is that the change is programmatic. However it also sets valuesChanged to true and calls invalidateProperties(). In commitProperties, if valuesChanged is true, it calls setValueAt with no programmatic parameter, which means it defaults to false, which means setValueAt ends up dispatching a change event. Am I crazy? Has this been submitted as a bug? I couldn't find a bug on it specifically, but I found this bug: http://bugs.adobe.com/jira/browse/SDK-16537 which is reporting that it's NOT dispatching a change event when it should. I understand the reporter of the bug was wrong in his assumptions, but the fact that he was NOT getting a change event when setting the value programmatically and I am is the confusing part. I want the result he was complaining about. :) Thanks. Aaron
Re: [flexcoders] Post on the flex coders message board
Hmm.okay. Wait for it.wait for it..now! Lucas Adams wrote: Please let me post questions. Thanks
Re: [flexcoders] relationship of mxml child tags and actionscript
Geng, Use the DefaultProperty metadata tag in your AS class. Whatever property you specify will be the property to which your MXML children will be set. Here's a start: http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Book_Partsfile=metadata_141_07.html Aaron gwangdesign wrote: Hi, I am still looking for some general documentations about the guidelines as to how to write ActionScript custom components. It's clear that you can expose public properties, styles and event listeners of your custom components as MXML properties. But what are the general rules if I want to allow my client developers to define a property in my custom component using a MXML child tag (as opposed to a property)? Like this: my:MyComp my:myChild color=0xFF width=300 mx:Label text={data}/ /my:myChild /my:MyComp Again, I am looking for _general_ guidelines. Thanks much. -geng
[flexcoders] XML namespace to aaa, aab, etc
Hey flexers, I have the following XML in a variable named node of type XML: g aah:type=imageGroup aah:group-id=2 aah:group-type-id=1 opacity=0.5 xmlns=http://www.w3.org/2000/svg; xmlns:aah= http://aaronhardy.com/svg; xmlns:xlink=http://www.w3.org/1999/xlink; xmlns:a=http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/; mask id=49e39820-3578-4385-97bf-423c0afb6de2 width=1202.4285143997722 height=709.7050470487598 image width=1202.4285143997722 height=338 xlink:href=/images/view/2_w1202.4285143997722h338x600y1014rw289rh81.png aah:cutx=600 aah:cuty=1014/ image width=709.7050470487598 height=338 xlink:href=/images/view/2_w709.7050470487598h338x1600y338rw170rh81.png transform=matrix(0 1 -1 0 1202.4285143997722 0) aah:cutx=1600 aah:cuty=338/ image width=1202.4285143997722 height=338 xlink:href=/images/view/2_w1202.4285143997722h338x1100y676rw289rh81.png transform=matrix(-1 0 0 -1 1202.4285143997722 709.7050470487598) aah:cutx=1100 aah:cuty=676/ image width=709.7050470487598 height=338 xlink:href=/images/view/2_w709.7050470487598h338x2300y0rw170rh81.png transform=matrix(0 -1 1 0 0 709.7050470487598) aah:cutx=2300 aah:cuty=0/ /mask rect width=1202.4285143997722 height=709.7050470487598 x=0 y=0 fill=#00 mask=url(#49e39820-3578-4385-97bf-423c0afb6de2)/ /g I then do var nodeCopy:XML = node.copy(); and receive the following: g aaa:type=imageGroup aaa:group-id=2 aaa:group-type-id=1 opacity=0.5 xmlns=http://www.w3.org/2000/svg; xmlns:aaa= http://aaronhardy.com/svg; mask id=49e39820-3578-4385-97bf-423c0afb6de2 width=1202.4285143997722 height=709.7050470487598 image width=1202.4285143997722 height=338 aaa:href=/images/view/2_w1202.4285143997722h338x600y1014rw289rh81.png aab:cutx=600 aab:cuty=1014 xmlns:aaa=http://www.w3.org/1999/xlink; xmlns:aab=http://aaronhardy.com/svg/ image width=709.7050470487598 height=338 aaa:href=/images/view/2_w709.7050470487598h338x1600y338rw170rh81.png transform=matrix(0 1 -1 0 1202.4285143997722 0) aab:cutx=1600 aab:cuty=338 xmlns:aaa=http://www.w3.org/1999/xlink; xmlns:aab= http://aaronhardy.com/svg/ image width=1202.4285143997722 height=338 aaa:href=/images/view/2_w1202.4285143997722h338x1100y676rw289rh81.png transform=matrix(-1 0 0 -1 1202.4285143997722 709.7050470487598) aab:cutx=1100 aab:cuty=676 xmlns:aaa=http://www.w3.org/1999/xlink; xmlns:aab=http://aaronhardy.com/svg/ image width=709.7050470487598 height=338 aaa:href=/images/view/2_w709.7050470487598h338x2300y0rw170rh81.png transform=matrix(0 -1 1 0 0 709.7050470487598) aab:cutx=2300 aab:cuty=0 xmlns:aaa=http://www.w3.org/1999/xlink; xmlns:aab= http://aaronhardy.com/svg/ /mask rect width=1202.4285143997722 height=709.7050470487598 x=0 y=0 fill=#00 mask=url(#49e39820-3578-4385-97bf-423c0afb6de2)/ /g However, if I do var nodeCopy:XML = XML(node.toXMLString()); I get a real-looking copy of my original XML (no aaa or aab namespaces). Can anyone explain why I'm getting the aaa and aab namespaces? In my experience it's had to do with setting a default namespace (in this case xmlns= http://www.w3.org/2000/svg;). I also know Jesse Warden has seen some weird, similar behavior: http://jessewarden.com/2007/05/flex-chronicles-25-e4x-gotchas.html. Thanks everyone. Aaron
[flexcoders] Loading remote font swf from local application
Hey everyone, Here at work we deal a lot with loading in font swfs at runtime using StyleManager.loadStyleDeclarations(). This works fine when we publish our application to the same server as the font swfs, however while debugging the application on our local machine it fails when trying to access the remote font swfs. This results in the following error: Font not found: Unable to load style(SWF is not a loadable module): [address of font swf] This seems to be a known issue dealing with security as seen here: http://bugs.adobe.com/jira/browse/SDK-15393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel Our workaround has always been to run a local apache server and then when debugging our application during development we make sure the browser points to something like http://localhost/MyApp/bin-debug/Main.html. It's becoming a big task to keep everyone's machine in check. Recently though, Joan Lafferty posted a response to the logged ticket which you can read in the link above. The example shows that reading the bytes of a module can allow you to import the swf in a security-friendly way. The example is not specific to loading a font swf though, it just shows how to load an external module at runtime. In our case, we can load in our font module as perscribed but I'm not sure what to do after that. StyleManager.loadStyleDeclarations() automatically makes the font available to the application, however, my tests show that just loading the font swf module using ModuleLoader.loadModule() doesn't cut it. Can someone fill in the gap here? Maybe I misunderstood Joan's post. Thanks! Aaron
Re: [flexcoders] Loading remote font swf from local application
That was the ticket! Thanks! Aaron Alex Harui wrote: Well, you’d have to call create() on the factory and then maybe call styleDeclarationsChanged on the StyleManagerImpl. Adobe expects developers to have a copy of the server deployment on their local machines. Then, using relative paths in loadStyleDeclarations should work both during local development and when deployed. If I was worried about my copies getting stale, I’d just write a script that downloads the server deployment. I would hope that stuff doesn’t change often in ways that affect the code you are developing. Alex Harui Flex SDK Developer Adobe Systems Inc. http://www.adobe.com/ Blog: http://blogs.adobe.com/aharui http://blogs.adobe.com/aharui *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On Behalf Of *Aaron Hardy *Sent:* Friday, April 10, 2009 12:32 PM *To:* flexcoders@yahoogroups.com *Subject:* [flexcoders] Loading remote font swf from local application Hey everyone, Here at work we deal a lot with loading in font swfs at runtime using StyleManager.loadStyleDeclarations(). This works fine when we publish our application to the same server as the font swfs, however while debugging the application on our local machine it fails when trying to access the remote font swfs. This results in the following error: Font not found: Unable to load style(SWF is not a loadable module): [address of font swf] This seems to be a known issue dealing with security as seen here: http://bugs.adobe.com/jira/browse/SDK-15393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel http://bugs.adobe.com/jira/browse/SDK-15393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel Our workaround has always been to run a local apache server and then when debugging our application during development we make sure the browser points to something like http://localhost/MyApp/bin-debug/Main.html http://localhost/MyApp/bin-debug/Main.html. It's becoming a big task to keep everyone's machine in check. Recently though, Joan Lafferty posted a response to the logged ticket which you can read in the link above. The example shows that reading the bytes of a module can allow you to import the swf in a security-friendly way. The example is not specific to loading a font swf though, it just shows how to load an external module at runtime. In our case, we can load in our font module as perscribed but I'm not sure what to do after that. StyleManager.loadStyleDeclarations() automatically makes the font available to the application, however, my tests show that just loading the font swf module using ModuleLoader.loadModule() doesn't cut it. Can someone fill in the gap here? Maybe I misunderstood Joan's post. Thanks! Aaron -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Alternative FAQ location: https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847 Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * Your email settings: Individual Email | Traditional * To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) * To change settings via email: mailto:flexcoders-dig...@yahoogroups.com mailto:flexcoders-fullfeatu...@yahoogroups.com * To unsubscribe from this group, send an email to: flexcoders-unsubscr...@yahoogroups.com * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
[flexcoders] Debugger can't find source for Slider class
Hey flexers, In my project I'm using a VSlider in one of my components. In my component's actionscript, I set the VSlider's value. I wanted to track that value going through the VSlider class but FlexBuilder's debugger can't seem to find the source for Slider (the base class for VSlider). I can open the Slider class in Flex builder just fine and set a break point in the value setter, but it never stops there in the debugger. Instead, it ends up stopping at what I assume is the next line of code it can find source for, which is the FlexEvent constructor. In the thread stack, it shows: mx.event::FlexEvent mx.controls.sliderClasses::Slider/set value [no source] ...my component stuff. I tried editing the source lookup path. Currently it's looking for source inside: C:\Program Files\Adobe\Flex Builder 3\sdks\3.2.0\frameworks\projects\framework\src. This should be right and when I attempt to be more specific by adding another source lookup path like C:\Program Files\Adobe\Flex Builder 3\sdks\3.2.0\frameworks\projects\framework\src\mx\controls it doesn't seem to make any difference. I haven't seen any problems with the debugger finding source for other framework classes. I am pulling in SWCs into my project that may have been built with other sdks. I doubt any of them use the Slider class themselves but I wouldn't rule it out. Anyone have any ideas? Thanks a lot! Aaron
[flexcoders] Variable SampleDataEvent is not defined.
Hey everyone. A couple months ago I worked on an AIR project where we made use of the SampleDataEvent class to generate dynamic audio. Today I came back to the project and ran it and am getting the following run-time error: ReferenceError: Error #1065: Variable SampleDataEvent is not defined. It is thrown in the first instance where we are referencing the SampleDataEvent class: addEventListener(SampleDataEvent.SAMPLE_DATA, sampleDataRequestHandler); I get no compile-time error. I have an import statement of import flash.events.SampleDataEvent; The project does reference other libraries and I have made sure they are all using the same SDK (I've tried both 3.2 and 3.3), however they do have SWCs in them that may have been built using an older SDK. My co-worker is able to run the project without any error being thrown and I have actually copied the SDKs from his machine to my machine and it hasn't made any difference. I HAVE re-installed Flex Builder since the last time the project worked for me. I've tried everything I can think of to no avail. Does anyone have any ideas of what might be going on? Thanks! Aaron
Re: [flexcoders] Re: Variable SampleDataEvent is not defined.
Tried that many a time. Other suggestions? Also, I for sure have AIR 1.5.1 installed on my computer. Aaron On Tue, Mar 24, 2009 at 11:40 AM, valdhor valdhorli...@embarqmail.comwrote: Maybe clean the project? --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Aaron Hardy aaronius...@... wrote: Hey everyone. A couple months ago I worked on an AIR project where we made use of the SampleDataEvent class to generate dynamic audio. Today I came back to the project and ran it and am getting the following run-time error: ReferenceError: Error #1065: Variable SampleDataEvent is not defined. It is thrown in the first instance where we are referencing the SampleDataEvent class: addEventListener(SampleDataEvent.SAMPLE_DATA, sampleDataRequestHandler); I get no compile-time error. I have an import statement of import flash.events.SampleDataEvent; The project does reference other libraries and I have made sure they are all using the same SDK (I've tried both 3.2 and 3.3), however they do have SWCs in them that may have been built using an older SDK. My co-worker is able to run the project without any error being thrown and I have actually copied the SDKs from his machine to my machine and it hasn't made any difference. I HAVE re-installed Flex Builder since the last time the project worked for me. I've tried everything I can think of to no avail. Does anyone have any ideas of what might be going on? Thanks! Aaron
Re: [flexcoders] Styling a list item renderer
Thanks Alex. Pairing a renderer with a custom list component seems a bit overkill and smells of over-coupling. In any case, your response answers my question and I greatly appreciate it. Thanks again! Aaron Alex Harui wrote: So if the renderer used say, a style named aaronRadius to determine the size of the circle, you don't have to change the styleName on the renderer. If you put a List selector in your styles block with aaronRadius in it, it should transfer through to the renderer. You won't be able to use aaronRadius in the mx:List tag because it isn't defined in the style MetaData, but you could pair your renderer with an AaronList subclass that defines aaronRadius on it, and makes your renderer the default renderer. Alex Harui Flex SDK Developer Adobe Systems Inc. Blog: http://blogs.adobe.com/aharui http://blogs.adobe.com/aharui -Original Message- From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com] On Behalf Of Aaron Hardy Sent: Saturday, March 14, 2009 7:48 PM To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com Subject: Re: [flexcoders] Styling a list item renderer Thanks for the response Alex. The styles I'm mostly talking about are very specific to the item renderer. For example, my renderer has a colored circle in it along with a few other things. I'd like to specify a radius style that can be a specific radius for one list and a different radius for a separate list. Thanks again for taking the time to participate on the list. Aaron Alex Harui wrote: There isn't a formal way. The styleName property will be assigned the List (actually an inner content pane), but I think after it has been added to the content pane you can reset it, like in createChildren or commitProperties. Normally, all of the styles of a renderer are supplied by styles set on the List. Which styles would you want to apply to List that are different from ones you'd want to apply to the renderer? Alex Harui Flex SDK Developer Adobe Systems Inc. http://www.adobe.com/ http://www.adobe.com/ Blog: http://blogs.adobe.com/aharui http://blogs.adobe.com/aharui http://blogs.adobe.com/aharui http://blogs.adobe.com/aharui *From:* flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com] *On Behalf Of *Aaron Hardy *Sent:* Saturday, March 14, 2009 10:19 AM *To:* flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com *Subject:* [flexcoders] Styling a list item renderer Hey flexers, What's the formal way to set a styleName to a list item renderer? It seems like ListBase would have an itemRendererStyleName of some sort, but I have yet to discover it. I realize in the renderer class constructor I could do something like this.styleName = 'mystyle'; but it doesn't seem flexible enough. What if I want to use the same renderer in two different lists, but styled differently? I'm just thinking there's got to be a better way that I'm missing. Thanks everyone. Aaron -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Alternative FAQ location: https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847 https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847 Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links
[flexcoders] Styling a list item renderer
Hey flexers, What's the formal way to set a styleName to a list item renderer? It seems like ListBase would have an itemRendererStyleName of some sort, but I have yet to discover it. I realize in the renderer class constructor I could do something like this.styleName = 'mystyle'; but it doesn't seem flexible enough. What if I want to use the same renderer in two different lists, but styled differently? I'm just thinking there's got to be a better way that I'm missing. Thanks everyone. Aaron
Re: [flexcoders] Styling a list item renderer
Thanks for the response Alex. The styles I'm mostly talking about are very specific to the item renderer. For example, my renderer has a colored circle in it along with a few other things. I'd like to specify a radius style that can be a specific radius for one list and a different radius for a separate list. Thanks again for taking the time to participate on the list. Aaron Alex Harui wrote: There isn’t a formal way. The styleName property will be assigned the List (actually an inner content pane), but I think after it has been added to the content pane you can reset it, like in createChildren or commitProperties. Normally, all of the styles of a renderer are supplied by styles set on the List. Which styles would you want to apply to List that are different from ones you’d want to apply to the renderer? Alex Harui Flex SDK Developer Adobe Systems Inc. http://www.adobe.com/ Blog: http://blogs.adobe.com/aharui http://blogs.adobe.com/aharui *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On Behalf Of *Aaron Hardy *Sent:* Saturday, March 14, 2009 10:19 AM *To:* flexcoders@yahoogroups.com *Subject:* [flexcoders] Styling a list item renderer Hey flexers, What's the formal way to set a styleName to a list item renderer? It seems like ListBase would have an itemRendererStyleName of some sort, but I have yet to discover it. I realize in the renderer class constructor I could do something like this.styleName = 'mystyle'; but it doesn't seem flexible enough. What if I want to use the same renderer in two different lists, but styled differently? I'm just thinking there's got to be a better way that I'm missing. Thanks everyone. Aaron -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Alternative FAQ location: https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847 Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * Your email settings: Individual Email | Traditional * To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) * To change settings via email: mailto:flexcoders-dig...@yahoogroups.com mailto:flexcoders-fullfeatu...@yahoogroups.com * To unsubscribe from this group, send an email to: flexcoders-unsubscr...@yahoogroups.com * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
Re: [flexcoders] AIR: Detecting when window resize is complete (mouse up)
Lushen, thanks for the response. Are you saying that you are able to receive MOUSE_UP events from your application when the user lets go of the mouse button as they finish resizing the application's window? I don't. On my application, I have: addEventListener(MouseEvent.MOUSE_UP, test); While I can click inside the application window and see the mouse_up events, if I click the edge of the window, resize it, and let go, I don't get any MOUSE_UP event. I get the same results if I add the event listener to the stage or nativeWindow as well. If I use MOUSE_OUT or ROLL_OVER, I likewise don't receive any events because the cursor is not inside the application bounds while it's resizing the window. If I used MOUSE_OVER, the user would have to make the cursor enter the application area after resizing the window in order for the event to be dispatched. Any other ideas? Thanks! Aaron On Thu, Jan 15, 2009 at 8:09 PM, Lushen Wu l...@iasyndicate.com wrote: I use mouseup in my application.. it seems to work for me. you coudl also play around with MOUSE_LEAVE and ROLL_OVER for the stage (activate the rollover listener for resize whenever you get a RESIZE event, then remove the listener when you have satisfactorily resized) Cheers, Lushen On 1/15/2009 3:56 PM, Aaron Hardy wrote: Hey folks, In my project I have a component that is a percentage width of its containing window. When the user resizes the window, it triggers the component to update its display list WHILE the user is dragging the window resize handle. Rather than updating the component's display while the user is dragging, I'd like to wait until the user lets go of the drag to update the component's display. Is there an event I can capture that will tell me when the user releases the mouse button after a window resize? NativeWindow.resize seems to be dispatched while the user is resizing. While that's not what I'm looking for, I tried watching that event and then adding a mouse up event listener to both the stage and native window to detect when the user then lets go of the mouse button, but a mouse up event never seems to be dispatched when the user releases the mouse button after resizing. Does anyone know of a good way to detect this or know of a creative workaround? Thanks! Aaron
[flexcoders] AIR: Detecting when window resize is complete (mouse up)
Hey folks, In my project I have a component that is a percentage width of its containing window. When the user resizes the window, it triggers the component to update its display list WHILE the user is dragging the window resize handle. Rather than updating the component's display while the user is dragging, I'd like to wait until the user lets go of the drag to update the component's display. Is there an event I can capture that will tell me when the user releases the mouse button after a window resize? NativeWindow.resize seems to be dispatched while the user is resizing. While that's not what I'm looking for, I tried watching that event and then adding a mouse up event listener to both the stage and native window to detect when the user then lets go of the mouse button, but a mouse up event never seems to be dispatched when the user releases the mouse button after resizing. Does anyone know of a good way to detect this or know of a creative workaround? Thanks! Aaron
Re: [flexcoders] Creating Asynchronous Classes
If none of those other suggestions work and you really need it, you can always use something like Merapi (http://merapiproject.net/) to hand the process off to Java. That increases the complexity of application packaging, deployment, keeping both AIR and Java running, etc...but it will work. Aaron nathanpdaniel wrote: Is there a primer on creating asynchronous classes? I've been building an app that runs a CRC32 check on each file (which requires looking at every byte of every file). It doesn't cause issues when the files are small text files, but when they're 40mb video files, the app hangs till complete. I want the app to be able to update other things while waiting on the CRC32 functionality completes. Actually, all I need is some visual progress indicator (some way to update the display). Anyone with any suggestions! I'm all ears! :D -N. D.
Re: [flexcoders] Searching Multi Demensional arrays
I think you're looking for something like this: public function findPath(items:Array, path:String):Object { for each (var item:Object in items) { if (item.path == path) { return item; } else if (children children.length 0) { var foundItem:Object = findPath(item.children, path); if (foundItem) { return foundItem; } } } } I didn't test out the code, but the concept is what is important. It's recursively calling the same function for each level of children (see how it calls findPath() within the function itself), so it digs down however deep it needs to. Good luck. Aaron Dan Vega wrote: I have an infinite number of objects child objects that looks something like this below. I know this if it was just one level I could probably accomplish what i need but I am not sure how to do this. All of the path items are always going to be unique. Is there a way to search (drilling down as far as needed) and say give me the object where path = xyz; (Array)#0 [0] (Object)#1 children = (Array)#2 [0] (Object)#3 children = (Array)#4 lastModified = 1230587039867 name = parent = C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\FFManager\src\data path = C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\FFManager\src\data\ [1] (Object)#5 lastModified = 1230580833728 name = another_one parent = C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\FFManager\src\data path = C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\FFManager\src\data\another_one [2] (Object)#6 children = (Array)#7 lastModified = 1230587312776 name = dan parent = C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\FFManager\src\data path = C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\FFManager\src\data\dan [3] (Object)#8 lastModified = 1230581177910 name = ggg parent = C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\FFManager\src\data path = C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\FFManager\src\data\ggg [4] (Object)#9 lastModified = 1230581240020 name = hjkl parent = C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\FFManager\src\data path = C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\FFManager\src\data\hjkl [5] (Object)#10 lastModified = 1230580116200 name = l parent = C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\FFManager\src\data path = C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\FFManager\src\data\l [6] (Object)#11 lastModified = 1230575547578 name = nnn parent = C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\FFManager\src\data path = C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\FFManager\src\data\nnn [7] (Object)#12 lastModified = 1230575859098 name = test parent = C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\FFManager\src\data path = C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\FFManager\src\data\test mx_internal_uid = B8E4886E-A00D-6D89-CBAA-84C60F791112 name = Home path = C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\FFManager\src\data Thank You Dan Vega danv...@gmail.com mailto:danv...@gmail.com http://www.danvega.org http://www.danvega.org
Re: [flexcoders] re-passing variable arguments?
Try continueFunction.apply(args); Aaron toofah_gm wrote: I have a method that accepts variable arguments like this: public function doSomethingThenContinue(continueFunction:Function, ...args) { // execute some code that does important stuff // call the continue function now that we are done passing the original args to that function continueFunction(args); } Is it possible to pass the variable arguments on to the generic continueFunction in this manner? I don't really want the args to be passed in a single Array, but want to call the continueFunction with the arguments split out like this dynamically continueFunction(args[0], args[1], etc.) depending on how many were passed in and depending on how many parameters the continueFunction accepts. Is this possible to do somehow? Thanks, Gary
Re: [flexcoders] How can i make possible to keep user back in the same TAB..
This might help you out: http://aaronhardy.com/flex/blocking-tabbar-clickchange-events/ Aaron b.kotireddy wrote: Hi, The below code is my one of the TAB from 4 tabs. Before leaving this tab i need to evaluate the page, if user forgot to save his filled data i need to save that data. My Question is their any way can i keep the focus on the same TAB if he gets some error message or some Alert in the this TAB. cpirMod:CpirModule xmlns:cpirMod=org.cpir.component.* xmlns:mx=http://www.adobe.com/2006/mxml http://www.adobe.com/2006/mxml layout=absolute width=100% height=100% creationComplete=initData(event) preinitialize=wireEvents(event) hide=focusoutHandler(event) mx:Script ![CDATA[ private function focusoutHandler(event:Event):void { Alert.show(Going Out of this tab from cities); } ]] /mx:Script mx:Canvas width=100% height=100% id=cityCanvas mx:HBox width=100% height=12% mx:TextInput id=search change=searchData() / /mx:HBox /Canvas /cpirMod:CpirModule Thanks in advance koti
[flexcoders] Architecture options for holding current model objects related to view
Hey everyone, Let me set up a situation for you. Let's say you have an application with a component called Widget1 that's buried deep within the display list. Widget1 displays 50 knobs. Now, let's say you move to another part of the application and click a button that instantiates Widget3 which shows certain pieces of information about the knob selected on Widget1. Within the display list tree, Widget1 and Widget3 are far from each other and nested deep within other views. In my experience, developers will usually create a property on the application's model (ModelLocator in the case of Cairngorm) that's called something like currentKnob. That way when Widget3 is instantiated it can know which widget was previously selected in Widget1. What are the best practices you've seen regarding this type of interaction within your applications? One alternative I can think of is if Widget1 dispatches an event off Application that the *creator* of Widget3 is watching for. Then when the creator of Widget3 actually creates the Widget3 instance, it can hand off the selected knob to the instance. Thanks! Aaron
Re: [flexcoders] Re: Flex training
If you have solid experience in developing a variety of Flex applications, you should be able to pass with little studying. I recently took it and felt it was worth my time. For any company specifically looking for Flex developers, they should be aware of the certification. While it may not boost your credibility a ton, if it comes down to two people that have very similar credentials but one has the certification, it can definitely help. The fact that the certification is published by Adobe helps too. If Adobe says you're a certified expert, anyone questioning your expertise (potential employers) will have a more difficult time doing so. That's my take. If you're interested in study material for the exam, feel free to read: http://aaronhardy.com/flex/adobe-flex-certification-study-materials/ Aaron ivo wrote: Would people recommend taking the Certification Exam from Adobe? From what I hear and looking at the sample questions an experienced dev should ace it without much trouble. I wonder if it is worth the expense and whether its known enough that noting it on a resume carries weight. Thanks, - Ivo *From:* Anthony DeBonis [EMAIL PROTECTED] *To:* flexcoders@yahoogroups.com *Sent:* Wednesday, December 10, 2008 2:04:16 PM *Subject:* [flexcoders] Re: Flex training If you have a group I would recommend an Adobe Training Class If 1-2 people a custom class/mentoring works great. Farata Systems is a good call in NYC Troy Web Consulting - Albany NY Certified Adobe Instructors + Mentoring This link can help you find a training partner http://partners. adobe.com/ public/partnerfi nder/tp/show_ find.do http://partners.adobe.com/public/partnerfinder/tp/show_find.do
Re: [flexcoders] How to display special characters like #176; in ComboBox list
Go to a page like this one: http://www.degraeve.com/reference/specialcharacters.php Copy the actual character (not the HTML representation) and paste it into your code. Bada bing bada boom. Aaron Tracy Spratt wrote: The special character numeric references work fine in Label and Text and such, but are interpreted literally in a ComboBox’s drop list. Any sugestions? Tracy -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Alternative FAQ location: https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847 Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * Your email settings: Individual Email | Traditional * To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) * To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
Re: [flexcoders] how can i get a columnIndex from an item in my TileList?
Just a thought (though not an answer), it might be a better idea if within your custom tooltip component you evaluated the space needed by your tooltip compared to the space between your cursor and the side of the stage, then move the tooltip accordingly. That way you're taken care of regardless of the position or size of your tilelist or the items inside the tilelist. Hope that's relevant. Aaron On Wed, Dec 3, 2008 at 11:21 AM, blc187 [EMAIL PROTECTED] wrote: I have a TileList that displays images. I'd like to be able to mouseover one of the images and get the index of the column it's in. Is there any way to get a row or column index on MouseOver? For context, I am displaying a custom tooltip on mouseover and I'd like to be able to tell if I'm mousing over the last image in the row so that I can prevent my tooltip from displaying offscreen.
[flexcoders] Resetting an application's view for new user
Hey flexers, I have a hefty AIR application with many different view combinations, forms filled with data, etc. When a user logs out and a different user logs in, I need the application to be reset so that everything looks as though no other user was previously logged in. I've ran into two solutions: 1) Reset all the forms, views, etc to their original state when the first user logs out. This can be tricky getting everything back to its initial state. 2) Make the main view (what would be the main application file in option #1) a separate component. When the user logs out, let the whole component get garbage collected. When the new user logs in, reinstantiate the main view to ensure its all in its initial state once again. With this option, there's not as much worrying about whether you've successfully reset everything since it's a brand new instance. However, processing time and memory management may be a new issue to deal with. So, I'm curious, how do you folks go about this in your projects? Thanks! Aaron
Re: [flexcoders] People with blogs
For Wordpress I use the WP-Syntax plugin. Here's an example of what it turns out like: http://aaronhardy.com/flex/finding-the-nearest-component-in-flex/ Now if I could just get more width on my page and less width on my code. :P Aaron On Wed, Dec 3, 2008 at 9:42 PM, Nate Pearson [EMAIL PROTECTED] wrote: Sorry this is a little off topic. I'm trying to start a flex blog but I'm not sure how to copy code from flex builder into Wordpress and have the formating stay the same. Is there some plugin that you use? How do you guys do it? Thanks a lot! -Nate
Re: [flexcoders] Resetting an application's view for new user
That's a good idea. I wonder if there's a way to do something similar in AIR considering you can't make the AIR executable restart itself (from what I know...without a bridge like Merapi). Maybe there's a way to essentially reload the contents of the AIR app without actually re-starting the executable? Thank you very much for your feedback! Aaron On Thu, Dec 4, 2008 at 11:15 AM, Tracy Spratt [EMAIL PROTECTED] wrote: Here is what I do: *public* *function* logOff():*void* { *var* ur:URLRequest = *new* URLRequest(_sAppUrl); navigateToURL(ur,*_self*); }*//logOff* _sAppUrl comes from the browser: location.href Tracy -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Aaron Hardy *Sent:* Wednesday, December 03, 2008 10:32 PM *To:* flexcoders@yahoogroups.com *Subject:* [flexcoders] Resetting an application's view for new user Hey flexers, I have a hefty AIR application with many different view combinations, forms filled with data, etc. When a user logs out and a different user logs in, I need the application to be reset so that everything looks as though no other user was previously logged in. I've ran into two solutions: 1) Reset all the forms, views, etc to their original state when the first user logs out. This can be tricky getting everything back to its initial state. 2) Make the main view (what would be the main application file in option #1) a separate component. When the user logs out, let the whole component get garbage collected. When the new user logs in, reinstantiate the main view to ensure its all in its initial state once again. With this option, there's not as much worrying about whether you've successfully reset everything since it's a brand new instance. However, processing time and memory management may be a new issue to deal with. So, I'm curious, how do you folks go about this in your projects? Thanks! Aaron
Re: [flexcoders] Component Life Cycle
I think I understand your question. Try throwing this in your component (outside of any methods/properties) and tweaking for your needs: // Default styles // private static var classConstructed:Boolean = classConstruct(); /** * @private * Creates default styles that can be overridden by the developer. */ private static function classConstruct():Boolean { var styleDeclaration:CSSStyleDeclaration = StyleManager.getStyleDeclaration('Cursor'); if (!styleDeclaration) { styleDeclaration = new CSSStyleDeclaration(); } styleDeclaration.defaultFactory = function():void { this.color = 0xFF; } StyleManager.setStyleDeclaration('Cursor', styleDeclaration, false); return true; } Note that Cursor is the component's name. This way of setting a default style personally seems rather unorthodox but it's the only way I've seen that works. I hope a better/developer-friendly approach is offered in future versions of Flex. Aaron On Thu, Dec 4, 2008 at 12:27 PM, pratikshah83 [EMAIL PROTECTED]wrote: Hi Guys, I had a question regarding the component life cycle. I am extending flex charts and adding my custom style to it. But when I load the chart I see the default flex axis being shown and than it would disappear and my styled axis shows up. I am wondering where do I style my axis such that default flex components are not rendered. Currently I am doing my custom styling in initialize() method. Please let me know which component life cycle method show I be doing the styling. Your replies would be appreciated. Thanks Pratik
Re: [flexcoders] Resetting an application's view for new user
Yeah, I think that would be akin to the first option described in my initial email. The difficulty with that is making sure that all state variables really do get reset. If new view combinations are added to the system later, the developer is required to ensure they are also included in the reinitialization process. Something that really ensures that everything is at a clean slate and doesn't leave room for error on the developer's part would be really nice. Tracy's recommendation is great for that since it basically re-loads the SWF completely, but I'm not sure there's an AIR-based alternative. Aaron On Thu, Dec 4, 2008 at 12:48 PM, Wildbore, Brendon [EMAIL PROTECTED] wrote: If you have an initialisation process which resets all state variables when the application starts you could just run that process again? -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Aaron Hardy *Sent:* Friday, 5 December 2008 8:22 a.m. *To:* flexcoders@yahoogroups.com *Subject:* Re: [flexcoders] Resetting an application's view for new user That's a good idea. I wonder if there's a way to do something similar in AIR considering you can't make the AIR executable restart itself (from what I know...without a bridge like Merapi). Maybe there's a way to essentially reload the contents of the AIR app without actually re-starting the executable? Thank you very much for your feedback! Aaron On Thu, Dec 4, 2008 at 11:15 AM, Tracy Spratt [EMAIL PROTECTED] wrote: Here is what I do: *public* *function* logOff():*vo id* { *var* ur:URLRequest = *new* URLRequest(_sAppUrl); navigateToURL(ur,*_self*); }*//logOff* _sAppUrl comes from the browser: location.href Tracy -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Aaron Hardy *Sent:* Wednesday, December 03, 2008 10:32 PM *To:* flexcoders@yahoogroups.com *Subject:* [flexcoders] Resetting an application's view for new user Hey flexers, I have a hefty AIR application with many different view combinations, forms filled with data, etc. When a user logs out and a different user logs in, I need the application to be reset so that everything looks as though no other user was previously logged in. I've ran into two solutions: 1) Reset all the forms, views, etc to their original state when the first user logs out. This can be tricky getting everything back to its initial state. 2) Make the main view (what would be the main application file in option #1) a separate component. When the user logs out, let the whole component get garbage collected. When the new user logs in, reinstantiate the main view to ensure its all in its initial state once again. With this option, there's not as much worrying about whether you've successfully reset everything since it's a brand new instance. However, processing time and memory management may be a new issue to deal with. So, I'm curious, how do you folks go about this in your projects? Thanks! Aaron
Re: [flexcoders] Resetting an application's view for new user
Yeah, something like that would probably work. On the other hand, I gave the code at the bottom of this page a try: http://www.docsultant.com/site2/articles/flex_internals.html and it seemed to work very well for restarting the AIR app. I think I'm going to take that approach. If anyone knows of a better approach, I'd love to hear about it. Thanks again, Aaron On Thu, Dec 4, 2008 at 1:47 PM, Wildbore, Brendon [EMAIL PROTECTED] wrote: Yep true, Sorry Aaron I missed the initial email. Tracys recommendation is simple and perfect for flex web based apps, Air apps are another issue. Could you perhaps hold all state variables in a bindable associative array or object, then just rebuild the object? Are you using any recognised framework for your app? -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Aaron Hardy *Sent:* Friday, 5 December 2008 9:38 a.m. *To:* flexcoders@yahoogroups.com *Subject:* Re: [flexcoders] Resetting an application's view for new user Yeah, I think that would be akin to the first option described in my initial email. The difficulty with that is making sure that all state variables really do get reset. If new view combinations are added to the system later, the developer is required to ensure they are also included in the reinitialization process. Something that really ensures that everything is at a clean slate and doesn't leave room for error on the developer's part would be really nice. Tracy's recommendation is great for that since it basically re-loads the SWF completely, but I'm not sure there's an AIR-based alternative. Aaron On Thu, Dec 4, 2008 at 12:48 PM, Wildbore, Brendon [EMAIL PROTECTED] wrote: If you have an initialisation process which resets all state variables when the application starts you could just run that process again? -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Aaron Hardy *Sent:* Friday, 5 December 2008 8:22 a.m. *To:* flexcoders@yahoogroups.com *Subject:* Re: [flexcoders] Resetting an application's view for new user That's a good idea. I wonder if there's a way to do something similar in AIR considering you can't make the AIR executable restart itself (from what I know...without a bridge like Merapi). Maybe there's a way to essentially reload the contents of the AIR app without actually re-starting the executable? Thank you very much for your feedback! Aaron On Thu, Dec 4, 2008 at 11:15 AM, Tracy Spratt [EMAIL PROTECTED] wrote: Here is what I do: *public* *function* logOff():*vo id* { *var* ur:URLRequest = *new* URLRequest(_sAppUrl); navigateToURL(ur,*_self*); }*//logOff* _sAppUrl comes from the browser: location.href Tracy -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Aaron Hardy *Sent:* Wednesday, December 03, 2008 10:32 PM *To:* flexcoders@yahoogroups.com *Subject:* [flexcoders] Resetting an application's view for new user Hey flexers, I have a hefty AIR application with many different view combinations, forms filled with data, etc. When a user logs out and a different user logs in, I need the application to be reset so that everything looks as though no other user was previously logged in. I've ran into two solutions: 1) Reset all the forms, views, etc to their original state when the first user logs out. This can be tricky getting everything back to its initial state. 2) Make the main view (what would be the main application file in option #1) a separate component. When the user logs out, let the whole component get garbage collected. When the new user logs in, reinstantiate the main view to ensure its all in its initial state once again. With this option, there's not as much worrying about whether you've successfully reset everything since it's a brand new instance. However, processing time and memory management may be a new issue to deal with. So, I'm curious, how do you folks go about this in your projects? Thanks! Aaron
Re: [flexcoders] Re: Component Life Cycle
To be honest, I'm not sure why it's using the default Flex styles at the beginning. What I do know is that when I set up my component's default style in the manner I posted, it works. The answer to your question lies in the underbelly of the Flex architecture and how/when it applies styles; there are probably other people on here that are much more qualified to explain. Good luck! Aaron On Thu, Dec 4, 2008 at 1:44 PM, pratikshah83 [EMAIL PROTECTED] wrote: Hi Aaron, Thanks for you reply. I was just wondering that I am currently doing the styling in initialize() method. So the charts is not rendered until that time, so why is the default flex axis is getting rendered. When the chart is rendered my styles should already be set. So how the updateDisplayList() method is getting called. I need to get my styles set before the updateDisplayList() method is called. Do you have any idea if preinitialize() method help ?? Thanks Pratik --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Aaron Hardy [EMAIL PROTECTED] wrote: I think I understand your question. Try throwing this in your component (outside of any methods/properties) and tweaking for your needs: // Default styles // private static var classConstructed:Boolean = classConstruct(); /** * @private * Creates default styles that can be overridden by the developer. */ private static function classConstruct():Boolean { var styleDeclaration:CSSStyleDeclaration = StyleManager.getStyleDeclaration('Cursor'); if (!styleDeclaration) { styleDeclaration = new CSSStyleDeclaration(); } styleDeclaration.defaultFactory = function():void { this.color = 0xFF; } StyleManager.setStyleDeclaration('Cursor', styleDeclaration, false); return true; } Note that Cursor is the component's name. This way of setting a default style personally seems rather unorthodox but it's the only way I've seen that works. I hope a better/developer-friendly approach is offered in future versions of Flex. Aaron On Thu, Dec 4, 2008 at 12:27 PM, pratikshah83 [EMAIL PROTECTED]wrote: Hi Guys, I had a question regarding the component life cycle. I am extending flex charts and adding my custom style to it. But when I load the chart I see the default flex axis being shown and than it would disappear and my styled axis shows up. I am wondering where do I style my axis such that default flex components are not rendered. Currently I am doing my custom styling in initialize() method. Please let me know which component life cycle method show I be doing the styling. Your replies would be appreciated. Thanks Pratik