Do you want more about Flex, Flash and Actionscript?
IT Failed is no longer updated with this kind of info.
For better convenience I created a new blog with only Flex issues...
the flexache
get now to get your fresh medicines
Information technology (it) often FAILS! Let's solve it. Problems and solutions on areas: Adobe's Flex, PHP, Delphi, Visual Studio, Windows, intranet, internet, popular applications, hacks, cheats techniques and much more; so enjoy your fail!!!
situation | |
Here’s a handy tip which can help you when deploying Flex applications on mulitple servers (such as a staging/production server). Basically you can listen for the Application tag to dispatch the applicationComplete event, grab the URL of the SWF using the loaderInfo.url property, and then use the URLUtil.getServerName() method to parse out the server name. | |
problem | |
adobe flex4 flex 4.0 AS3.0 Determining which server/domain a SWF is hosted on | How to get the domain where the swf is hosted ---- > page: dn | |
difficulty level | |
0/10 :))) | |
compatibility | |
flex4, as3 | |
solution | |
In prior version of Flex 4.0 use this: URLUtil.getServerName(Application.application.loaderInfo.url); In 4.0 use this: because Application is no longer available in 4.0 URLUtil.getServerName(FlexGlobals.topLevelApplication.url) | |
situation | |
This is known bug! This problem occurred when you exported a “release” previously; thenceforth the trace() messages are not appeared in the console window. !!! If you are beginner on Flex, read the "attention" at the bottom of this post! !!! | |
problem | |
adobe flex4 AS3.0 Flex4, trace function is not working anymore! ---- > page: dn | |
difficulty level | |
3/10 :)) | |
compatibility | |
flex4, as3 | |
solution | |
Try 1 1. Clean the build: Project -> Clean -> Clean project (select this one specific from the list) -> ok 2. “Debug” the application (pressing the “bug” button); rebuild will be done 3. The problem should be solved! Otherwise try try2. Try 2 1. Restart the Flex / Flash builder IDE 2. Restart the browser with Adobe Flash Debugger Player 3. Clean the build: Project -> Clean -> Clean project (select this one specific from the list) -> ok 4. “Debug” the application (pressing the “bug” button); rebuild will be done 3. The problem should be solved! | |
attention | |
Important note for beginners: You should “debug” the application (pressing the “bug” button) and not “run” the application (pressing the “play” button) to see the trace() messages at the console window. In “run” mode the trace() message are omitted. | |
| situation | |
| how to make easy(!) modifications in Image components with out modifying their data. The data modification (image modification) requires a lot cpu resources as result low performance. | |
| problem | |
| adobe flex4 AS3.0 how to make an image brighter, i.e. for focus purposes, without modify it > page: dn | |
| difficulty level | |
| 2/10 :) | |
| compatibility | |
| flex4, as3 | |
| solution | |
| - drop a Label on the Image component to cover it, clear text property - on this Label... set as background color the white color - also set as blendmode the "overlay" value - also set as backgroundAlpha the value 0.5 - now... on runtime play with "alpha" property of the Label with values 0..400 | |
| situation | |
| how to make a image cache? | |
| problem | |
| adobe flex4 AS3.0 the image component how to load images save them to cache… and how apply them to Image components --- > page by dn | |
| difficulty level | |
| 9/10 :( | |
| solution | |
| In order to make a cashe of the photos/images, I do the follow simple way: - With URLLoader I download the data… the "Complete" event gives me the "data" property… in this property the data of the image is in binary format (don't be afraid). I save this "data" to another variable (or array) of Object type. For this example, I named this variable "downloadData" you will see bellow. - In order to load the data on a visual component Image, I do the follow code: myImage.data=downloadData; | |
| attention | |
| no attentions! | |
cacheAsBitmap property to improve rendering performance or the cachePolicy property to speed up animations. I’m talking about caching the actual bitmap data of an image.Dictionary or an associative array will also work just fine.Image object and add a listener for the COMPLETE event:| var image : Image = new Image (); image.addEventListener (Event.COMPLETE, onImageComplete); |
| private function onImageComplete (event : Event) : void { var image : Image = event.target as Image; if (! imageCache.containsKey (image.source)) { var bitmapData : BitmapData = new BitmapData (image.content.width, image.content.height, true); bitmapData.draw (image.content); imageCache.put (image.source, bitmapData); } } |
source property) to see if you’ve already cached it:| var image : Image = new Image (); image.addEventListener (Event.COMPLETE, onImageComplete); if (imageCache.containsKey (imageURL)) { image.source = new Bitmap (imageCache.getValue (imageURL)); } else { image.source = imageURL; } |
| problem | |
| adobe flex4 AS3.0, filestraem (air) How to write a file where the application is located | the mystery "fileWriteResource" hidden error | how to write files in applicationDirectory (where is not allowed) [tested in windows only] --- > page by dennis | |
| solution | |
| How to write a file where the application is located in the follow example, the variable "filename" is String and has as value the the file name without path, i.e.: "sample.txt" the follow code doesn't work, produces an error "fileWriteResource" that is not even thrown! var newFile:File=File.applicationDirectory.resolvePath(filename); use the follow code: var newFile:File=File(File.getRootDirectories()[0]).resolvePath(File.applicationDirectory.nativePath+File.separator+filename); //I am not kidding... it is working | |