Post by Phil / Oktober 23rd, 2009

Super simple Flash example of the Indexhibit frontend

Finally we finished the “super simple” Flash example of our frontend for Indexhibit.
You can read more about the whole Flash / Indexhibit story here, here and here or just grab the new files and try for yourself …

simple indexhibit example

The previous sources/example was ActionScript-only and had to be compiled using the Flex compiler – this one comes as a FLA-file with a few classes to back it up. But only two of those classes are really of any interest to you if you want to customize the whole thing visually.

SimpleExample.as (document-class set via properties panel in flash)
Exhibit.as (this one is linked to the exhibit movieclip in the library)

We tried to keep the example as basic as possible so there is no real “animation-mania” or something going on – some timeline tweenings, that’s all.

If you’re interested in building your own flash frontend for Indexhibit, just open the FLA-file and start from there … if you then still have any questions, don’t hesitate and leave us a comment.

Grab the sources here: http://apdevblog.com/examples/indexhibit_simple/src/apdev_ndxz_simple.zip
Or take another look at the example: http://apdevblog.com/examples/indexhibit_simple/

If you want to use your own Indexhibit installation and build a flash-frontend on top of that, you have to download the amf-package and put it in the root-directory of your webserver. change the dbaccess.php in the amf/includes folder to your database-name and -login … et voilà the remoting gateway should be running smoothly. The next thing you have to change is the SERVER_URL in the SimpleExample-class in Flash – it should be your server’s name not ours ;)

That’s it for now … cheers

1 Trackback

