Welcome Guest!

If you do not have an account yet on The Web Squeeze forums, please Register! It’s FREE and there are many benefits:

  • Receive Fast Advice
  • Learn Programming Languages
  • Get Professional Website Reviews
  • Quick Troubleshooting Assistance

> Sending Variables To Flash Via Javascript?

This is a discussion on Sending Variables To Flash Via Javascript?, within the Javascript section. This forum and the thread "Sending Variables To Flash Via Javascript?" are both part of the Programming Your Website category.

 
Reply to this topicStart new topic
> Sending Variables To Flash Via Javascript?, How would one approach this?
cosmicbdog
post Jul 8 2008, 09:39 AM
Post #1


Rapid Squeezer
****

Posts: 146
Joined: 3-July 08


Of course, when it doubt, do a quick search of the feeble internet, then hit up the web squeeze... thats the obvious part, which brings me to now.

How does one go about doing this? Is there a very simple way one can shoot a variable into flash and has the flash file reload? I am sure I could just put the flash file in its own file and load it via ajax, but I'm wondering if there is a simpler way to do that...
Go to the top of the page
 
+Quote Post
Antti
post Jul 9 2008, 12:15 AM
Post #2


Rapid Squeezer
Group Icon

Posts: 308
Joined: 15-February 08
From: Finland


For a while now I've been using SWFObject when inserting flash files to web page. It allows me to do this:

CODE
<script type="text/javascript">

var flashvars = {
  name1: "hello",
  name2: "world",
  name3: "foobar"
};
var params = {
  menu: "false"
};
var attributes = {
  id: "myDynamicContent",
  name: "myDynamicContent"
};

swfobject.embedSWF("myContent.swf", "myContent", "300", "120", "9.0.0","expressInstall.swf", flashvars, params, attributes);

</script>


--------------------
Go to the top of the page
 
+Quote Post
Jason
post Jul 9 2008, 02:35 AM
Post #3


Master of the Universe
Group Icon

Posts: 1,298
Joined: 15-February 08
From: London, England


I have also used swfObject. It works very well.


--------------------
Go to the top of the page
 
+Quote Post
cosmicbdog
post Jul 12 2008, 11:45 PM
Post #4


Rapid Squeezer
****

Posts: 146
Joined: 3-July 08


ahh yes, thanks for your responses guys. I apologise for not explaining this better... I use swfobject as well. It rocks. And I am aware of how to send variables to it on loading the flash file... what I am wondering though is how to actually send variables to the flash file once its already loaded.

For example, say you have a flash file that does something depending those flashvars you send it... what about changing the flashvars on the fly? I could refresh the file using some ajax technique and have it reload with new flashvars... but what about just kind of sending new variables into the file?

This post has been edited by cosmicbdog: Jul 13 2008, 12:08 AM
Go to the top of the page
 
+Quote Post
Antti
post Jul 14 2008, 12:25 AM
Post #5


Rapid Squeezer
Group Icon

Posts: 308
Joined: 15-February 08
From: Finland


That's a bit trickier. I'm not sure if you can do it without reloading the whole flash with some ajax method like you already mentioned. Maybe someone else knows better.


--------------------
Go to the top of the page
 
+Quote Post
If you found The Web Squeeze to be helpful, please donate so we can keep this site FREE, FRESH, and fortified with Web Design & Development info!
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts   1 rewake 438 14th February 2008 - 10:31 PM
Last post by: Jacob
No New Posts   0 Jacob 324 18th February 2008 - 08:45 AM
Last post by: Jacob
No New Posts   2 marSoul 355 23rd February 2008 - 10:52 AM
Last post by: marSoul
No New Posts   7 gribble 361 25th February 2008 - 10:25 AM
Last post by: thesealportalteam
No New Posts   11 ahwell 470 1st March 2008 - 10:13 AM
Last post by: ahwell