Jump to content

Passing variables from PHP to Acrionscript 2 with LoadVars() problem.


Mortenjan

Recommended Posts

Hello people!

 

 

First i have to say that i am a newbeginner in PHP. I am trying to learn as fast as possible by just testing different things myself(which isnt always easy). I can use a whole day without really getting anywhere. But, i am slowly learing, and i find PHP very interesting.

 

I hope to learn alot from this page, so i may teach others in the future.  ;D

 

So,  i have this problem with LoadVars().

Its not returning variables as i want.

 

Here is a part of the action script:

 

myVars = new LoadVars();
myVars.onLoad = function(success) {
if (!success) {
	trace("Failed to load!");
} else {
	film1 = myVars.film1;
	trace(film1);
}
}
myVars.load("trailere.php");

var listVideo_ID2:Array = [film1,film2,film3,film4,"1yVlNqxm2pY"]; //<-- i want the variables copied here.
var listVideo_ID:Array = ["p447zpUmbxw","2_5AbyzzqdA","1yVlNqxm2pY","zm4xdv2TNK4", "swZ8XBmws5Y"];


// ...etc

I want film1,film2,film3 and film4 exported from "trailere.php".

 

Here is the php code:

 

<?php

$link = mysql_connect("localhost", "username", "password");
mysql_select_db("database", $link);


$query = "SELECT * FROM trailere";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result) or die(mysql_error());

$trailer1=$row['trailer1'];
echo "&film1=" . $trailer1  . "&";  

// and i also tried:

$trailer2=$row['trailer2'];
print("&film2=$trailer2");

// ...etc

 

What am i doing wrong?

I have done almost the same thing with a dynamic textbox(using another AS) which worked perfectly(so i guess my database is functional). But then, i coulnt use the variables in the actionscript itself. (Just ask if you want the "working" code)

 

Here is the flash online: http://www.vinstrakino.co.cc

 

Thanks in advance.

Any help would be much appreciated!.

 

Regards Morten

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.