Welcome, Guest. Please login or register.
Did you miss your activation email?
05/22/12, 17:54
Home Help Search Login Register
News: Parsley Flex framework review featuring quiz application, in our Flex frameworks series
Flex SDK 4.5 mobile roadmap: begin with your mobile development
Swiz Flex framework review featuring quiz application
New homepage we release our new Homepage, take a look ...

+  Flash-db
|-+  General
| |-+  Flash and AS 3 (Moderators: papachan, kofi addaquay)
| | |-+  what the hell am I doing wrong here?
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: what the hell am I doing wrong here?  (Read 681 times)
bamben
Server what's that
*
Posts: 2


View Profile
« on: 08/25/10, 03:32 »

Code:
import flash.net.URLLoader;
import flash.events.Event;
import flash.net.URLRequest;

//-------------------------------------------------------------------------------------*
//Load text (works great!)

var S1L:URLLoader = new URLLoader();
S1.wordWrap=true;

S1L.addEventListener(Event.COMPLETE, onLoaded);

function onLoaded(e:Event):void {
S1.text = e.target.data;
addChild(S1);}

S1L.load(new URLRequest("S1.txt"));
//-------------------------------------------------------------------------------------*
//something below doesn't work...??

SAVE1.addEventListener(MouseEvent.CLICK, sendData);

function sendData(e:Event):void {
var myData: URLRequest = new URLRequest("http://www.mysite.com/test/save.php");
var variables: URLVariables = new URLVariables();
var loader: URLLoader = new URLLoader();

myData.method = URLRequestMethod.POST;
variables.TXT = S1.text;
myData.data = variables;
loader.dataFormat = URLLoaderDataFormat.VARIABLES;

loader.load(myData);
                //myData.sendAndLoad("save.php", myData, "POST")
}
      
      
inside save.php I put:
Code:
<?php

$txt 
$_POST['TXT'];


$toSave ="TXT=.$txt";


$fp fopen("http://www.mysite.com/test/S1.txt""w");


fwrite($fp$toSave);

if(
fwrite($fp$toSave)) echo "writing=Ok&";
else echo 
"writing=Error&";

fclose($fp);

?>




in the as3 tutorial you say to put ' myData.sendAndLoad("save.php", myData, "POST") ' in flash right before you talk about the php script.

when I put it I get error:

Code:
1061: Call to a possibly undefined method sendAndLoad through a reference with static type flash.net:URLRequest.

Why!!!!!?Huh? I've been doing this over and over for six hours now I can't see what is wrong.

Its ridiculous how stupid this is making me feel.


I need help
Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« Reply #1 on: 08/25/10, 08:27 »

If you're using AS3, then instead of using the AS2 tutorial, is much better to use this one: http://www.flash-db.com/Tutorials/savingAS3/

Jorge
Logged

Pages: [1] Print 
« previous next »
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!