Jump to content

Theory: ACTIONSCRIPT CAN'T READ PHP SESSION VARIABLES.


ridiculous

Recommended Posts

Hello.


QUESTION:

Can and how do you convert global variables to local variables AND
can and how do you convert local variables to global variables?


REASON FOR QUESTION:

I have a FLASH movie that imports some PHP variables, but not others. All the variables behave the same in PHP.


FACTS:
I have a FLASH movie that imports PHP variables into a dynamic text box. From what I have observed, Actionscript only imports variables that are set as follows:

[color=purple][u]Ex. 1 : Flash imports variables where the value is written in directly.
[/u][/color]
$text = "city";


[color=purple][u]Ex. 2: Flash imports variables where the value is the result of a query on the same script.[/u][/color]
$conn = db_connect();

$sql = 'SELECT Site FROM course_catalogue ORDER BY RAND() LIMIT 1';

if( ($result = mysql_query($sql)) === FALSE )
{echo mysql_error();} else

while  ($row = mysql_fetch_assoc($result))
{extract($row);


[color=red]Probably sounds reasonable enough.[/color] But, the issue I'm having is that I must carry variables from my initial query through a series of other scripts (by POSTing them to a url or as part of a function).

When I need to import my variables to FLASH, they [color=blue][b]print  [/b][/color]$myvar; and [color=blue][b]echo[/b][/color] $myvar; normally and appear to behave as any other variable for PHP purposes. Flash, however, does not recognize them.

Your help is greatly appreciated.



Link to comment
Share on other sites

In my limited knowledge, you can pass variables in these ways:

* if a variable is outside a function and you want to use it inside a function then claim it as 'global'

[code]<?php
$a = 1;
$b = 2;

function Sum()
{
  global $a, $b;

  $b = $a + $b;
}

Sum();
echo $b;
?>
[/code]

* If you wish to pass it to another page you can use:

1. session vars
2. pass it in the URL (ex: nextpage.php?hotstuff=$hotStuff which would pass along 'Kate Bekinsdale' to be captured in a $_GET statement)
Link to comment
Share on other sites

All that time, wasted. Actionscript loadVariables only reads (PHP Variables) right from the PHP script indicated in the URL; so Flash can only take what it sees there at the time it "parses" the doc in its own half-assed way. No session variables.

If you want to import dynamic content into Flash from PHP, you have to either write your variables to an XML file that you destroy at the end of the session or use an Apache Module like amfphp, which you can't do unless you have root access.

Worthless.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.