Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 10-30-2006, 05:53 PM   #1
AndersStudio
designer/developer
 
Join Date: Oct 2006
Location: Philadelphia, PA
Posts: 1
Default php and loadVars to pull a variable from one swf to another

Hi.

I have a .swf that pulls a random testimonial from a database. I am programming a 'read more' link in this .swf. The link should pass the id of that random testimonial to a new .swf file.

Code:
on(press){
getURL("http://directory/testimonials_af.php?tid="+link, "POST");
}
testimonials_af.php contains another .swf that needs to retrieve the variable (tid) and load all the testimonials from the database, but show the one that was selected.

However, I have tried several loadVars functions to get this id and place into a variable in flash, but it doesn't seem to work.

I even tried to write the flashvars object in the php like this:

Code:
<? $tid = $_GET['tid']; ?>
<script type="text/javascript">
	AC_FL_RunContent("classid","clsid:d27cdb6e-ae6d-11cf-96b8-444553540000",
		"codebase","testimonials_af",
		"width","600",
		"height","300",
		"id","single", 		
		"movie","testimonials_af", 
		"quality","high", 
		"scale","exactfit", 
		"wmode","transparent", 
		"flashvars","tid=<? print("$tid"); ?>", 
		"bgcolor","#ffffff");
</script>

Code:
myVars = new LoadVars();
    myVars.load("http://directory/testimonials_af.php", "GET");
_global.id = myVars.tid;
What am I doing wrong?
AndersStudio is offline   Reply With Quote
Old 10-30-2006, 06:46 PM   #2
Cota
Super Moderator
 
Cota's Avatar
 
Join Date: Jul 2001
Location: NYC
Posts: 10,175
Default

if you're running it locally and you dont have apache installed and running, your PHP wont run. Secondly, how is this set up, are the swf's in the same page, does one load the other..?
__________________
Color Wars™ | (kul′ər wôrs) n. - Open conflict between factions. www.theColorWars.com

cota - www.chadworkman.com | http://shavedplatypus.com
occupation: designer | flash developer | server-side developer (php, asp, mssql, mysql)
Cota is offline   Reply With Quote
Old 11-01-2006, 06:24 AM   #3
peptobismol
Senior Member
 
Join Date: Oct 2005
Posts: 746
Default

the flashVars should would. You don't need
----
myVars = new LoadVars();
myVars.load("http://directory/testimonials_af.php", "GET");
_global.id = myVars.tid;
---

flashVars will dump the variable & values on your root...
peptobismol is offline   Reply With Quote
Old 11-01-2006, 06:42 AM   #4
Flash Gordon
rather be programming
 
Flash Gordon's Avatar
 
Join Date: Feb 2005
Location: City of Angels
Posts: 10,140
Default

Quote:
getURL("http://directory/testimonials_af.php?tid="+link, "POST");
Quote:
Originally Posted by manual
getURL(url [, window [, "variables"]])

Parameters
url The URL from which to obtain the document.

window An optional parameter specifying the window or HTML frame that the document should load into. You can enter the name of a specific window or choose from the following reserved target names:

_self specifies the current frame in the current window.
_blank specifies a new window.
_parent specifies the parent of the current frame.
_top specifies the top-level frame in the current window.

variables A GET or POST method for sending variables. If there are no variables, omit this parameter. The GET method appends the variables to the end of the URL, and is used for small numbers of variables. The POST method sends the variables in a separate HTTP header and is used for sending long strings of variables.

Returns
Nothing.
k
__________________
trace("Good bye Flash.") Log.i(TAG, "Hello Droid");
Flash Gordon is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
FileReference, LoadVars, PHP and PHP SESSION jeffnovis Server-Side Scripting 4 01-08-2010 02:08 PM
writing to text file via php using LoadVars victor322 ActionScript 2.0 5 05-10-2006 02:42 AM
LoadVars or XML with PHP on DIFFERENT servers doesn't work. Sckz Server-Side Scripting 4 07-13-2005 11:01 PM
PHP Flash LoadVars Question Jason129 ActionScript 2.0 5 04-17-2005 01:36 AM
LoadVars() / sendAndLoad() -> PHP not Loading??? SecretAgentRege ActionScript 1.0 (and below) 13 10-27-2004 12:42 AM


All times are GMT. The time now is 08:17 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.