Sending information into Flash

For system help, all hardware / software topics NOTE: use Coders Corner for all coders topics.

Moderators: Krom, Grendel

Post Reply
User avatar
Nitrofox125
DBB Admiral
DBB Admiral
Posts: 1848
Joined: Sun Jul 07, 2002 2:01 am
Location: Colorado Springs, CO, USA
Contact:

Sending information into Flash

Post by Nitrofox125 »

How does one send information into Flash? Basically I have a flash navigation bar embedded into a web page with a few buttons for different pages. You click a button, and it does a getURL() for that page. But, I also want the flash file to know what page it's on. It's actually using PHP. The entire thing is on index.php, and different pages are called by index.php?page=thispage. index.php will automatically include thispage.php in the content pane. So for example, when I click the home button in Flash, it does getURL("index.php?page=home");
But I want the home button to turn blue and display the sublinks for "Home". I want to do something like
<embed src='navbar.swf?page=home' width='700' height='200'> (Yes I understand I'm not supposed to use Embed, I don't know how to use object yet though). So that the variable 'page' gets sent to flash with the value of 'home'. I've tried using XML, but it's a lot of shuffling files just to tell flash what page it's on. No, I will not create seperate flash nav bars for each page.

Any help?
User avatar
DCrazy
DBB Alumni
DBB Alumni
Posts: 8826
Joined: Wed Mar 15, 2000 3:01 am
Location: Seattle

Post by DCrazy »

Any parameters you send a Flash movie as part of the query string -- as you are doing -- or the FlashVars parameter -- the preferred way of doing it -- are automatically created as variables in the root level. So what you're doing ("navbar.swf?page=home") will automatically create the variable _root.page and set it equal to "home". You should really do the following, though:

<embed src="navbar.swf" width="700" height="200" flashvars="page=home">
User avatar
Nitrofox125
DBB Admiral
DBB Admiral
Posts: 1848
Joined: Sun Jul 07, 2002 2:01 am
Location: Colorado Springs, CO, USA
Contact:

Post by Nitrofox125 »

SWEET! Thats.... incredibly simple!
User avatar
Mobius
DBB_Master
DBB_Master
Posts: 7940
Joined: Sun Jun 03, 2001 2:01 am
Location: Christchurch, New Zealand
Contact:

Post by Mobius »

Repeat after me:

"FLASH IS 99.9% BAD!"

I guarantee you're following almost every rule there is on flash abuse.
User avatar
DCrazy
DBB Alumni
DBB Alumni
Posts: 8826
Joined: Wed Mar 15, 2000 3:01 am
Location: Seattle

Post by DCrazy »

I was waiting for that.

Nitrofox, I'm sure you've learned by now to completely ignore anything Mobius says.
User avatar
Krom
DBB Database Master
DBB Database Master
Posts: 16138
Joined: Sun Nov 29, 1998 3:01 am
Location: Camping the energy center. BTW, did you know you can have up to 100 characters in this location box?
Contact:

Post by Krom »

DCrazy wrote:I was waiting for that.

Nitrofox, I'm sure you've learned by now to completely ignore anything Mobius says.
Agreed, I think we all saw that coming.
User avatar
Top Gun
DBB Master
DBB Master
Posts: 8099
Joined: Wed Nov 13, 2002 3:01 am

Post by Top Gun »

This pic gets more use than any other here :P:

Image
User avatar
DCrazy
DBB Alumni
DBB Alumni
Posts: 8826
Joined: Wed Mar 15, 2000 3:01 am
Location: Seattle

Post by DCrazy »

You know, this thread probably would have been better suited to the Coders' Corner for 2 reasons...

1) It's more appropriate there.
2) I could edit out Mobius's post. :P
Post Reply