dcsimg
A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 24

Thread: An answer to AS3 AMFPHP problems.

  1. #1
    Senior Member joshstrike's Avatar
    Join Date
    Jan 2001
    Location
    Alhama de Granada, España
    Posts
    1,131

    An answer to AS3 AMFPHP problems.

    This post contains a class package to simplify remoting in CS3.

    I was really t/o'd that there's no NetConnectionDebugger in CS3, and I'm sure Adobe's gonna try and scalp people for it when it comes out.

    I was also really unhappy that variables coming back from the NetConnection result now are not strong typed; they just come back as objects; this is especially a problem w/ RecordSets, since those objects can no longer simply be dumped into DataProviders if you just need to throw a mySQL result set into a table in Flash.

    So I wrote this little package you all might enjoy, which does all the above and makes AMFPHP remoting once again as easy as it was under AS2, so you can make PHP calls with a single, simple line of AS3 code. It also provides a window that runs IN YOUR MOVIE (can be turned on or off, or hidden when it's on) that works like the NetConnectionDebugger, showing you all the calls, results and errors.

    I needed to learn AS3, so this was my warm-up project. I hope you enjoy it, and please give feedback!

    Download the package and example at: http://www.joshstrike.com/strike_remoting.zip

    Cheers,
    Josh

  2. #2
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    My first feedback: thanks
    - The right of the People to create Flash movies shall not be infringed. -
    | www.Flashscript.biz | Flashscript Biz Classes/Components |

  3. #3
    Senior Member joshstrike's Avatar
    Join Date
    Jan 2001
    Location
    Alhama de Granada, España
    Posts
    1,131
    Yay! happy customer #1. =)

  4. #4
    Member
    Join Date
    Dec 2006
    Posts
    39
    very nice.

  5. #5
    Senior Member joshstrike's Avatar
    Join Date
    Jan 2001
    Location
    Alhama de Granada, España
    Posts
    1,131
    update
    I've made some improvements to the code, so that SQL result sets are now properly parsed up to one level deep in an array returned from PHP. I've gotten the sense that a lot of people out there are using the package...I highly recommend anyone relying on it download it again (the new version has replaced the old at the same address:
    http://www.joshstrike.com/strike_remoting.zip
    Cheers,
    Josh

  6. #6
    Member
    Join Date
    Apr 2004
    Posts
    78
    joshstrike you're making my life too easy!!!

    Thanks man! You ROCK!!!

    L

  7. #7
    Senior Member joshstrike's Avatar
    Join Date
    Jan 2001
    Location
    Alhama de Granada, España
    Posts
    1,131

    Exclamation Update 1.2 Critical Bugs Fixed

    Hey to all who are using my remoting package!

    It came to my attention that the package was creating dreaded memory leak over time when dealing with large datasets. phpCall instances were accumulating unintentionally. Since this package was intended to be used in business environments, this was completely unacceptable.

    I urge anyone using this package to upgrade to the new version (1.2), now downloadable at:

    http://www.joshstrike.com/strike_remoting.zip

    It fixes the above issue and also some graphics bugs. It requires you to change your initial phpAccess call to specify the stage width, height, and maximum number of calls to be held on the record, but those are the only changes you'll need to make to your code.

    Also, if you're using this package, I'd recommend subscribing to this thread as this is where I'll be posting any future updates.

    Cheers,
    Josh

  8. #8
    Junior Member
    Join Date
    Oct 2003
    Posts
    3
    Hey Josh
    Your strike_remoting.zip doesn't work properly.
    your genericService.php does nothing. maybe you should change it to genericEvent.
    what is with the output: genericQ and genericQA? Your method table seems to be wrong too.
    I hope you update your package soon.

    btw i'm using xampp PHP 5.2.2,
    and AMFPHP 1.9 second BETA.

    .. and the last. your websites mail/feedback from doesn't work either.

    To bad i can't see your MAGIC!

    Cheers

  9. #9
    Senior Member joshstrike's Avatar
    Join Date
    Jan 2001
    Location
    Alhama de Granada, España
    Posts
    1,131
    The PHP code and the FLA are just an example written to show you how to use the classes for yourself. I don't even know if the example is calling the right Service in the last update. It doesn't matter, since you don't have a database set up by that name with those tables, etc.; in short, you're not supposed to use the stupid example; it's just there to SHOW YOU how to call the classes. There's nothing wrong with the method table in the PHP example, except you don't need it if you're running AMFPHP > 1.2. Yeah, the webmail thing doesn't work. Who cares. I don't need mail from people like you. "To (sic) bad i can't see your MAGIC!" You got a bad attitude for somebody who wants to use my sh*t for free. I'm here to help anybody that has a serious problem using the package or finds any bugs.
    Josh

  10. #10
    11 Years Old Boya
    Join Date
    Apr 2004
    Posts
    61
    Hey Josh, I'm stucky!

    Here's my code:

    Code:
    this.cc = new phpCall(p, this.gotResponse,"genericEvent.sqlQuery",'SELECT * FROM help_category');
    I'm testing it on 'mysql' database, which is created with the installation of mysql 5. However it never call the gotResponse function, why?

    And I'm new to amfphp, but I think I get the basic concept, just don't understand why this doesn't work.

    Thanks
    Checkout my site:
    Click HERE
    Checkout my games:
    Oops! No game for now!

  11. #11
    11 Years Old Boya
    Join Date
    Apr 2004
    Posts
    61
    Did anyone atleast get it to work? Like recieve database data?
    I really need to know if this thing even works.

    Thanks
    Checkout my site:
    Click HERE
    Checkout my games:
    Oops! No game for now!

  12. #12
    if($<0){WelcomeToMyWorld} joshchernoff's Avatar
    Join Date
    Jul 2005
    Location
    Portland
    Posts
    321
    First I want to say nice work with your remoting framework, it shows quality and talent and I use your convertData function to make Dataproviders all the time. But your package naming conventions are driving me NUTS! try "com.joshstrike.remoting". My actionscript directory is full of about 100 frameworks and yours in the only one I have that is worth putting in there but does not follow convention. Just a thought for 1.4

    On a side note: Have you thought to simplify your framework. If so check out http://osflash.org/as3lrf#as3_lightw...ting_framework it may serve as a good example.

    I will have to upload my framework when I'm done and show you how I have took the best of your framework and danny patterson's framework to make a hole new framework that feels almost complete. But I'm waiting for amfphp2 to come out so I can address the new setCredentials for authentication.

  13. #13
    Senior Member joshstrike's Avatar
    Join Date
    Jan 2001
    Location
    Alhama de Granada, España
    Posts
    1,131
    Sorry, I haven't been following this thread for awhile,
    Josh man... I'm really not sure what's wrong with the naming convention. I mean the only plug-n-play package I've ever used for more than one project besides my own is Away3D... just put it in the project folder and import PHPRemoting.* ... is that really bad?
    Since writing 1.3 and adding the singleton setup, I've done a new version that checks for disconnects, catches errors, and retries calls that pile up...since I'm doing a lot of networked game development right now...so my framework's getting heavier, not lighter, and I'm not sure if there's a 1.4 in it that would be useful to most people. So I'd love to see what you're working on. There are so many ways this could have been set up, and honestly I wrote it to my own idiosyncratic needs and only afterwards made it public more as a goodwill gesture and out of spite towards Adobe, than for any other reason...
    I'm actually running it now w/ AMF3 ... in spite of some serious problems with AMFPHP 1.9 in that area, I've modded the gateway code and tweaked it to work...I'm looking forward to AMFPHP 2 as much as anybody, if it ever shows up.
    Anyway, thanks for the kind words.
    Josh

  14. #14
    if($<0){WelcomeToMyWorld} joshchernoff's Avatar
    Join Date
    Jul 2005
    Location
    Portland
    Posts
    321
    A side from the nice job you have done with your frame work have you played with any other frameworks like the one I mentioned before.

    edit: Hows your action script directory set up like? When you use other frameworks like papervision or adobe core libs your source code will pile up fast.
    I edited your package path on your classes to look like this.

    code:

    package com.joshstrike.remoting{



    as well I have your classes stored in my main Action Script directory as such.
    Code:
    com
         joshstrike
                      remoting
                                  PHPAccess.as
                                  PHPResult.as
                                  ResViewer.as
                                  PHPCall.as
                                  Remoting.as
    This is a big help if you ever want to modify other people code or if you have a lot of classes stored in one place.

    Sorry if I am coming down on you, it's just that some one of your capability should be practicing convention.
    Last edited by joshchernoff; 01-16-2008 at 11:47 PM.

  15. #15
    Senior Member joshstrike's Avatar
    Join Date
    Jan 2001
    Location
    Alhama de Granada, España
    Posts
    1,131
    It's weird, I uh...never have had a com folder on any of my projects. I mean, I have projects routinely with 50 to 100 classes; I usually just separate them into components, modules, plus my reusable core classes which I set up under core. components, newGeometry, etc. ... plus PHPRemoting.
    I should kind of note that I almost never just import .* ...I'm really concerned with memory management and only import the exact classes I need, including display classes, errors and events...so maybe that's why I look at it as less important...?
    But yeah, I dig, I should make them standard...sigh. I wonder how many people are actually using this package. From the majority of emails I get it's either that people can't figure out the example or think I should drastically modify this that or something... My attitude is, I solved half the problem... people gotta make it work for their own needs. But enough ranting...I concede. If I do put out another version, I'll follow the naming protocols, since it sounds like it could be an irritating issue for people...

  16. #16
    if($<0){WelcomeToMyWorld} joshchernoff's Avatar
    Join Date
    Jul 2005
    Location
    Portland
    Posts
    321
    it's not so much a problem it just helps code faster. For example I use flash developer 3 and just like in flex I can get code hinting. So say I type "com" in the action script then I will get a code hint with all the packages listed in my com folder. It's really just about organization and speed of typing.

    I have posted a simple mod of the AS3 light remoting framework that uses your for loop to make datatypes. Have a look at
    http://gfxcomplex.com/blog/amfphp/as...e-mod-beta-01/

  17. #17
    Senior Member joshstrike's Avatar
    Join Date
    Jan 2001
    Location
    Alhama de Granada, España
    Posts
    1,131
    Edit.
    Now that I think of it, I've had nothing but negativity from all of this. It's the only piece of code I put up for other ppl and... it doesn't come with a guarantee, man I mean people can modify it however they want...some people use com packages and some don't, some people don't know PHP and by putting up my code it isn't my responsibility to teach them how to use it; the whole damn thing has left me with a bad taste in my mouth and I don't see myself putting up a lot of other classes or components for public consumption; I've never had a paying client nearly as shrill as some of the people who've used my code for free and then demand all kinds of crap out of me that was never promised or implied by their use of this stupid little bit of code. I don't work well with others; I care about making things work, and work right; but not about other peoples' difficulty in making things work. I should just say: It works. Use it how you want it, use it at your own risk, and get it fast since I'm a moody **** and pro'lly gonna pull it off my site soon.
    I know that's really harsh, I ain't mad at you for suggesting this change; I'm actually glad to know it and file it in my mind and I'm not raging on you... I'm just mad at the general neediness I've gotten in dozens of emails about it and, I think, I've finally lost it.

  18. #18
    if($<0){WelcomeToMyWorld} joshchernoff's Avatar
    Join Date
    Jul 2005
    Location
    Portland
    Posts
    321
    I realy hope you didnt take that the wrong way man. I was looking at it like one pro to another.

    I know you dont need to help others. My suggestion was only to help you. After all I knew to change it the way that suited me best. I can just tell by the way you code that you are not used to doing things that way. I was only looking to help you so you can become a better programmer. Not that you really needed it.

    There a lot of free powerful code out there and almost all of it requires that basic knowledge of package directory naming convention.

    As far as other people, thats life in the spot light and aside from only one other person you made what no one else would. Sorry if I rubbed you wrong.

  19. #19
    Senior Member joshstrike's Avatar
    Join Date
    Jan 2001
    Location
    Alhama de Granada, España
    Posts
    1,131
    no listen man...I'm sorry. I'm being a jackass and you deserved way better than that. This got me to go back and read some of the emails that came to me out of this project...I had a couple people mod the code in some neat ways and send them to me, and that was very positive; I helped a few people learn how to open mysql connections from PHP, which I guess was doing something good for the world, depending on how you look at it.

    I checked out Danny Patterson's code and I dig it, it looks solid; he didn't tackle the problem of parsing more than one returned mysql result set out of a single array, which was something that honestly still isn't 100% reliable in my package (although that, it turns out, is due to an AMFPHP error that sometimes crosses columns from one recordset with another if the columns have the same name and they're returned in the same result array)... still, I rely on returning multiple result sets a lot, with the caveat that they shouldn't be from similar tables, and holding my breath for AMFPHP to sort that one out. It's faster than looping through a mysql_fetch_assoc all the time. Again, nonstandard, but works for me. His use of timeouts in the OperationPool is a weird mirror image of what I've been working on in the latest rev's for tracking disconnects; except I batch call everything. His structure is substantially cleaner and lighter-weight, although he doesn't have the overhead of the viewer window which I don't think I could survive without, and which, silly enough to say, was the only reason I wrote the package in the first place, rather than using Oscar Trelles' simple example of opening AS3 calls to AMFPHP. The desire for that window dictated the relationships between classes in the package for me, which is why it's a bit structurally weird.

    Anyway, again, I'm really sorry for overreacting. I have a sharp tongue, and a love/hate relationship with my clients for that reason...up to and including telling them to "keep their goddamn religion to themselves" and flat refusing to work for people based on any number of tangential and irrational criteria, I admit, I'm a pain in the ass. And I'm resistant to change, but it's not that I'm unwilling to learn or think I know better than other people; I'm always learning from what people show me and what I read, code and otherwise; I change and improve constantly, but I have to resist it first or I feel I've somehow not completed the argument.

    In short, I'm just extremely impatient, and it's something I'm trying to overcome. But I didn't know what I was getting myself into when I posted the code to the world...it's been more than I meant to chew. Just so you know, you didn't rub me the wrong way. Actually, I'd really like to see your code when you're done, and I'm kinda hoping you can take the pressure off me and be the guy people email when things go wrong with their remoting projects... lol

  20. #20
    if($<0){WelcomeToMyWorld} joshchernoff's Avatar
    Join Date
    Jul 2005
    Location
    Portland
    Posts
    321
    ooooohhhh wait you bring up a good point. I dont like email too! I...... might have to rethink this Hole thing. lol
    NOT.

    I feel you. I bet every one in your family calls you when they break there computer too!

    As for what I'm doing it's nothing more then just trying to mend the best of the two ONLY remoting frameworks out there. Though at the moment I have been having a problem with the Operation class due to a dispatch event redispatching and changing my result Object in to an Array datatype.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center