Learning Flex 3 (Alaric Cole)

Getting Up to Speed with Rich Internet Applications (RIAs)

Chapter 11 Examples

Here is the example application for Chapter 11: Controlling Flow and Visibility.

12 comments

12 Comments so far

  1. Neil July 22nd, 2008 2:45 pm

    Hello Alaric,

    I’ve been enjoying your book so far, but I’m having problems with the photo gallery in Chapter 11. I built the application following the code in your book and also tried extracting your zip file, but when I run the program I get this error(condensed):

    “Error #2148: SWF file
    file:///C:/Documents and Settings/(myComputer)/My Documents/Flex Builder 3/
    PhotoGallery/bin-debug/PhotoGallery.swf cannot access local resource photos.xml.
    Only local-with-filesystem and trusted local SWF files may access local resources.” faultCode=”InvokeFailed” faultDetail=”null”]

    The photos.xml file is in the src folder and I also tried moving the photos to the src folder on my hard drive, but no luck yet. Please let me know if you have any suggestions.

    Thanks

  2. Neil July 22nd, 2008 3:16 pm

    I did some searching and I found a website with suggested fixes for Error #2148:

    http://curtismorley.com/2007/08/31/flash-cs3-flex-2-as3-error-2148/

    I used Fix 4 and the photo gallery works now. I’m not sure if this is the best workaround though…

  3. Alaric July 22nd, 2008 9:41 pm

    I just noticed this problem while teaching my Flex class. By default Flash apps won’t allow access to local resources. However, the bin-debug directory of a Flex project normally has special permissions set up, so this isn’t a problem.

    Since you’re having the issue, there’s no doubt others are. To fix it, you can load the photos.xml file from a server as suggested in the Note on page 166.

    Simply replace the url property of the HTTPService with “http://greenlike.com/flex/learning/projects/photogallery/photos.xml” (instead of the local photos.xml file).

    Note that this error won’t occur when the application is viewed remotely, it’s just a security measure to prevent unwanted SWF files from accessing your hard drive.

  4. Safder November 14th, 2008 12:20 am

    Hi Alaric
    I tried the above suggestion, but for some reason the my list items are not visible, I can click on these “invisible” items, and the pictures load. Any suggestions?

  5. Alaric November 14th, 2008 12:26 am

    Be sure your List’s labelField property is set the same as the attribute you want to display in the XML. If your XML has “title” attributes, you need a labelField of “@title”, and so on. Also be sure you haven’t set any strange styles on the List that might make the text of the List unreadable.

  6. Safder November 14th, 2008 12:36 am

    I think I spotted the discrepancy, the xml file online has “label” instead of “title”. So should we change it to “label” or will you change the xml file to have a “title” attribute instead of “label”

  7. Alaric November 14th, 2008 12:42 am

    I’ve replaced it with “title”. I’ll also be uploading a new version of all the examples shortly.

  8. Michael R. February 19th, 2009 10:58 am

    When I use the server version of photos.xml at http://greenlike.com/flex/learning/projects/photogallery/photos.xml all is well. But if I use the local version some photos show up others are blank. This sounds similar to Neil’s problem of 7/22/08 but I do not get any error indication. It is a mistery to me that some photos work fine and others do not. If it helps Camel.jpg, Marble.jpg, and Mother.jpg are failing.

    Great Book.

    Thanks

    Michael

  9. Michael May 11th, 2009 9:17 am

    Hi Alaric,

    At the end of chapter 11, you mention that the back button on my browser should be active and move the photo gallery back through its history. This isn’t the case for me — the back and forward buttons are gray and inactive, no matter what I do. Is this browser specific?
    Thanks in advance.

  10. Alain October 14th, 2009 4:52 pm

    I always get this warning:
    unable to bind to property ‘title’ on class ‘XML’ (class is not an IEventDispatcher)
    which occurs on every property
    and even if I copy your last code…

    As a “flex-beginner” i have no idea how to solve this.
    there are some suggestions in forums but couldn’t figure it out…

    Thanks a lot

  11. Kathy November 20th, 2009 4:49 pm

    Hi,

    I purchased the book and am working my way through it. I am doing the photo gallery in chapter 11. I get this error when I try and run the first part of the gallery example:

    there is an error at line 9 of your MXML document:
    the content beginning “<
    " is not legal markup. Perhaps the "
    "(&#a;) character should be a letter

    I tried to re-do the project and got the same error. It will even do the error when I put an empty line at line 9.

    Can anyone help? What am I doing wrong? Will copy and paste the code

    <mx:Canvas
    label="List View"
    width="100%"
    height="100%"

    <mx:TileList id="photosTileList"
    width="100%"
    height="100%"

    Thanks so much for the help.

  12. Gary February 19th, 2010 7:40 pm

    I too am having problems with the history not working as described at the end of chapter 11, even after explicitly setting historyManagementEnabled=”true” in the TabNavigator. This problem does not appear to be browser specific. I could not find other references on this site. However, if you run the application from this site, clicking on PhotoGallery at the top of this page, you will see that it does work. I suspect it does not work for us in our development setting because the application is not being served by a web server, but just pointed to on the local file system by the browser. Lots of things don’t work when run this way.

    Cheers,
    Gary

Leave a reply