I get a lot of emails containing great questions about topics like Flex, rich Internet applications, and bull riding. These emails are usually the highest priority emails for me to respond to – because that’s what a cowboy does. But I was just thinking that when people ask me questions over email other people with similar questions don’t get the benefit of seeing my response. So here is how it works:
- Ask a Question on StackOverflow.com
- Post a comment here with a link to the question
- Wait for me to get on my horse and respond
Please make sure that questions asked on StackOverflow are for a general developer audience, ie. something that more people than just you want to know the answer to. If your question is specific to you then email is still the best way to ask me.


84 Comments
Hi
I am working on A Image uploader,
My requirement is like I need to reduce the image resolution before uploading the image
So here is what exactly I am doing,
1. Using File Reference, get the selected image
2. Use Matrix and bitmap draw method to resize it
3. Encode it using JPEGEncoder/PNGEncoder
But the problem, I am not able to assign data property of FileReference object, and because of that I am bound to use URLLoader POST method to upload the images to my server, again here the problem is I cant get ProgressEvent’s bytesloaded or total bytes
Some says that it is not possible, then here goes an example from SnapFish.com which does the same thing and still they are able to have a progress bar, any idea how to achive that after resizing image
a question similar to this is available at
http://stackoverflow.com/questions/1512197/image-upload-progress-using-urlloader-as3
I saw some responses to your question before I was able to answer. Are those sufficient?
Yeah the responses are there but How to make it work? Can you suggest any workaround way to get the progressevent triggered??? while uploading…
as we can’t change data property of the FileReference object!
Looking forward to get a quick response
Unfortunately this looks like an open bug:
https://bugs.adobe.com/jira/browse/FP-1959
I think the only workaround might be FileReference.upload.
Hi James, I’ve posted another question to StackOverflow:
http://stackoverflow.com/questions/2969823/flex-4-getter-getting-before-setter-sets
There isn’t a good answer yet, but really I’m trying to identify an architectural pattern in Flex for using asynchronous getters/setters. I’m trying to download a XML file and create a global property from it, and then use functions in my main app to get/set it. If you have any useful resources/links to add to this question I’d really appreciate your help.
Hey Steve. Sorry I didn’t get to this one sooner. Looks like you got an acceptable answer. Let me know if you need me to look at it further.
Posted a question on StackOverFlow.
Using a Flex 3 linkBar with a viewStack dataProvider, the skin for oneof my linkButtons is distorted because of the length of linkButton label. How do I control the width for linkButtons that are generated by a dataProvider?
Thanks,
Jim
http://stackoverflow.com/questions/3039203/flex-3-linkbutton-width-distorted-skin-image
sorry , i finish the refcardz #102 but in the flex and spring security i have problems
this is the error
org.springframework.web.context.ContextLoader initWebApplicationContext
SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.springframework.security.web.context.HttpSessionSecurityContextRepository#0′: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/annotation/security/DenyAll
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:872)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:423)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3795)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4252)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:448)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Caused by: java.lang.NoClassDefFoundError: javax/annotation/security/DenyAll
at org.springframework.security.access.annotation.Jsr250MethodSecurityMetadataSource.processAnnotations(Jsr250MethodSecurityMetadataSource.java:60)
at org.springframework.security.access.annotation.Jsr250MethodSecurityMetadataSource.findAttributes(Jsr250MethodSecurityMetadataSource.java:46)
at org.springframework.security.access.method.AbstractFallbackMethodSecurityMetadataSource.getAttributes(AbstractFallbackMethodSecurityMetadataSource.java:34)
at org.springframework.security.access.method.DelegatingMethodSecurityMetadataSource.getAttributes(DelegatingMethodSecurityMetadataSource.java:53)
at org.springframework.security.access.intercept.aopalliance.MethodSecurityMetadataSourceAdvisor$MethodSecurityMetadataSourcePointcut.matches(MethodSecurityMetadataSourceAdvisor.java:129)
at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:217)
at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:254)
at org.springframework.aop.support.AopUtils.findAdvisorsThatCanApply(AopUtils.java:286)
at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findAdvisorsThatCanApply(AbstractAdvisorAutoProxyCreator.java:117)
at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:87)
at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:68)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:359)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:322)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:407)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1418)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
… 26 more
Caused by: java.lang.ClassNotFoundException: javax.annotation.security.DenyAll
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1438)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1284)
… 42 more
Jun 23, 2010 10:02:58 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.springframework.security.web.context.HttpSessionSecurityContextRepository#0′: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/annotation/security/DenyAll
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:872)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:423)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3795)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4252)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:448)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Caused by: java.lang.NoClassDefFoundError: javax/annotation/security/DenyAll
at org.springframework.security.access.annotation.Jsr250MethodSecurityMetadataSource.processAnnotations(Jsr250MethodSecurityMetadataSource.java:60)
at org.springframework.security.access.annotation.Jsr250MethodSecurityMetadataSource.findAttributes(Jsr250MethodSecurityMetadataSource.java:46)
at org.springframework.security.access.method.AbstractFallbackMethodSecurityMetadataSource.getAttributes(AbstractFallbackMethodSecurityMetadataSource.java:34)
at org.springframework.security.access.method.DelegatingMethodSecurityMetadataSource.getAttributes(DelegatingMethodSecurityMetadataSource.java:53)
at org.springframework.security.access.intercept.aopalliance.MethodSecurityMetadataSourceAdvisor$MethodSecurityMetadataSourcePointcut.matches(MethodSecurityMetadataSourceAdvisor.java:129)
at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:217)
at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:254)
at org.springframework.aop.support.AopUtils.findAdvisorsThatCanApply(AopUtils.java:286)
at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findAdvisorsThatCanApply(AbstractAdvisorAutoProxyCreator.java:117)
at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:87)
at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:68)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:359)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:322)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:407)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1418)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
… 26 more
Caused by: java.lang.ClassNotFoundException: javax.annotation.security.DenyAll
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1438)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1284)
… 42 more
Are you using the latest Sun JDK 6?
i using
MacBook-2:~ victor$ java -version
java version “1.6.0_20″
Java(TM) SE Runtime Environment (build 1.6.0_20-b02-279-10M3065)
Java HotSpot(TM) Client VM (build 16.3-b01-279, mixed mode)
Are you using Tomcat 6.0.26?
im using tomcat 5.5 because in my vps have 5.5
I guess that Spring Security 3 requires Tomcat 6 since this doesn’t seem to be working for you.
in this examples (refcardz #102) how can change the H2 database for postgresql?
Just change the Spring DataSource configuration. More details:
http://onjava.com/pub/a/onjava/2006/03/22/advanced-spring-configuration.html?page=2
Hello James,
Looks like you know your way around Java, AMF, Flex, JS, AS3… all the technologies we use and love!
I am wondering if we could BlazeDS to encode large Java arrays to AMF3 bytearrays that we can store in our database and later upload to our Flex application? This way Blaze does not have to encode the array of data on each client request. (I am talking about arrays that contain 100k Numbers, Strings or Dates)
Congrats btw on the AMF js library – impressive!
Kind regards,
= Dirk
You certainly could. Check out the Amf3Output class in BlazeDS. I can be used to create an OutputStream containing the AMF for any Object(s).
Thanks so much, cowboy!
Howdy,
Straight to the point: http://stackoverflow.com/questions/3222583/why-does-this-flex-demo-from-adobe-not-work
The demo doesn’t work (at least for me): http://www.adobe.com/products/flex/media/flexapp/modal.html?width=928&height=732
Cheers,
minime
James,
I am looking for some good marketing materials that demonstrate the strengths of Flex and when it is a good choice to pair it with Salesforce for building apps with the Force.com platform. I am currently watching your Force Platform Extreme UI: Using Adobe AIR and Flex to Make Your Apps *Bling* speech and wanted to know if there’s anything else that you have or know of that could be helpful.
Thanks,
Phillip
There is some great info on that here:
http://www.adobe.com/devnet/salesforce/
Thanks James. I found that and have been digging through it quite a bit. Good stuff there and it’s been really helpful.
Hi James,
I will be very appreciated if you could help me to solve that problem. Here’s the link to Stackoverflow:
http://stackoverflow.com/questions/3318880/img-tag-in-richtexteditor-adobe-air
I just need to know if it’s possible to add img tag to the htmlText properity in the RichTextEditor in AIR application…
Many thanks,
Ramy
Hi James,
would you be able to help with following issue:
http://stackoverflow.com/questions/3376494/weird-display-when-scolling-images-inside-list-component-in-flex
Thanks a lot.
Tam
http://stackoverflow.com/questions/3505185/using-air-to-add-desktop-guis
This really deserves a blog article, but nobody’s done it yet, it seems.
Any input is appreciated. :-)
Sorry for the delay. I’ll try to get this answered today.
I’ve a Flex puzzler. I put a DropDownList inside an ItemEditor for a DataGrid. Scrollbars on the DDL are not working. Mouseovers respond normally, but clicking on the scrollbar sends the click event to the DataGrid, not to the DropDownList.
Details are on .
Any help, suggestions, or solutions would be very welcome.
Thanks
Dan
Grrr. Typo’d the previous post.
Details are on StackOverflow.
My bad.
Dan
James,
is it possible to record Webcam stream without connecting to outside server (such as FMS or Red5)
http://stackoverflow.com/questions/3580041/is-it-possible-to-record-video-in-flex-without-streaming-to-a-server
Thanks,
Tam
Unfortunately Bhavesh.Bagadiya’s response is correct. There is an open feature request for this:
https://bugs.adobe.com/jira/browse/FP-5