473,750 Members | 2,541 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to get vars from PHP into Flash

6 New Member
Hey there guys,
After some research into PHP and Actionscript, I think I have come close to doing what I want to do. Except now I'm stuck.

Here is what I have in my header.php file:

<?php
$c_page = $_SERVER['PHP_SELF'];
$c_page = basename($c_pag e, ".php");
?>

So I have the current file name of the php page stored in a variable called $c_page. Right?

I want to pass it on to a single Flash file, which looks like this:

<object align="middle">
<param name="quality" value="high" />
<param name="movie" value="swf/index.swf?<? echo "cPage=$c_page" ; ?>" />
<embed src="swf/index.swf?<? echo "cPage=$c_page" ; ?>" quality="high" width="780" height="440" align="middle"> </embed>
</object>

Now I want to dynamically load a different background image depending on which page the swf file is in.

But when I add this:

_root.bgHostAni m_MC.bgHost_MC. loadMovie('../images/'+cPage+'Bg.jpg ');

to the parent of the movieclip that I want to load the image into, it won't recognise cPage as a variable and comes back as undefined.

Can anyone help?

Cheers.
Jun 15 '08 #1
3 3256
jiwas78
6 New Member
Also, in case this helps..

When I go to preview the swf, Flash gives me an error:

Error opening URL 'file:///....images/undefinedBg.jpg '

Which I understand because flash needs to get the data from the php file.

So I then refresh my browser. But the swf still file doesn't find the image.

It's called indexBg.jpg so it should work with the bit of actionscript I have but I still don't get it..

Any help much appreciated
Jun 15 '08 #2
ssouhrada
12 New Member
Hello,

Passing variables to flash is not too difficult. Based on the code you put up their I think you are just missing a few lines to have it recognize the variable (flashvar). See this link for more information.

http://kb.adobe.com/selfservice/viewContent.do? externalId=tn_1 6417


Thanks
Jul 2 '08 #3
jiwas78
6 New Member
Thanks. But I think I sorted it out by using an absolute path. Like so..

Expand|Select|Wrap|Line Numbers
  1. _root.bgHostAnim_MC.bgHost_MC.loadMovie("http://localhost/hopscotch/images/"+cPage+"Bg.jpg");
One thing I'm still trying to figure out is how Flash treats relative paths. Are they relative to where the SWF is or relative to where the .php or .html that it's embedded in is.. I've tried both and I still don't know. hmm..
Jul 5 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2302
by: Drisco | last post by:
Hello, I realy need help,Searched the NG for a days with no vail. Sorry for the long script. I am trying to get a variable from php to flash. I have the following code in php <a href="artist_page.php?12345678=<?php echo $row_rs_Q_Gender_to_Artist; ?>"><?php echo $row_rs_Q_Gender_to_Artist; ?></a>
3
3041
by: jitu78 | last post by:
Hi, I want to pass some variable into flash on runtime. See this link, http://www.globtier.com/portfolio/in...?cat=webdesign If somebody clicks on any of project there, it should be highlighted in left flash navigation. Anyone know there, how can I do this?
2
1488
by: xeo | last post by:
hey. am starting this really new web... its gonna be my very 1st ever since i always used to do it with flash but the thing is i need to learn how 2 design on dreamweaver (still websites) so lets say i need to : when i press a button it loads variable to stage while its actually there.. what am trying to say is i want the page to load the script with refreshing/going to another link it can be done easily in a flash movie using loadMovieNum();...
8
11034
by: Binx | last post by:
Please help! Does anyone know how to set up radio buttons to send their info from flash to a PHP script that will email me the results? I have been trying to get this thing to work for weeks, and I still can not get it to work right. Right now, I have a survey that looks like this, and it sends the input text just fine, but when I get the email, all the radio button info is not there. I can provide files or code if it helps. I really...
2
1813
by: Head In A Pan | last post by:
Hello! Here is something I assume is relatively simple but have never bothered to find out - I'm not finding the answer anywhere! All I am trying to do is this: Have a thumbnail image acting as a button - sitting on my HTML page. When the user clicks it, the button uses the POST method to send a specified variable.
6
4825
by: Ws | last post by:
Ok, so I have a question reguarding compilers and placing strings into the .rdata section of the PE. I was working on a program and couldn't figure out why I was getting a 0xc0000005 error message (memory access violation) while trying to alter a (char *) data type'd variable. Proper size, pointers all accurate and verified. I finally got frustrated enough and tried something else, built it as a Release application (using Microsoft...
1
2074
by: Ronm | last post by:
Hey Guys, I have a problem which has been driving me crazy for the last days. I'm working on a small project involving: Visual Basic Acces Database ASP and adobe/macromedia Flash,
19
1979
RMWChaos
by: RMWChaos | last post by:
Previously, I had used independent JSON lists in my code, where the lists were part of separate scripts. Because this method did not support reuse of a script without modification, I decided to consolidate all my JSON lists into one and modify my scripts so that they were more generic and reusable. So far so good. The problem is that my JSON lists used variables for many pieces of code that performed multiple iterations to create several...
6
1568
anfetienne
by: anfetienne | last post by:
how can i post my $random_digit var to flash so that it can be used within flash actionscript?
0
9001
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8838
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9342
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9256
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8263
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6081
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4716
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3323
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2807
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.