Welcome, Guest
  • Author Topic: Saving data from Flash AS2  (Read 2317 times)

    roger.oblivion

    • Server what's that
    • *
    • Posts: 9
      • View Profile
      • Email
    Saving data from Flash AS2
    « on: 10/27/09, 06:24 »
    Hello, I'm trying out the AS2 Saving data from Flash to DB tutorial.

    http://www.flash-db.com/Tutorials/saving/savingData.php?page=1

    Everything worked out OK; data was saved in corresponding columns in MysSQL table.

    Only I have another file with a combobox which displays these values back in Flash.

    The problem is it doesnt display the new entry correctly.

    This is whats displayed instead of my data:
     ,,

    And I know its not my combo since it works if I enter data manually in phpMyAdmin.

    I dont know if itas a problem with reading PHP to and from...

    Maybe my question is outside the scope of this tutorial, but I really need to get this working..

    I would really appreciate any help with this issue..

    Thank You!!

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: Saving data from Flash AS2
    « Reply #1 on: 10/27/09, 07:52 »
    Hello and welcome roger to the boards.

    Somehow the script does not deliver, what you expect it to.
    Did you try to call the php script with the browser?
    Did you use Charles to findout what the script returns?
    can you give us a life link to have a look?
    happy flashing
    8)
    Ronald

    roger.oblivion

    • Server what's that
    • *
    • Posts: 9
      • View Profile
      • Email
    Re: Saving data from Flash AS2
    « Reply #2 on: 10/31/09, 11:54 »
    Hello Ronald,
    and thanks for your quick reply.

    Ill try to explain in more detail what im trying to do:
    I need to create a product catalogue wich displays records from DB table into Flash using PHP.
    In Flash I have a combobox that displays all available categories for these products (products.swf).
    New products will be added to corresponding categories through another Flash file (save_products.swf).
    Maybe new categories will be added too.

    Whenever I add a new entry, send and load back in Flash, the data for that corresponding row is truncated.
    I rechecked as you suggested by calling php script and found the source of this problem:

    The ID which is set to Auto Increment was delivering the results in a non-sequential way, something like this (id1, id2, id3, id6, id7, etc.)
    (products.swf loads these arrays in sequence). 

    So that's why I was getting these: ",, " empty fields in my combobox, because I had previously deleted rows 4 and 5.

    Now, the only solution I found was to do a query in phpMyAdim like this:

    ALTER TABLE `products_table` AUTO_INCREMENT =4

    Things are now back to normal but I'm a little worried about what could happen later on when i have tons of products and some rows need to be deleted.
    Also I find it upsetting that phpMyAdmin doesn't do this automatically.

    So my question now is if there is a way to avoid resetting ID manually every time a product is deleted, maybe there is a PHP script for this or maybe I have to change the way my combobox receives the data.
    It seems like I solved one problem only to find another.

    I would really appreciate any suggestions you might have as to what can be done.

    Thanks in advance!!

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: Saving data from Flash AS2
    « Reply #3 on: 10/31/09, 12:01 »
    suggestion:

    look into flash remoting with php using AMFPHP.

    Your problem are large and still growing strings.

    With AMFPHP you can transfer complete object structures.
    happy flashing
    8)
    Ronald

    roger.oblivion

    • Server what's that
    • *
    • Posts: 9
      • View Profile
      • Email
    Re: Saving data from Flash AS2
    « Reply #4 on: 11/01/09, 06:45 »
    Initially I was debating wether to use Flash Remoting or doing the old way.
    Since I have no experience whatsoever with Remoting and AMFPHP I opted for the later.
    Maybe I chose the wrong path for this proyect.
    I will look into this and hopefully some day I'll do something useful with it.

    But for now I would really like to find a more emediate solution since I have little time.
    At this stage the least of my problems is the issue with AutoIncrement.
    I have yet to add full functionality to this catalog for displaying multiple products.
    I will create a new thread for this and hopefully you can help me out.
    Really appreciate you answering my noobie questions.

    Thanx!

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: Saving data from Flash AS2
    « Reply #5 on: 11/01/09, 10:13 »
    Just have a look into the loading and saving tutorials from Jorge.
    You will see, you are ready to run within notime.
    AMFPHP ist straight forward - it only might look complicated at the first glance.
    If you lnow php, and you are ok with AS, AMFPHP goes seamles into it.
    happy flashing
    8)
    Ronald

    roger.oblivion

    • Server what's that
    • *
    • Posts: 9
      • View Profile
      • Email
    Re: Saving data from Flash AS2
    « Reply #6 on: 11/10/09, 06:49 »
    Hey Ronald, I took your advice and looked into AMFPHP and Remoting, and guess what?.... It's f***in awesome!!! :D
    Setup was ridiculously easy. In a flash I had my PHP scripts up and running. Only thing that boggled my mind is why the hell did Adobe leave the Remoting Class out of CS3. Luckily I had a copy of MX 2004 in my installers folder and used the same path. I've been customizing some of Jorge's applications and had a few questions for ya. Just let me know if I should post them in this thread or create a new one. Wouldn't want to break any rules hehe. Thanks again for being so persistent ... could have taken centuries before I opened my eyes.. lol!!