tr-demoscene

the scene => scripting => flash actionscript => Konuyu başlatan: spaztica - 24.03.2004 20:29:20

Başlık: Flash<->php Data Takası
Gönderen: spaztica - 24.03.2004 20:29:20
Flash'te ilk frame'e şu kod geliyor:

Kod: [Seç]
loader = new LoadVars();
loader.onLoad = function(success) {
        if(success){
                trace(&quot;loaded results&quot;);
                trace(loader.msg);
        }
};
sender = new LoadVars();
sender.page = &quot;3&quot;;
sender.sendAndLoad(&quot;http://127.0.0.1/decoded/pinpon.php&quot;,loader,POST);

PHP'de de karşılayacak kod (swf ile aynı domain altına pinpon.php ismiyle kaydedilmeli):
Kod: [Seç]
header('Expires: Jan 01, 2001 00:00 GMT');
header("Cache-control: no-cache");
header("Pragma: no-cache");
$page=$_POST["page"];
if($page=="3")echo("msg=got it...");
?>

tabii domain uygun girilmeli. swf'nin bulunduğu domain'de durmalı php de...

crossdomain için serverdaki php/asp kod gidip diğer domain'den bilgiyi çekebilir. ya da loadvars yerine loadxml fonkisyonu kullanılarak crossdomain xml dosyasında da aşağıdaki ek ile bu gerçekleştirilebilir:
Kod: [Seç]