Brain twister - flash, html and php

hey all,

I got a not so complicated question but here we go:

i am working on a site with a flash navigation and html content.

I want to put the flash navigation in a cell at the top of all the pages. now the tricky bit. I want to load up new pages everytime someone hits a link in the flash nav, but i want the new page to reference different parts of the flash timeline.

ie on the home page if someone hits “contact”, they will be re-directed to a new html page with the contact details. But the flash nav on this page will have contact highlighted (simple example).

I know i can avoid the problem by putting flash in a separate frame, but i want to know if it is possible without frames.

i assume that flash needs to send some variables to a javascript located on all the html pages, but i don’t know how i would do this.

i can have the nav as an include, but i still need to reference the flash timeline.

any ideas? i guess this is pretty advanced, but i haven’t seen it done before, and it is great for functionality if it is possible.

Also all the pages are dynamic using php, so this would be pretty cool to use flash navs.

btw i am using MX

any ideas, suggestions, obsenities are all appreciated.

cheers,

KD

Highlight button 1

Highlight button 2

Highlight button 3

Highlight button 4

by declaring an variable “_global” inside flash, you can edit this variable outside flash using the url (must be behing .swf, or else it wont work), or using POST or GET with forms or whatever…

i think you can change this to an nav like this:

when ya using Dreamweaver, you can add/insert an flash document, if you look inside that peace of html, you can see the source of the file (in this case it would be: highlight.swf) i suggest you make an script like:


<? echo "highlight.swf?buttonhighlight=$activenumber"; ?>

inside the html script were it determines the flash source…

i think this should helped ya allot, i attached the .fla for you so you can take a good look at the _global variable…

thanks!

That’s brilliant. With your example, html effectively controls where on the timeline flash goes.

If i had the flash nav referencing the html (ie you press a button in the flash nav and that takes you to a new html page), would i include

<? echo "highlight.swf?buttonhighlight=$activenumber"; ?>

on all the html pages?

and then add geturl actions on all the buttons of the flash nav?

i will try this later myself, but if you know what a mean, a reply would be great!

the _global parameter is a great thing! i gotta get to grips with it properly because it is soo useful!

thanks mate,

kd

i asume you are using php… (says title)

and with php you you include an page using vars… something like

http://www.mysite.com/index.php?page=news

something like that, im sure you have seen it b4…
you can try adding this to the line into your index.php:


<?
if($page=="news"){
$highlight = 1;
}
?>

and were the html determines the flash source:


<? echo "flashfile.swf?highlight=$highlight"; ?>

http://www.mysite.com/index.php?page=news

wich will load the normal page including content, if you code it right (wich means also the menu)

and when you have the highlight var correctly added inside the flash source script, it will load the menu, with highlighting on button 1, in this case “News”…

i think i discribed it a bit difficult, cuz i cant give you exact code atm, also, i dont think you can figure this out without any knowlegde of php…

let me know if it was usefull or not…

edit:
this is all done with only 1 page, index.php

cheers,

It was very useful. Unfortuneately we changed what we are going to do for the project (this is what got me thinking about how to do this).

I will work on what you gave me to learn it anyway, but i don’t know php. I got a programmer doing the php.

But i wanted to see if it was possible for the programmer to do.

Anyway thanks loads for the high-quality reply!

Anything you need, just post.

laters,

Kd

np, hope you learned from it :slight_smile: