php v as3

coworker: “You have to base64_decode that string to get your xml”
me: “base what?”

This is really geeky, so I’ll spare you if you’re not interested.


1. open google, type base64_decode
2. First link is php’s base64_decode function
3. open jedit, type:

<?php
echo(base64_decode(’blahblah’);

4. Save file
5. Open file in web browser
6. Yay! It returns what I expected
total time: 5 minutes

Now to do it in actionscript 3

1. search as3 base64_decode, nothing good
2. search as3 base64 decode, still nothing
3. search actionscript bas64 decode
4. found the perfect thing on dynamicflash blog
5. site wasn’t working properly; couldn’t download files
6. found this but can’t figure out how to download file. Can’t copy/paste due to line numbers in code
7. go back to dynamicflash. Blog owner works for the company I work for
8. do internal search of the guy
9. IM him and hope that he’s still at work
10. he fixes the blog
11. download file
12. open flex builder, create new sandbox project
13. copy & paste in downloaded class files into project
14. type

package
{
import dynamicflash.util.Base64;
public class sandbox() {
trace(Base64.decode(’blahblah’));
}
}

15. Compile in debug (auto opens firefox)
16. Switch back to flex builder to see result of trace.
17. Yay it worked.
total time 1 hour

To be fair, Adobe app development is still “gorgeous sexy“, but sometimes it makes me want to punch something.

This entry was posted on Sunday, December 23rd, 2007 at 10:15 pm and is filed under geek. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

No Responses to “php v as3”

  1. Ed Finkler says:

    Yes. Yes yes yes.

    One beautiful thing about a popular, solutions-oriented open source language like PHP is that people have almost inevitably already solved the problem you have, and it’s usually pretty easy. It’s jarring to move between PHP and a closed, proprietary language like AS3 for this reason.

  2. Andrew Mager says:

    I love PHP more than I love most foods.

  3. Karen says:

    @Ed. It’s an interesting new experience that I’m slowly getting used to.
    @Andrew. I think I love most foods more than php :)

  4. Andrew Nesbitt says:

    http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/58407

    decode64.(”mystring”)
    :P

  5. Michael says:

    Umm mx.utils.Base64Encoder : http://livedocs.adobe.com/labs/flex3/langref/mx/utils/Base64Encoder.html ?

    Added in Flex 3, but quite usable.

  6. Jeremy Johnstone says:

    Here’s a link to something you will find very useful:

    http://metal.hurlant.com/blog/index.php?s=as3crypto

    Handles most of your encryption/decryption needs and also has a pretty slick Base64 class too. It’s written by my boss. I won’t name names since he doesn’t publicly use his name on the blog, but you know where to look it up. ;)
    Enjoy!

    -Jeremy

  7. Karen says:

    @Michael Thanks for the tip. Perhaps in the next release they’ll do decoding too.
    @Jeremy sweet :)

  8. Jamie says:

    @Ed, ActionScript is actually ECMA aka JavaScript which is an open standard. Flash is (correct me if I’m wrong) the only platform to fully support the entire ECMA standard.

  9. Kevin Western says:

    Who is still using PHP?!

    RoR is the future ;)

  10. Gavin Smith says:

    Glad to see another fellow blogger using jEdit. I do all my own development using just that single editor - powerful!

  11. Hans says:

    at the risk of sounding like a geek of the anal kind, i do believe you meant to write:
    echo ( base64_decode ( ’blahblah’ ) );

    *ducks*

    but, ya, php rocks :)

  12. Karen says:

    @Hans HAHAHA! but you’re wasting precious horizontal space! Though, that’s not nearly as bad as wasting vertical space:
    function
    {
    }

    vs

    function {
    }

Leave a Reply