8
May
2006

Tips for Flex 2 beta 3

As you may have heard, Flex 2 beta 3 is out. Here are some quick tips for the new beta.

Migration notes

There were a couple things that tripped me up during migration that you might want to watch out for:

  • If you use states… the “target” property of the AddChild tag has been renamed “relativeTo”. Unfortunately, the “target” property still exists, but it now means something different. My suggestion is to do a search for AddChild and change “target” to “relativeTo” as one of the first things you do in moving to beta 3. If you forget to do this, you get a somewhat cryptic runtime error (“Cannot add a child that is already parented”) when you switch into that state.
  • If you use trace… Don’t worry when it tells you that flash.util.trace is an invalid import. You no longer need to import anything to use trace.

Source code available for the framework

The most exciting news is that the framework source is now part of the beta distribution. You can use this to debug, to help you understand how components are created, and to serve as the basis for new components that you may want to build.

For most project types, debugging into framework source “just works”. Step into framework source just as you would with any other source code.

You can also navigate to the source by ctrl-clicking on a class name, method name, or MXML tag.

navigating to source code

~

Using framework source with FDS

For FDS projects with server compile, the source attachment for framework.swc is not automatically set in beta 3, due to the different way in which the compiler is used. You can work around this, but it is pretty difficult to figure out:

  1. Navigate to thisproject properties > Flex Build Path > Library Path >. Find framework.swc, which is in the second node in the list.
  2. step 1
  3. Open up the framework.swc node to view the source attachment.
  4. Even though it looks like the source attachment is not editable, go ahead and double click where it says “Source Attachment: (None)”.
  5. You should see this dialog box. Now hit “Browse…”
  6. step 2
  7. Navigate to [FDS directory]/flex_sdk_2.0/frameworks/source.
  8. step 3

At this point, debugging into source will work for your FDS project should work correctly.

