all groups > flash (macromedia) > july 2005 >
You're in the

flash (macromedia)

group:

groggy start for flash in php file... . . . . . .


groggy start for flash in php file... . . . . . . dontwriteme
7/8/2005 8:52:01 PM
flash (macromedia):
been doing some trial and error on my new server so I am trying to figure out
if this is my fault

im making a file that send a querry string var into flash... using php to get
and post the variable... i know its probably easier to use javascript but anyway

there is an abnormally long wait before the flash player will start
I have nothing in the swf except 2 txt boxes one w/ about 50 words in it,
another w/ embeded Arial characters to show the passed var and probably 30
lines of action script.
I did an echo with php just to check when the page is loaded and its a good
10-20 second wait before it shows the swf content

i know the embeded font takes time to load before content is shown but Ive had
multiple fonts embeded and never had it take this long

other swf files in html docs load normally w/ 100X the info

any thoughts or known issues?

thanks for any help,
Kent
Re: groggy start for flash in php file... . . . . . . David Powers
7/9/2005 12:00:05 AM
[quoted text, click to view]

Loading text from PHP into Flash is easy and fast. What you don't say is
how you're trying to do it.

The ouput from PHP must be a continuous string of name/value pairs
separated by ampersands. The names must be valid ActionScript variable
names, and the values must be URL-encoded.

<?php
$var1 = 'This is the value of the first variable';
$var2 = 'This is the value of the second variable';

echo 'var1='.urlencode($var1).'&var2='.urlencode($var2);
?>

Inside your movie, use LoadVars to load the variables. The following
goes on the main timeline, and assumes your dynamic text boxes are
called var1_txt and var2_txt.

var getVars = new LoadVars();
getVars.load("myScript.php?cacheKiller=" + new Date().getTime());
getVars.onLoad = function(success) {
if (success) {
var1_txt.text = this.var1;
var2_txt.text = this.var2;
} else {
var1_txt.text = "Couldn't load data";
}
};

To find out more about loading variables from PHP into Flash, go to my
site at http://computerbookshelf.com/php5flash/ and grab hold of the
sample chapter.

--
David Powers
Author, "Foundation PHP 5 for Flash" (friends of ED)
Co-author "PHP Web Development with DW MX 2004" (Apress)
Re: groggy start for flash in php file... . . . . . . dontwriteme
7/9/2005 1:18:57 AM
there it is

I was going about it the wrong way.

shouldnt have tried to cram it all in one package... instead...
keep flash in the html file and load the php var once in flash

didnt realy anwser the question but did provide a solution

btw i was sending through querrystring what page they choose to start on from
the enter screen
mysite.com/template.php?icpage=home (tried the 'home' & "home" efforts)
then on template.php

<?php
$acpage = "";
$acpage = $_GET['icpage'];
?>

misc stuff and.....

<obje...
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="template2.swf?bcpage=<?php echo $acpage ?>" />
<para...
<para...
<embed src="template2.swf?ocpage=<?php echo $bcpage ?>" qualit...
</object>

then just refrenced to root.bcpage


Thanks,
Kent
AddThis Social Bookmark Button