PDA

View Full Version : javascript, php, cgi or actionscript dilema


retrocool
03-03-2001, 04:32 PM
I am wondering what technology is most suited to my purpose.
What I'm trying to achive is this:
The reader is looking at a particular frame of my folio movie.
(S)he skips to another flash embedded html page to view related content.
She presses the 'back' button.
**The portfolio movie loads up and goes to THE SAME frame as she left it.**
This would involve the folio movie knowing where she had come from.

What is the best way to send this info from one page / movie to another?
I was about to try javascript until I read that javascript/flash interaction doesn't work on IE for mac, since it lacks ActiveX.
Since I use IE on a mac, I've gone off this idea!

Any offers?

retrocool

Jesse
03-04-2001, 03:47 AM
PHP or CGI would be well suited to this kinda of thing, and since I've seen this question before I guess I should probably give a good example.

If your server supports PHP I can help you out, so let me know (reply here).

Basically all it involves is sending info from the flash document to the page which embeds the other flash document, then back again if nexcessary. The info (in the form of variables) is easily passed using the GET method and some simple PHP.

Cheers

Jesse

retrocool
03-05-2001, 09:16 AM
yes, god bless 'em, my servers support php.

So fire away with the explanation, and you will have my eternal gratitude!

retrocool

Jesse
03-06-2001, 01:47 AM
OK. Here's the deal.
Take your HTML pages which embed the Flash movies and rename them to .php files.
Now find where the embed source if for your flash file.
Where is says:

<EMBED src="movie.swf"


Or the like, change it to this:


<EMBED src="movie.swf?skipTo=<?php echo $skipTo ?>"


Then, when you call your HTML (now PHP) document use:
getURL ("fileName.php?skipTo=" + skipTo);

This will take the value of the variable SkipTo and send it tot he PHP file you're loading. This PHP file then passes it into the Flash file it embeds.
Now in your flash file you can just have this:
if (skipTo !="") {
gotoAndPlay (Number(skipTo));
}

This checks if the variable skipTo has been passed (checks if it has a value) and if it has, it goes to the frame which skipTo dictates...

I've done this before succesfully but I'm just writing this out off the top of my head so if it doesn't work, lemme know.

Cheers

Jesse

retrocool
03-06-2001, 12:12 PM
cheers jesse!

works a treat! this is the last stage in a project that has been keeping me awake nights for months. Thanks from me, and thanks from my girlfriend who's sick of hearing about it.

(my g.f. is an auzzie like you, but unlike you she *lives* in stratford, rather than having it as a last name.)

Cheers - you da man,

retrocool

premonition. london.

[Edited by retrocool on 03-06-2001 at 07:53 AM]

tranterra
06-06-2001, 02:34 PM
This doesn't have to do with php, but I just HAD to comment on your web site retrocool. Completely original and totaly "retrocool."

Keep up the good work.

tranterra

Vlaad.t.I
01-30-2002, 01:20 AM
Mmm... finally found this post. I've been looking for a thorough explanation re: how to use variables properly. I've seen a lot of tutorials, but they were lacklustre at best.

You, however, have dun good! Dun real good!!!


Anyways... question time...

I'm working with a company being hosted at webcentral, and though I spoke to the tech support guys there, pleading the case of PHP, they said it was too unstable ('sif!) to run on their precious servers. (Nevermind the fact I can crash an entire server with a single line of iNETstore code ;)).

Slapping myself back to the topic, I've got no trouble passing the variables using getURL(), and the URL in the location bar of the browser shows the correct variable-key/value pairs, but the flash file won't recognise them (perhaps due to the fact that there's 5 flash files within the one HTML page), and with just HTML to aid me (unless I move into CF, which I was trying to avoid because of the massive increase in cost/month) there's nothing that can help to generate this:

<EMBED src="movie.swf?var=<?php echo $value ?>"

Can anyone see a way around my problem???

Please help ASAP, as this is really holding up the works. :mad:

PS. Please forgive the smilies... It's my only stress relief atm...:rolleyes:

anim8rx
08-27-2004, 02:31 PM
Hey Jesse - Thanks for the explanation above works great! One problem I seem to be having is seems to need to reload the swf when I add the ?varname=1 to the URL address. Any ideas - the swf Im loading is large enough for a loader, otherwise it wouldnt be evident what is going on.

plink
10-10-2005, 10:37 AM
As this thread explains, you can through the embed tag tell flash whcih page you came from. But how do you know what page you came from? The back button will take you back to the page you came from, but doing as suggested here will take you back to the page you think that person most likely came from.
By using the $_SERVER['HTTP_REFERER'] supoerglobal you can create a simple back link like this

print "<a href=\"".$_SERVER['HTTP_REFERER']."\">Go back</a>";

that essentially does the same as the back button.
Now, if the page you came from can somehow store the position in the videoclip that you need to go back to. Say the URL is =

www.somesite.com/somefile.php?thispage=weather

you can have that particular page produce the swf sting like this

<param name=\"movie\" value=\"flashfile.swf?thispage=".$_GET['thispage']."\" /><param name

Get it. Start using the $_SERVER['HTTP_REFERER'] immidiatly and make nifty back buttons that greatly aid navigation for people not so used to surfing the net.

JT

vinnevin
11-02-2005, 02:09 PM
Hello

This php code causes problems:

<body>

<object width="685" height="755" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0">
<param name="movie" value="http://www.cikmedia.com/ski/blogg/<?php echo $nm; ?>.swf">
<embed src="http://www.cikmedia.com/ski/blogg/<?php echo $nm; ?>.swf" width="685" height="755"></embed>
</object>

</body>

The swf file reads a rss feed, but the pictures and text does not appear when i use php. It works fine with html.

Can anyone tell me why?

PS. Sorry about my english, I'm norwegian.

kato
06-05-2007, 02:21 PM
Jesse, I know this thread is like 6 years old now, i just wanted to say "THANK YOU." ;) You helped me figure out something that I worked on most of the day yesterday.

I couldn't figure out how to reference my variable within the actionscript - being only familiar with php but not much actionscript. It was simpler than I thought (+) but there are surprisingly few references to it!

Anyway, thanks! Kato