A Flash Developer Resource Site

Page 2 of 2 FirstFirst 12
Results 21 to 22 of 22

Thread: trouble with php write to txt

  1. #21
    Senior Member
    Join Date
    Apr 2004
    Sorry. I'm getting kind of tired of finding code examples and typing detailed advice only to have you repeatedly refer me to your code saying "but the last two don't work". You haven't posted any new code or made any changes as far as I can tell.

    Your code is highly redundant and is a poor way of going about it not just because of code redundancy but because you make 5 different requests to the server to load your information and 5 more to save your information. You really should rework it.

    Here's a tip: A single URLVariables object can be used to transmit whole bunch of different variables. You just keep assigning properties to it:
    PHP Code:
    var variables = new URLVariables();
    variables.var1 "I'm var 1";
    variables.var2 "I'm var 2";
    variables.var3 "I'm var 3";
    variables.var4 "I'm var 4"
    In your PHP, you'd find these vars defined in $_POST['var1'], $_POST['var2'], etc. That would be an easy way to get rid of most of your actionscript code.

    You could also use something like Sephiroth's Serializer Class to send 5 vars back from php to flash in one fell swoop. He's got code examples that show how to use it.

    A trace statement will output a message to the debugger window in the Flash authoring application (typically referred to as the Flash Integrated Development Environment or I.D.E.). You can find a description of it if you search the Actionscript 3 Language Reference. I find it's super useful to let you know what code is running when and what values are:
    PHP Code:
    function completeHandler(event:Event):void
    txt:String event.target.data as String;
    trace('completeHandler is setting text to ' txt);
    text_txt.text =     txt;

    Write multiplayer games with FlashMOG 0.3.1
    Try the MyPlan Salary Calculator

  2. #22
    Join Date
    Apr 2010
    hey, really though thanks a lot for the help. I'm sorry if i gave you the impression I wasn't reading through your posts. In fact, I've reread those posts and your links a few times (cuz the first time It didnt make much sence to my newbie brain).

    I wasn't trying to throw the same code back at you. I've gotten complaints before for asking questions without providing any code, so I err on the side of providing old code when I am unclear about something and havent been able to implement the updates yet.

    I have been trying to simplify the code but I've been confused at how to do it since I am such a newbie at this. I didn't think the complexity itself was the problem, but when you mention all the simultaneous requests, I can see how this could cause confusion for the server and all. When i get home in a few hours I'll see if I can bash my head against the info in your recent post.

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