Simply Program

Simply programming - It’s a life style
Filed under Programming, ActionScript, PHP

Well - LJ has returned from Vacation and has finally launched the new "Flash" version of BuzzPlay.com.

Check it out here: http://www.buzzplay.com

Now, why am I posting about this? Simple - I did all the programming for the site. This was my first major Flash (ActionScript) job. I used it as a test to see how effective I am in ActionScript. I was able to developed the whole system within a couple days, it wasn't all that hard.

What was the hardest aspect of the site?
What a great question Aaron :)

That hardest part was when he wanted the user to "stay" logged into their account while moving to completly seperate pages on the site (which where all in flash). I figured this out useing loadVars.

Actionscript:
  1. loadVars();

When the user logged into their account I sent their information to a php script and created a session, on every other page I used AS to pull that session information and allowed me to pull their account on every page. Pretty nifty I think.
Heres the code I used - very basic and simple(HINT: Put in error checks and variable validation)

Actionscript:
  1. var artistName="";
  2. var myID=0;
  3. var checkLogin = new LoadVars();
  4. checkLogin.onLoad = function (success:Boolean){
  5. if(success){
  6. if(checkLogin.myID!=""){
  7. _root.myID=checkLogin.myID;
  8. gotoAndStop(2);
  9. }else{
  10. //gotoAndStop(2);
  11. //LOGIN SCRIPT  - OR REDIRECT
  12.  
  13. }
  14. }else{
  15. //gotoAndStop(2);
  16. //LOGIN SCRIPT  - OR REDIRECT
  17. }
  18. }
  19. checkLogin.load("checkLogin.php");
  20. stop();

Here is the PHP Code:

PHP:
  1. //Include your db info and all that good stuff.(error checking)
  2.  
  3. echo "myID=".$_SESSION[userId];
  4. ?>

You can place the AS script in the first frame of all your files... works very well ;)

Support Our Sponsors!

Posted by sp on Monday, September 25th, 2006


You can follow any responses to this entry through the magic of "RSS 2.0" and leave a trackback from your own site.