62 Comments

  1. lemathieuOktober 24th, 2009 / 09:33 / #785

    Super thanks man ! It will be easyer for “non-coders” we are.
    Thanks again.

  2. ZinkhOktober 24th, 2009 / 12:53 / #786

    Hi guys, really awesome piece of work,
    i’ve been waiting for this version since i’m not familiar with flex, and i have really basic knowledge of actionscript, on behalf of all newbies of the world, thanks for making it accessible for us.

    Since i don’t have much luck ( never happened to me things works out of the box…) i did everything you said to make it work, gateway works (after lot of messing and changing host), SimpleExample.as modified, but still i can’t gt it to work when hitting Ctrl+Enter on flash it gives me this:

    DEBUG: amf::RemoteGateway – call(com.apdevblog.examples.indexhibit.Indexhibit,getAllExhibits,null)
    INFO: amf::RemoteConnection – RemoteConnection()
    DEBUG: amf::RemoteGateway – _connection.call(com.apdevblog.examples.indexhibit.Indexhibit.getAllExhibits) [object RemoteConnection]
    DEBUG: amf::RemoteGateway – >>> callParams com.apdevblog.examples.indexhibit.Indexhibit.getAllExhibits,[object RemoteGateway]
    DEBUG: amf::RemoteGateway – onFault()

    and my exhibit doesn’t show up, you can see in my site http://zinkh.000fees.net
    i think it’s about the adress i type in SimpleExample.as none of the above or http://zinkh.000fees.net/htdocs/ don’t seem to work, do you have any clue about this?
    Thanks

  3. iwakamiOktober 24th, 2009 / 14:58 / #787

    Hey ppl!
    So, i’m revising the steps.

    I already have an indexhibit installation running, so grabbed the AMF package, inserted the database info, and thrown them into the main Public folder.

    I edited the FLA and changed the SERVER_URL reference to call my main URL, published the SWF, and thrown them together with the rest of the BIN folder into the main Public folder too…

    It didn’t worked – endless loading. I think i did installed it right at least 3 times… oh well, dunno, maybe i’ve missed something or it has to do with the fact that my server does not let me upload images since yesterday…

    Anyway, this work is beautiful and i hope it does crack for beautiful websites out there! :D

  4. PhilOktober 24th, 2009 / 15:30 / #788

    hi guys.
    happy that you’re actually trying to install this :)
    not so happy, that it’s not working :(

    for debugging websites that are using a cms (or other backend) it’s really helpful to use a network monitor to see what is going on between your site and the backend/database. we’re using charles proxy – you should try it.

    @zinkh
    looked at your URL with charles running in the background and the error the gateway throws is:

    “mysql_connect(): Unknown MySQL server host ‘ sql212.000fees.net’ (1)”
    i think you put the wrong db-server in the dbaccess.php.

    @iwakami
    you should also try debugging with charles – so you know what exactly the problem is and why the flash keeps showing you the loader.
    or you can post a test-url and i’ll have a look.

    hope this helps …!?
    phil

  5. iwakamiOktober 24th, 2009 / 16:27 / #789

    Thanks for the response Phil.
    I tried the Charles. I just get an error about the favicon… I’m assuming that does not harm the process.
    It just keeps loading… Could it be the server?!…

  6. PhilOktober 24th, 2009 / 17:01 / #790

    mmm … of course, it can always be the server, but the script doesn’t need much to be able to run …

    your charles response should look something like this.

  7. ZinkhOktober 24th, 2009 / 22:54 / #792

    Thanks Phil, you were absolutely right, there was a little space before the name of sql server that messed up everything. thanks so much, now i have to figure out why i can’t upload images…pfff, another big thank you.

  8. iwakamiOktober 25th, 2009 / 13:48 / #793

    It does not look like the pic you show… Looks a bit dryer than that. I also don’t know if i understand Charles… He is a very difficult person to deal with :)
    Anyway, the flash just stays there loading endlessly… :/

  9. iwakamiOktober 25th, 2009 / 13:50 / #794

    Oh! I dunno if this works for you to take a peak with Charles… But if you want you can go here http://www.ffall.org/index-swf.html.

  10. PhilOktober 25th, 2009 / 17:21 / #795

    hey … the problem is, that you are using two different domains:
    http://www.ffall.org and ffall.org (without www) … so flash thinks that you’re accessing data from another server and looks for a crossdomain.xml to grant that access … but because you don’t have a crossdomain.xml on your server, it denies the access. so just create a crossdomain.xml and put it in your webroot.

    and the other thing i saw is, that your url to the gateway is messed up:
    http://www.ffall.org/index-swf.htmlamf/gateway.php
    should look like this:
    http://www.ffall.org/amf/gateway.php

    phil

  11. iwakamiOktober 26th, 2009 / 09:56 / #799

    Yup! That was it. Thanks!
    I corrected the SERVER_URL information with a plain direct URL.
    And then created a crossdomain.xml :
    http://curtismorley.com/2007/09/01/flash-flex-tutorial-how-to-create-a-crossdomainxml-file/

    Things look ok. ExhibitVo catched things up.

    Now i have a problem with ImageVo – no images are show in the flash. I messed something with indexhibit for sure… i bet another install of indexhibit, from the raw, would clear things up… i think i’m going to create another indexhibit later today to compare… any ideas?

  12. PhilOktober 26th, 2009 / 11:21 / #800

    check the path to your pictures – could be different from the path we use with our indexhibit installation.
    your example is trying to access the images in the following folder:

    http://www.ffall.org/ndxz/files/gimgs/

    check if it’s the right one – if not, update the url in the ExhibitVo class (setImages method)

    loader.load(new URLRequest(SimpleExample.SERVER_URL + “ndxz/files/gimgs/th-” + img.file));

    phil

  13. iwakamiOktober 26th, 2009 / 15:52 / #801

    oh… :)

    Sorry, i guess we are moving to a unknown domain to me… I don’t know where to look or modify.

    But in the FLA the only references i got were:

    registerClassAlias(“com.apdevblog.examples.indexhibit.model.vo.ImageVo”, ImageVo);

    Where i assume you are declaring the ImageVo class. And here:

    exht.setImages(vo.images);

    Where i was hoping to found it a little more elaborate with references to URLs and so. But that is just me assuming. I have no experience with this kind of coding.

    Feel free to decide whether it is worth or not to follow this with a noob :) ahaha ;)

  14. gregOktober 27th, 2009 / 10:02 / #812

    hey phil

    great work!
    I got it running with the tweaks you mentioned.
    I’m looking forward to customize it but it’s pretty sophisticated stuff here since I’m more on the design side and haven’t jumped on the AS3 train yet. So I’m still trying to figure out how it works ;)

    @iwakami: You need to adjust the Exhibit class, not the ExhibitVo class.

  15. PhilNovember 2nd, 2009 / 09:38 / #819

    if there are still some questions left – don’t hesitate … that#S what we’re here for.

  16. SanderNovember 3rd, 2009 / 20:58 / #821

    Hi Phil,

    Apart from the fact it only loads, I get an error when publishing to .SWF

    The error is below. It refers to the SimpleExample.as, line 118

    1046: Type was not found or was not a compile-time constant: ServiceEvent.

  17. PhilNovember 4th, 2009 / 11:01 / #822

    @sander
    hi. when i open your URL, i get the following error:

    Fatal error: Uncaught exception 'VerboseException' with message 'session_start(): open(/home/18956/data/tmp/sess_a05f9710e5349677072999214cb5e02b, O_RDWR) failed: No such file or directory (2)' in /nfs/c04/h04/mnt/66645/domains/johnnorman.com/html/amf/core/amf/app/Filters.php:112
    Stack trace:
    #0 [internal function]: amfErrorHandler(2, 'session_start()...', '/nfs/c04/h04/mn...', 112, Array)
    #1 /nfs/c04/h04/mnt/66645/domains/johnnorman.com/html/amf/core/amf/app/Filters.php(112): session_start()
    #2 /nfs/c04/h04/mnt/66645/domains/johnnorman.com/html/amf/core/amf/app/Gateway.php(167): authenticationFilter(Object(AMFObject))
    #3 /nfs/c04/h04/mnt/66645/domains/johnnorman.com/html/amf/gateway.php(178): Gateway->service()
    #4 {main}
      thrown in /nfs/c04/h04/mnt/66645/domains/johnnorman.com/html/amf/core/amf/app/Filters.php on line 112
    
    Fatal error: Exception thrown without a stack frame in Unknown on line 0

    seems like there are problems initializing the session. but this normally has nothing to do with the amf …

    about the compile-time error: please check if your SimpleExample class still got the

    import com.apdevblog.events.amf.ServiceEvent;

    import statement at the top and if the class is really where it’s supposed to be (src/classes/com/apdevblog/events/amf/ServiceEvent).

    phil

  18. SanderNovember 4th, 2009 / 13:23 / #823

    Hi Phil,

    Thank you for looking. I don’t know the error means, but I think I’ll start fresh and see what happens.

    The compile-time error has been solved.

    Will get back soon. Love the work you guys do.

    gr,

    Sander

  19. BastiaanNovember 4th, 2009 / 17:11 / #824

    Hi Phil,

    First of all, thanks so much for developing this software, I’ve found your site yesterday and since then turned about 5 people on to using it for their showcases.

    I have everything up and running nicely (had to remove the .htaccess to make amf behave, did this break something?) at http://www.ekeler.com/bin.

    Like many people before me, the swf shows the loading bar for a long time but eventually does display all information properly. The thing is, if I run the SWF locally using the regular flash player but pointing it to my live indexhibit install, it works fine, snaps right into action. Running the local file in the browser (safari and firefox, OSX10.6) messes it up again: loads for a while, then displays correctly.
    I just can’t figure out what’s going wrong.

    I’ve been trying to use Charles to debug things but I’m not too familiar doing that so I’m not really getting anywhere. Would you have any ideas on what I’m missing?

  20. BastiaanNovember 4th, 2009 / 22:05 / #825

    Little update:

    The install is now at http://www.ekeler.com

    I’ve been sitting down with Charles and he tells me that gateway.php is passing through all content but takes about 17s to load (time out, I suppose). At the moment, the swf online doesn’t show content at all, the exact same file locally shows up right away. I’m stumped.

  21. PhilNovember 5th, 2009 / 00:00 / #827

    hi bastiaan …. mmmm, can’t really understand it myself!?
    it looks like the data is returned very fast but the call is only completed after waiting for 15sec more …!?
    deleting the .htaccess file can’t be the source of this – it only sets some debugging variables. but i’ll try and look into this issue tomorrow. hope to get some answers then :(

    phil

  22. BastiaanNovember 5th, 2009 / 01:23 / #829

    Hey Phil,

    Thanks for the reply! I’ve been looking into this some more and the same thing is happening for other installs at the same provider. I found a post somewhere on the amfphp forums talking about how zlib.output_compression being enabled can cause a 15sec delay when sending large arrays back to flash:

    http://sourceforge.net/projects/amfphp/forums/forum/247252/topic/1514055?message=3771856

    I’m not sure if this is the problem I’m dealing with and I’m having a hard time figuring it out. My site is hosted at some random web space I have no real control over. I would try turn the compression off in the main php.ini put sadly I have no access to that. I think there must be some way of overriding it in .htaccess but I get errors thrown(not allowed) when using php_flag (same reason I had to remove the file from amf before). I also tried switching it off at runtime in gateway.php:

    ini_set(‘zlib.output_compression’, ‘Off’);
    echo(ini_get(‘zlib.output_compression’)); //it’s Off

    but that doesn’t help and I’m not sure I’m doing this the right way anyway.

    And it still wouldn’t explain why running the swf locally works perfectly fine, using the exact same server / database.

    I guess I’ll sleep on it, maybe new ideas will come in the morning.

    Bas

  23. BastiaanNovember 5th, 2009 / 01:51 / #830

    As a final thought, Charles shows that the quick responses I get from running the swf locally are not compressed and the slow ones I get from running on the server are compressed in gzip. This would somehow relate to the issue I mentioned above so that may be it? I’ll have to look at the phpinfo of some friends tomorrow to find out or maybe someone on here can check things out.

    Or.. I can check myself of course with my new friend Charlie. Seems the example on apdevblog has no compression but the one on http://zinkh.000fees.net/ does and also works fine. So, meh.

    Bas

  24. PhilNovember 5th, 2009 / 16:22 / #831

    hi. i also couldn’t find a solution for the timeout-problem … stumbled upon this article (http://www.thebroth.com/blog/205/flashamfphp-data-transfer-using-strings-is-fastest) but never found amfphp’s enableGzipCompression function they are talking about.
    instead of looking further into amfphp i decided to try the other amf-php-solution using zendamf (http://framework.zend.com/download/amf). so maybe the problems will go away when you try this gateway.
    you can download the new backend-code here:
    http://apdevblog.com/examples/indexhibit_simple/src/apdev_indexhibit_zend.zip
    unpack and copy the zend-folder into your webroot. the only actionscript code you have to change are the lines 49 and 77 of the SimpleExample.as.

    49:   public static const SERVICE_URL:String = "Indexhibit";
    
    77:   _gateway = new RemoteGateway(SERVER_URL + "zend/gateway.php");
    

    hope this works better than the amfphp version (for those of you having problems).

    phil

  25. BastiaanNovember 5th, 2009 / 16:48 / #833

    Hey Phil,

    It’s working great now! http://www.ekeler.com, up and running smoothly!
    Zend really did the trick, I’m not sure what about the whole compression stuff turned out to mess things up but Zend seems to fix everything.
    Thanks a lot for the quick response, you really helped me out, along with some guys around me having the same problem.

    Bas

  26. PhilNovember 5th, 2009 / 17:41 / #835

    glad i could help :)

  27. YBNovember 19th, 2009 / 09:33 / #841

    Hi Phil

    First of all this use of indexhibit as a CMS is great!
    I am a novice with code so I am not too sure that I have the right set up.
    first, where do you place the files on the FTP? should they be all in the same folder? also what files should you upload to the FTP, this is a bit confusing. I have a similar problem as a user above, the flash page loads but constantly “loading”

    Thank you!

  28. PhilNovember 19th, 2009 / 16:46 / #844

    hi YB,
    did you read the installation guide? if not, check it out … hopefully it’ll help.

    phil

  29. YBNovember 19th, 2009 / 23:36 / #845

    Hi Phil I did but I thought that was only for Flex now using via FLA file. I will try this tonight and see if it works.

    Thank You

  30. YBNovember 24th, 2009 / 06:37 / #846

    Hi Phil

    Any possibility of another post with a more description of how to get this set up to work?

  31. PhilNovember 25th, 2009 / 00:59 / #856

    hi YB.
    what exactly is the problem you’re running into?
    do you have a test-url i can take a look at and see for myself?

    phil

  32. YBNovember 26th, 2009 / 05:51 / #859

    Hi Phil

    I cannot get the info from my indexhibit to read into flash

    this is my test indexhibit:
    http://farmlandmedia.net/urbana/

    Flash site I would like info to be read to:
    http://test10.farmlandmedia.net/

    Thank you

  33. PhilNovember 28th, 2009 / 10:36 / #860

    hi YB,
    first thing i realized while looking at your examples is, that they are on different domains. if you want to access a script on another domain, flash will look for a crossdomain.xml file on the server you want to access – in your case this file is missing (http://farmlandmedia.net/crossdomain.xml not found).
    iwakami had the same problem and found a solution here:
    http://apdevblog.com/super-simple-flash-example-of-the-indexhibit-frontend/comment-page-1/#comment-799

    maybe after creating such a crossdomain.xml, everything will work …
    otherwise i will take a look again :)

    cheers
    phil

  34. ARDezember 27th, 2009 / 03:11 / #881

    Hi there,
    i have the same problem as YB and have created a crossdomain.xml file in (http://yourdomain.com/crossdomain.xml) Now in charles its picking up the host as apdevblog.com and path crossdomain.xml any reason why this is happening, as i have my own crossdomain.xml at my server.

    where can i modify this so it calls my crossdomain.xml?

    cheers

  35. PhilDezember 27th, 2009 / 11:15 / #883

    hi AR,
    did you change the first line in the SimpleExample.as?

    public static const SERVER_URL:String = 
    "http://apdevblog.com/indexhibit/";

    should be sth like:

    public static const SERVER_URL:String = 
    "http://yourdomain.com/indexhibit/";

    otherwise your example is still trying to talk to our gateway.

    phil

  36. sergeyJanuar 7th, 2010 / 11:51 / #934

    hello
    thank you for your work

    but installation description still seems to be difficult for me

    the default folder for indexhibit is /ndxz-studio in the root folder, so there is my ind.e. installed; i uploaded /amf folder to root and set db passwords there; then i changed simpleExample.as, after that i runned ndxz.fla and got next:

    DEBUG: amf::RemoteGateway – call(com.apdevblog.examples.indexhibit.Indexhibit,getAllExhibits,null)
    INFO: amf::RemoteConnection – RemoteConnection()
    DEBUG: amf::RemoteGateway – _connection.call(com.apdevblog.examples.indexhibit.Indexhibit.getAllExhibits) [object RemoteConnection]
    DEBUG: amf::RemoteGateway – >>> callParams com.apdevblog.examples.indexhibit.Indexhibit.getAllExhibits,[object RemoteGateway]
    Error opening URL ‘http://sergeysommer.com/amf/gateway.php’
    DEBUG: amf::RemoteGateway – onNetStatus() NetConnection.Call.Failed error

    *** ERROR *** com.apdevblog.amf::RemoteGateway ***
    Problems communicating with remote gateway!

    my site is http://www.sergeysommer.com

    i used crossdomain xml to make http://www=http://

    thank you for your time

  37. PhilJanuar 10th, 2010 / 23:14 / #945

    hello sergey.
    i tried the URL you supplied isn’t working (http://sergeysommer.com/amf/gateway.php). i think it’s because of the url_rewrite or the file is just not there …

    could u check this?

  38. sergeyJanuar 11th, 2010 / 01:13 / #947

    hi again

    hm strange things
    i fixed the access to http://sergeysommer.com/amf/gateway.php
    its okay now
    but i’m still geting:

    DEBUG: amf::RemoteGateway – call(com.apdevblog.examples.indexhibit.Indexhibit,getAllExhibits,null)
    INFO: amf::RemoteConnection – RemoteConnection()
    DEBUG: amf::RemoteGateway – _connection.call(com.apdevblog.examples.indexhibit.Indexhibit.getAllExhibits) [object RemoteConnection]
    DEBUG: amf::RemoteGateway – >>> callParams com.apdevblog.examples.indexhibit.Indexhibit.getAllExhibits,[object RemoteGateway]
    Error opening URL ‘http://www.sergeysommer.com/amf/gateway.php’
    DEBUG: amf::RemoteGateway – onNetStatus() NetConnection.Call.Failed error

    *** ERROR *** com.apdevblog.amf::RemoteGateway ***
    Problems communicating with remote gateway!

    on cmd+enter.

    i entered “http://sergeysommer.com” for server-url
    copied /amf/ to root of sergeysommer.com
    created crossdomain.xml in the root
    indexhibit files are in sergeysommer.com/-/ndxz-studio/ folder

    what am i doing wrong? maybe i forgot something?

    please help!!!

  39. sergeyJanuar 11th, 2010 / 01:43 / #948

    ooops something wrong anyway

    Internal Server Error
    http://sergeysommer.com/amf/gateway.php

    …will ask host:)

  40. ChristianJanuar 11th, 2010 / 17:50 / #950

    Can you guys make a simple step by step install / how to use for dummies…
    I’m clearing a dummy, i don’t get this.

    So many different version and things mentioned in the different versions on the blog here. I have been reading back and furth between them, and just end up getting more and confusing. Every time i download new sources and stuff.

  41. PhilJanuar 12th, 2010 / 09:52 / #954

    @sergey
    the amf gateway seems to be running correctly now. did you try it again?
    will check it this evening …

    @christian
    if you’re still trying to get this up ‘n’ running, start by copying our amf-files to the root-folder of your server (changing the database access variables first of course) and change the URL in the example flashpage. it should get your content and display it inside the example template … this would be the first step.

  42. ThomasJanuar 14th, 2010 / 14:04 / #965

    is there any one that will help me to put my flash website into Indexhibit, for a small amount of $ $?

    Bedst regards Thomas

  43. AronJanuar 19th, 2010 / 18:01 / #971

    @Tomas I’m afraid we currently do not have the resources for custom work. Maybe you can find someone in the Indexhibit forums…? (Sorry, for getting back to you that late)

  44. BillyJanuar 20th, 2010 / 19:06 / #974

    Hi Phil and Aron,

    Thanks for the front end for indexhibit. It has been a life saver for my semester :). However, there is one thing I can’t seem to figure out.

    http://www.bllly.nl works like a charm.

    http://blly.nl however doesn’t. It loads the same index.html page, but there seems to be a problem with:

    public static const SERVER_URL:String = “http://www.bllly.nl/”;

    in the actionscript code. I know it is possible, http://lisahoerterer.de/ and http://www.lisahoerterer.de/ both work.

    Can you please give me some pointers in the right direction!

    Awesome work!
    Billy

  45. PhilJanuar 24th, 2010 / 12:33 / #980

    hi billy,
    sorry you had to wait so long for a reply – we’re kinda busy these days.
    it’s just a small problem you got there – you can either put a crossdomain.xml in the root folder of your server or check which domain was called by the user and change the SERVER_URL accordingly.

    if(url.indexOf("bllln.com") != -1) 
    {
      _homeDir = "http://bllln.com/";
      if(url.indexOf("www.") != -1)
      {
        _homeDir = "http://www.bllln.com/";
      }
    }
    

    hope this helps.
    phil

  46. BillyJanuar 25th, 2010 / 10:15 / #982

    Thanks for replying. A quick change of crossdomain.xml did the trick.

  47. DanFebruar 6th, 2010 / 14:11 / #1009

    Hi

    Thanks for making this flash frontend for indexhibit, opens up a lot of possibilities!
    I have a question about the latest example. The objects in flash are placed randomly via a math round random script. Is it possible to place them neatly in a row (like in the other example) with specific margins between them? I’m not much of a scripter myself, so if you could point me in the right direction, it would be great!

  48. BrianFebruar 24th, 2010 / 18:09 / #1020

    Hey Phil,

    I have everything installed, but for one; I can’t get the flash side of indexhibit even load when the page loads, and two, when opened and previewed in flash, I can’t get anything to load and it says, like above, that there is an error and cannot connect to the remotegateway.

    Any help? Been looking through all the threads and can’t seem to figure it out.

    Thanks!

    Brian

  49. PhilMärz 1st, 2010 / 09:26 / #1023

    hi brian,
    could you post a more detailed error description?! did you install charles to check what the problem is?

    cheers phil

  50. mawksyApril 18th, 2010 / 21:45 / #1043

    Hey guys! I been reading your stuff over and over and loosing sleep. I get the endless loading like most users, and the flash compile errors:

    COMPILER Window:
    Warning: 1090: Migration issue: The onMouseUp event handler is not triggered automatically by Flash Player at run time in ActionScript 3.0. You must first register this handler for the event using addEventListener ( ‘mouseUp’, callback_handler).

Post a comment