Ask The RIA Cowboy

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:

  1. Ask a Question on StackOverflow.com
  2. Post a comment here with a link to the question
  3. 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.

This entry was posted in Ask The RIA Cowboy. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

84 Comments

  1. Divakarla Srinivas
    Posted June 1, 2010 at 2:22 am | Permalink

    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

    • Posted June 4, 2010 at 6:34 am | Permalink

      I saw some responses to your question before I was able to answer. Are those sufficient?

      • Divakarla Srinivas
        Posted August 26, 2010 at 2:59 am | Permalink

        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

  2. Steve
    Posted June 4, 2010 at 11:19 am | Permalink

    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.

    • Posted June 7, 2010 at 6:16 am | Permalink

      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.

  3. JD
    Posted June 14, 2010 at 10:02 am | Permalink

    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

  4. victor azuara
    Posted June 23, 2010 at 10:06 pm | Permalink

    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

    • Posted June 24, 2010 at 4:33 am | Permalink

      Are you using the latest Sun JDK 6?

      • victor azuara
        Posted June 24, 2010 at 5:37 am | Permalink

        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)

        • Posted June 24, 2010 at 5:42 am | Permalink

          Are you using Tomcat 6.0.26?

          • victor azuara
            Posted June 24, 2010 at 5:48 am | Permalink

            im using tomcat 5.5 because in my vps have 5.5

          • Posted June 24, 2010 at 5:52 am | Permalink

            I guess that Spring Security 3 requires Tomcat 6 since this doesn’t seem to be working for you.

  5. victor azuara
    Posted June 24, 2010 at 6:36 am | Permalink

    in this examples (refcardz #102) how can change the H2 database for postgresql?

  6. Posted July 8, 2010 at 2:01 pm | Permalink

    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

    • Posted July 8, 2010 at 2:25 pm | Permalink

      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).

  7. minime
    Posted July 11, 2010 at 2:46 am | Permalink
  8. Phillip Houston
    Posted July 12, 2010 at 9:41 am | Permalink

    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

  9. Ramy
    Posted July 24, 2010 at 6:41 am | Permalink

    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

  10. Tam
    Posted July 31, 2010 at 12:06 am | Permalink

    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

  11. wrp
    Posted August 17, 2010 at 10:38 am | Permalink

    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. :-)

    • Posted August 19, 2010 at 6:30 am | Permalink

      Sorry for the delay. I’ll try to get this answered today.

  12. Posted August 19, 2010 at 8:09 am | Permalink

    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

  13. Posted August 26, 2010 at 7:57 pm | Permalink

    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

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Subscribe without commenting