Jump to content

Flash to PHP forward to new url


quincewyss

Recommended Posts

I'm trying to make a link from flash work.  It may sound weird because yeah GetURL..., but I have to follow the rule allowNetworking="internal" on the emmbed tag.  Inturn I can only use sendAndLoad from flash.  So what I want to do is have a link in flash call a php file using sendAndLoad.  I have that all working now here's the hard part. I need the php file to then take the url var I sent and go to that url. 

 

I have tried header(location...), meta refresh, javascripts and auto submit form none of these work from the flash peice, but all work when I go straight to the php file.  The problem occurs because all header info and html info have already been loaded.  Does anyone know of a different way to make the php file go to a new URL?

 

 

Thanks!!!

Quince Wyss

Link to comment
https://forums.phpfreaks.com/topic/73816-flash-to-php-forward-to-new-url/
Share on other sites

flash code:

function createTheMenu(MM){
	var result_createMyMenu:LoadVars = new LoadVars()
result_createMyMenu.onLoad = function(){
	error_txt.text = "hello!!";
}
var createMyMenu:LoadVars = new LoadVars()
	createMyMenu.mm = MM;
	createMyMenu.sendAndLoad("http://peakstudios.com/keith/myspace/f_test.php", result_createMyMenu, "POST")
}

the error text comes back with hello!! showing that flash has made comunication with the php file.

 

The PHP:

<?php
header("location: http://peakstudios.com");
?>

once I get the new page opening I will bring in the MM var thru POST to send the user to the specific URL.

 

Thanks!

Quince

flash code:

function createTheMenu(MM){
	var result_createMyMenu:LoadVars = new LoadVars()
result_createMyMenu.onLoad = function(){
	error_txt.text = "hello!!";
}
var createMyMenu:LoadVars = new LoadVars()
	createMyMenu.mm = MM;
	createMyMenu.sendAndLoad("http://peakstudios.com/keith/myspace/f_test.php", result_createMyMenu, "POST")
}

the error text comes back with hello!! showing that flash has made comunication with the php file.

 

The PHP:

<?php
header("location: http://peakstudios.com");
?>

once I get the new page opening I will bring in the MM var thru POST to send the user to the specific URL.

 

Thanks!

Quince

 

I think your Action Script is where the problem lies

 

var error_txt.text:TextField;

error_txt.text .text = "Please Wait... Loading..."

 

// declare and instantiate a LoadVars object

 

var result_createMyMenu:LoadVars = new LoadVars();

 

// point our LoadVars 'onLoad' handler to our function

// Note that this should be done before trying to load any data.

 

result_createMyMenu.onLoad = function(successful) {

if(successful) {

var createMyMenu:LoadVars = new LoadVars()

createMyMenu.mm = MM;

 

} else {

error_txt.text .text = "error loading data"

}

}

 

createMyMenu.sendAndLoad("http://peakstudios.com/keith/myspace/f_test.php", result_createMyMenu, "POST")

Actually the flash was working fine.  I tested your code just to make sure but it doesn't work(flash sends then loads your code was backwards).  The problem is that the page has already been written and now flash is asking php to go to a new page.  Is there a way to make php go to a new page when asked?

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.