-
Array PHP into Flash
Hi all, I am making a site in php, however the header and menu is all made in flash, its a hybrid site u could say.
Links and text the menu (flash) must be read from the php file, my question is how to make flash as2 to read this array in php, what to write on each button and where to refer.
Thanks. =]
PHP Code:
get Object ( [query] => Array ( )
[pages] => Array ( [0] => Array ( [id] => 1 [language_id] => 1 [menu] => Home )
[1] => Array ( [id] => 2 [language_id] => 1 [menu] => Products )
)
[c_page] => Array ( [id] => 1 [language_id] => 1 [menu] => %CD%E0%F7%E0%EB%EE )
)
I thing the action script 2 code maybe you should look like:
var testLoadVars = new LoadVars();
testLoadVars.onLoad = function(success){
if(success){
trace(testLoadVars.var1);
trace(testLoadVars.var2);
}
else
trace("error");
}
testLoadVars.sendAndLoad("http://localhost/filename.php",testLoadVars,"POST");
}
Last edited by wopsreg; 06-25-2010 at 02:24 PM.
-
I convert PHP code as XML, but does it have no idea what should be the action script code
PHP Code:
<?php
require_once('inc/insert.php');
// pre($globals->get);
$rss = '<?xml version="1.0" encoding="windows-1251"?>' . "\n";
$rss .= '<rss version="0.91">' . "\n";
$rss .= '<menu>' . "\n";
foreach($globals->get->pages as $key => $value) {
$rss .= '<page>' . "\n";
$rss .= '<name>' . $value['menu'] . '<name>' . "\n";
$rss .= '<link>' . make_link($value['menu']) . '<link>' . "\n";
$rss .= '</page>' . "\n";
}
$rss .= '</menu>' . "\n";
$rss .= '</rss>' . "\n";
header("Content-Type: text/xml");
echo $rss;
?>
-
Sephiroth's serializer is a good lightweight solution.
AMFPHP is a really useful thing to learn for this kind of thing.
Or you can serialize into JSON format in PHP 5 using native functions like json_encode and then in your flash client use as3corelib or some other JSON library.
-
-
Hi,
first of all, your flash parts should not "read" from the php index page...
So you can either have
flash call a separate php page (and possibly use xml, amf or whatnot in the communication) or
have the main php page sticj values into the swf movies via flashvars
Musicman
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|