38 Responses to “Tips for Flex 2 beta 3”

  1. Stefan Schmalhaus

    After installing the new Beta 3 I’m having trouble with loading local XML files. For example, if I try to start the flexstore demo I get this error message:

    [RPC Fault faultString=”Error #2028: Local untrusted file data/catalog.xml may not access Internet URL file:///C:/Dokumente und Einstellungen/stefan/My Documents/Flex Builder 2.0/flexstore/bin/flexstore.swf.” faultCode=”InvokeFailed” faultDetail=”null”]

    I get the same error messages with all my test applications where I use XML files. This problem didn’t occur in Beta 2.

  2. mike chambers

    >After installing the new Beta 3 I’m having trouble with loading local XML files

    In the project setting for your project, select the Flex Compiler section and add the following to Additional compiler args:

    –usenetwork=false

    This is due to security changes in beta 3 where SWFs can talk to the local machine or the network, but not both.

    mike chambers

    mesh@adobe.com

  3. Stefan Schmalhaus

    Never mind, problem solved. Please delete this post and the previous one. Sorry!

  4. Stefan Schmalhaus

    Here’s a little Flex experiment I successfully tested with Flex 2 Beta 3. It’s about localizing a Flex application at runtime:

    http://www.blog2e.com/2006/05/09/localizing_flex/

  5. Waldo Smeets

    Thanks for the note on the State targets. You said “do a search for AddChild and change “target” to “relativeTo”” but unfortunately with the Eclipse Find & Replace it’s not as easy as it sounds. Dreamweaver’s Search & Replace really is lightyears ahead, would love to have the same functionality in a future version of FlexBuilder.

  6. Koali blog » Blog Archive » Flex2 beta 3 released

    […]  http://kuwamoto.org/2006/05/08/tips-for-flex-2-beta-3/ […]

  7. Sho

    I agree about Dreamweaver’s find and replace. It is one of the most powerful (and sometimes unappreciated) features of Dreamweaver.

  8. Steve

    I’m also getting a “local untrusted file” when trying to load an MP3 into a Sound Object. I tried ot load the swf both locally and on line. The Runtime Error Codes lists it (#2028) but doesn’t suggest how to fix it. I’m compiling on a Mac via mxmlc in Terminal. I tried Mike’s “-usenetwork=false” suggestion but it didn’t fly.

    The Sound example given in the Language Reference fails similarly for me. It worked perfectly in beta 2, so I’m at a loss as to what to do.

    Any suggestions? Thanks.

  9. F.Ripper

    Dreamweaver UI experience can really improve Flex Builder.

    Also, I always dreamed of having Dreamweaver’s luxurious markup templates in Flash IDE. I think such feature can be effectively used in Design mode of mxml doc to achieve consistency of design process. I think there’s a lot of markup templates strong points and they can be used in Flex.

    BTW, I’ve decided to test Flex Builder 2 on Pentium3 700 MHz machine and found it running good :)

  10. kuwamoto.org » Blog Archive » More Flex 2 beta 3 migration notes

    […] This is in addition to the other migration notes I listed here. […]

  11. Rostislav Siryk

    Sho, i’ve checked again your video tutorial on building simple flickr search (http://labs.adobe.com/flexproductline/videos/) — really useful one, but i’ve noticed a tons of discrepancies was accumulated from the date it was taken):

    1. You use Flex Builder Alpha 1 Release in demo. Maybe it makes sense to update the video? Many things changed in Builder from those early era.

    2. For example, when I place components onto app in Design view (following your first steps) light-green lines appear and help me to align items — they very useful like Snap Align in Flash IDE. But there’s no such lines in Builder in your video.

    3. Next, you use Align function from Modify menu; but Modify item is absent in current Flex Bulder 2 Beta 3. Align commands are in the context menu now (appearing when multiple selection in Design view is being right-clicked). BTW, isn’t it a good idea to have Align Panel too? Like in Flash IDE.

    4. Now we use {service.lastResult…} binding instead of outdated {service.result…}, which causes an error.

    5. In Preferences> General> Keys and to set up my favourite shortcuts manually.

    But what i really wanted to say is thank you for hard job! And if there’s a better place for my probably annoying suggestions just tell me and i’ll repost all these words there.

  12. Sho

    Thanks for the comments on the video. We should probably update them at some point. For now, we’re concentrating on creating new content instead of updating old content.

  13. bitwize

    steve wrote: “I’m compiling on a Mac via mxmlc in Terminal. I tried Mike’s “-usenetwork=false” suggestion but it didn’t fly.”

    For beta3 it’s now ‘use-network=false’. However via command-line didn’t work as it’s preset as true in flex-config.xml ~so edited that file instead and it worked.

  14. Steve

    bitwize: thanks for that. I had discovered the hyphen in the middle via mxmlc help, but hadn’t thought to address it in the flex-config file. I appreciate the tip.

  15. AshtarotH

    Can u help me with this?
    I’m getting some information from a soap service …. the swf works fine in the default directory of compilation, but if I move it …. it send this error:

    [RPC Fault faultString=”Security error accessing url” faultCode=”Channel.Security.Error” faultDetail=”Destination: DefaultHTTP”]
    at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::faultHandler()
    at mx.rpc::Responder/fault()
    at mx.rpc::AsyncRequest/fault()
    at ::DirectHTTPMessageResponder/securityErrorHandler()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/flash.net:URLLoader::redirectEvent()

    I insist, this works ok into the default path, but if I upload de swf into a server this doesn’t work.

    Thanx in advance.

  16. Sho

    It looks like you’re running into a security issue with the player. In general, a SWF cannot access a URL outside the domain where the SWF was retrieved from. When a SWF runs locally, security constraints are different in a somewhat confusing way. For more help, try asking the Adobe newsgroups. We have been trying to make sure that Adobe engineers are actively asking questions there.

  17. AshtarotH

    Thanx a lot Sho!

  18. Go Flex! at

    […] UPDATE2.5 Borre el Update 2 porque era gigante :P. En kiwamoto.org pregunte sobre el problema en cuestion, ante lo cual Sho replico: […]

  19. HANSELMO

    i’m using the asynchronous mechanism but i have problem getting the event.call AsyncToken, when i call a service that faults by a connection problem (so Flex can’t call the operation)…my code looks like:


    var call:AsyncToken = webservice call…;
    call.resultHandler = myResult;
    call.faultHandler = myFault;

    1) myResult function is called if the service method works.
    2) myFault function is called if the service method throws an application exception.
    3) myFault function isn’t called if there is a problem preparing the call to the service method.

    Have anybody the same problem?

    Thanks

  20. sho

    Hi HANSELMO.

    I’m not quite sure how resultHandler is getting called. Are you wiring that up yourself? According to my reading of the beta 3 documentation, you need to set the responder of the AsyncToken. The responder gets called on a result or a fault.

    If you are wiring it up yourself (using code similar to what I had in some of my other blog posts), you will need to separately wire up a fault handler to deal with faults, because the event type is different than the result event.

  21. hanselmo

    Thanks Sho for the reply…

    I saw that you’re busy in fighting with spammers in this period ;)…

    Excuse me for the sample it’s not so clear… i post my reply in this topic because you’re talking about migration from Flex 1.5 to 2, but I didn’t explain well my problem…i try now…

    I’m working with Cairngorm-like framework (command/responder pattern) and I’ve problems handling the on fault event with the AsyncToken on Flex 2 and web services…

    It seems that in some error cases (like if i give a wrong wsdl or if there are exception in marshalling/unmarshalling of parameters) event.call is undefined!!!

    Look at this code…

  22. hanselmo
  23. hanselmo

    can i send you the sample?

  24. Sho

    Thanks. It looks like it might be a bug in Flex. I’ve let people know.

  25. Guillermo

    Hi guys! I’m running mi app local with a data provider in a server and it gives me this:
    [RPC Fault faultString=”Security error accessing url” faultCode=”Channel.Security.Error” faultDetail=”Destination: DefaultHTTP”]

    Any idea how to deal with this channel security error anyway?

    Thanks!
    Guille

  26. Volodymyr

    Hello,

    Sorry for my english:)

    When i run my application by local i recived a error message:

    SecurityError: Error #2028: Local-with-filesystem SWF file file:///C|/Program%20Files/Apache%20Group/Apache2/htdocs/mainOfMainOfPostCardAugust/bin/PostCard.swf cannot access Internet URL https://www.google.com/tbproxy/spell?lang=en.

    I use -use-network=false and -use-network=true and many other combination but it’s doesn’t work.

    Can you help me?

  27. Paul

    You need to set up on the server where the data is coming from (ie the remote server) in the root directory a file called crossdomain.xml, or configure a proxy on your local server to gather the data. (Google for more about crossdomain.xml)

  28. Sharon Stephanie

    I wanted to write a simple comment in order to say thanks to you for these fabulous suggestions you are giving out on this website. My time consuming internet look up has finally been recognized with reliable tips to go over with my friends and classmates. I ‘d assert that most of us readers are truly lucky to be in a useful website with very many brilliant individuals with interesting tricks. I feel quite lucky to have come across your entire web page and look forward to so many more cool times reading here. Thanks again for all the details.

  29. insomnia occurs

    Appreciate this post. Will try it out.

    Here is my website :: insomnia occurs

  30. debtsolution

    When I initially commented I clicked the “Notify me when new comments are added”
    checkbox and now each time a comment is added I
    get several e-mails with the same comment. Is there any way you can remove
    me from that service? Appreciate it!

  31. yuki.alinggo.net

    Te agradezco infinitamente compartas tu receta de galletas de mantequilla,busque en la red por mucho tiempo y por fin encontré contigo lo que procuraba.
    El día de ayer mismo hallé tus receta…estoy preparando una Candy Bar para la
    Comunión de mi hijo y voy a hacer unos dulces. Eso si,
    he modificado la receta…como no tenia esencia de vainilla he añadido zumo de naranja natural,
    un chorrito.

  32. kapsulbinahong.net

    Helpful information. Fortunate me I discovered your website by accident,
    and I’m surprised why this twist of fate did not came about earlier!
    I bookmarked it.

  33. manfaat daun sirsak

    It’s remarkable in favor of me to have a website, which is good designed for
    my knowledge. thanks admin

  34. nufamco.net

    I like the valuable info you supply on your articles. I will bookmark your weblog and check once
    more here frequently. I’m quite sure I’ll learn many new stuff right here!

    Good luck for the following!

  35. jual boneka

    Thanks on your marvelous posting! I actually enjoyed reading it, you
    can be a great author.I will make sure to bookmark your blog
    and will eventually come back in the future. I want to encourage one to continue your great
    work, have a nice evening!

  36. Electrolux servisi

    Never mind, problem solved. Please delete this post and the previous one. Sorry!

  37. مدیریت یادگیری

    The company has sinxe announced something which will compete
    nearer with the Apple Watch, a $250 Instrumentation monitorung
    smartwatch called the Electronic tools Surge.

    Feell frwe to visit my homepage :: مدیریت یادگیری

  38. start.me

    http://www.herz-ukraine.de/de/humanitaere-hilfe-fuers-geriatriezentrum-lutzkukraine/

    Title

Leave a Reply