PDA

View Full Version : integrating php includes with flash



ghostdeer
January 12th, 2007, 11:19 AM
Hi. I am having a hard time finding the answer to my question in other threads, so I've just created my own.

I am doing a website for a band, the header (the logo, bandname and menu) is all going to be in flash. And each of those elements have some tweens on them doing different effects (ie. changing color at a certain time, sliding in and out of view, etc).

What I'd like is to be able to click on the menu and have a php include load above the flash movie. But when you use php includes, it basically reloads the page with different information, which means that the flash movie header I made would start over again, instead of being paused at the point it was when the menu item was selected. Am I confusing??

Anyway.. I want to know if I can use includes, and still have the movie stop at a certain spot when the page is reloaded with the include.

If I can't do that, can someone give me REALLY BASIC and simple instructions on how to pull data from an external php file to appear in the flash movie. I don't know how to make a mysql table and stuff... um... I don't think.

Sorry for rambling. Thanks for the help!!

duncanhall
January 12th, 2007, 08:21 PM
What is it that you are actually trying to do? There is probably a way to achieve it without using PHP includes.

rille31
January 13th, 2007, 09:49 AM
Maybe you could use frames and load the php files in them?

ghostdeer
January 14th, 2007, 01:25 PM
Yeah I thought of using frames, but I think I kind of want to avoid using them if I can. The thing I like about php includes is that they're easy for to maintain.

I could do something if I knew how to display php within the flash movie. I tried using a tutorial, but I don't know how to build a mysql table. I don't understand that part. I think I need simpler instructions haha.

I guess I'll just drop my question in my original post and instead ask: Can someone help me load my site content from external phps? I don't know what I'm doing... at all.

rille31
January 15th, 2007, 06:36 AM
I use this code to load stuff into flash from php

var new_lv:LoadVars = new LoadVars();
new_lv.onLoad = function(success:Boolean):Void {
sending._visible = false;
if (success) {
trace(new_lv.theVariable);
statusmsg.htmlText = new_lv.theVariable;
} else {
statusmsg.htmlText = "Error opening phpfile";
}
};
Partial php code, the echo part does the sending back


$writeIt= fwrite($file, $xmlString);
if ($writeIt){
$sendBack = "&theVariable=Your text has been saved&";
echo $sendBack;
}else{
$sendBack = "&theVariable=Error saving file&";
echo $sendBack;
}

ghostdeer
January 15th, 2007, 11:53 AM
Okay. I'll give that a try. Thanks!

ghostdeer
January 15th, 2007, 01:16 PM
Okay when I try to do that I get some syntax errors back:

**Error** Scene=Scene 1, layer=text box, frame=1:Line 2: '{' expected
new_lv.onLoad = function(success:Boolean):Void {

**Error** Scene=Scene 1, layer=text box, frame=1:Line 10: Unexpected '}' encountered
};

Total ActionScript Errors: 2 Reported Errors: 2


So..... where exactly does the expected '{' go?
I'm using MX 2004... does that make a difference in the code?