SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Member
    Join Date
    Nov 2012
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Flash CS6 via php

    Hello Everybody,
    I am attempting to create a Flash login via the mysql database. I have created a database in mysql and I have edited two files fla in flash and a php file using notepad text editor. I want to send my URLVariables to the php script to check the variables stored in the mysql database. Problem is i am getting no information back.

    This is my fla code below: Can you please check my code for any mistakes. I copied this majority of the code from a tutorial. I am wondering if my connection url parameter to the php connection file is correct?

    Code:
    import flash.net.URLRequest;
    import flash.net.URLVariables;
    import flash.net.URLLoader;
    import fl.controls.Button;
    import fl.controls.TextInput;
    import flash.text.TextFormat;
    import flash.events.Event;
    
    //Requesting the php
    var phpFileRequest:URLRequest = new URLRequest(".flashexample/");
    
    phpFileRequest.method = URLRequestMethod.POST;
    
    //Assing the variable names
    //Build the variable
    var phpVars:URLVariables = new URLVariables();
    
    //Building the loader
    var phpLoader:URLLoader = new URLLoader();
    phpLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
    
    //Variables ready for sending
    phpVars.email = email.text;
    phpVars.password = password.text;
    
    
    phpLoader.load(phpFileRequest);
    
    phpLoader.addEventListener(Event.COMPLETE, showResult);
    
    function showResult (event:Event):void {
    
    statusTxt.text = "" + event.target.data.systemResult;
    trace(event.target.data.systemResult);
    
    }
    
    var mybutton:Button = new Button();
    mybutton.toggle = true;
    mybutton.x = 125;
    mybutton.y = 110;
    mybutton.width = 21;
    mybutton.height = 11;
    mybutton.label = "Send";
    mybutton.buttonMode = true;
    addChild(mybutton);
    
    var tf:TextFormat = new TextFormat();
    tf.font = "Arial";
    tf.size = 16;
    tf.color = 0x000000;
    
    
    var ti:TextInput = new TextInput();
    ti.x = 93.35;
    ti.y = 73.35;
    ti.width = 172.00;
    ti.height = 22.00;
    ti.editable = true;
    ti.enabled = true;
    ti.setStyle("textFormat", tf);
    addChild(ti);
    
    var tp:TextInput = new TextInput();
    tp.x = 95.35;
    tp.y = 121.90;
    tp.width = 172.00;
    tp.height = 22.00;
    tp.displayAsPassword = true;
    tp.editable = true;
    tp.enabled = true;
    tp.setStyle("textFormat", tf);
    addChild(tp);
    Last edited by Force Flow; Mar 4, 2013 at 10:54. Reason: added code tags

  2. #2
    I solve practical problems. bronze trophy
    Michael Morris's Avatar
    Join Date
    Jan 2008
    Location
    Knoxville TN
    Posts
    2,011
    Mentioned
    56 Post(s)
    Tagged
    0 Thread(s)
    Use of Flash is strongly not recommended for any project. Any website that deploys faces an increasingly dwindling market share of devices that can use it.

    That said, you'll find an http proxy such as Charles to be invaluable in debugging such applications since it can monitor the cross talk between the scripts.

  3. #3
    Community Advisor silver trophy

    Join Date
    Nov 2006
    Location
    UK
    Posts
    2,514
    Mentioned
    37 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Michael Morris View Post
    Use of Flash is strongly not recommended for any project.
    While it may be true for simple uses such as slideshows and simple animations, how would you do something like audiotool.com or a 3d game or other multimedia project that needs more power than what html5 can offer? There are plenty use cases where it's still a valid tool, or even the best or only tool for the task at hand.

  4. #4
    I solve practical problems. bronze trophy
    Michael Morris's Avatar
    Join Date
    Jan 2008
    Location
    Knoxville TN
    Posts
    2,011
    Mentioned
    56 Post(s)
    Tagged
    0 Thread(s)
    I can think of no use cases. There is however one that burns in my mind - 4 years ago I used Flash along with javascript to allow my client sites to have a download with progress bar. Without warning, Adobe chose to disable the functionality of the plug in citing security reasons. I had to go back and patch nearly 100 sites for free over the course of 4 weeks, losing thousands in revenue.

    So no, in my opinion - colored by that betrayal - there is no use case for Flash. Period. Production software cannot be built on a proprietary API when the maintainer shows such blatant disregard for the community that uses the product.

  5. #5
    Community Advisor silver trophy

    Join Date
    Nov 2006
    Location
    UK
    Posts
    2,514
    Mentioned
    37 Post(s)
    Tagged
    1 Thread(s)
    There's no doubt Adobe haven't been a very good custodian of the technology, but personally, I wouldn't dictate or censor what content can be made available to a customer on the basis of being emotionally or puritanically attached/disaffected to any medium of communication. I dare say thousands of successful .net, oracle, and other proprietary software developers would take issue with such zealotry, as would the satisfied users of the end products.

    There are plenty highly successful and world-class web sites that carefully weigh up the pros and cons, and use proprietary technology as part of providing the best service they can, whether we as developers choose to use them or not.

  6. #6
    I solve practical problems. bronze trophy
    Michael Morris's Avatar
    Join Date
    Jan 2008
    Location
    Knoxville TN
    Posts
    2,011
    Mentioned
    56 Post(s)
    Tagged
    0 Thread(s)
    They can take issue all they want. I lost a huge amount of time and money to Adobe's shenanigans. I won't do it again. And I can't in good conscience advise the use of a technology that nearly bankrupted me.

    This isn't an issue with proprietary software. This is an issue with Adobe - specifically the Flash team. Say what you want about Microsoft, they bend over backwards to keep their API's stable. Oracle does much the same. Adobe has not. A proprietary software package must be stable to be useful since you can't fix it if something breaks. Flash is emphatically not stable, and because of Adobe's policies it cannot be trusted for any critical application.

    Besides, Flash has no useful niche. All the use cases you gave in post #3 are better delegated to C++, C#, or Java. None of those tasks gain anything at all by trying to run them in a browser context.

  7. #7
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,747
    Mentioned
    64 Post(s)
    Tagged
    0 Thread(s)
    While i'm sure you two could intelligently debate the use of flash for the next couple dozen posts, how about we get back to the actual question, and you guys can take it to a seperate thread?

    To the Flash people: Can someone verify the flash code above will work as intended?
    To the OP: You can test whether the variables are being passed correctly by putting the following at the top of your PHP page (inside the PHP tags)
    PHP Code:
    <?php file_put_contents('testvars',print_r($_POST,true)); ?>
    Run your flash page, then look for a file called 'testvars' in the directory with the PHP file. Open that up, and lets see what's inside.
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.


Bookmarks

Posting Permissions

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