PDA

View Full Version : Flashvars


magicwand
06-29-2003, 04:35 PM
i recently used flashvars to pass variable into swf from html.
i used javascirpts before since they suggested javascirpts example.
flashvar is 100X easier to use and more effective.
i could not find toomuch documentation on this matters in this forum.
i will post some good links that i found when i goback to my office.

my point is...it is very useful.
but not many knows about this.
if someone should type flashvars in search arg.
i want this thread to appear with added link i will put later..

if some one have some other good links..feel free to addthem.
thanks.

freddycodes
06-29-2003, 09:29 PM
Yep I always use FLASHVARS when passing variables to my movie from an object or embed tag.


<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="210" HEIGHT="105" id="mp3player" ALIGN="">
<PARAM NAME=movie VALUE="mp3player.swf">
<PARAM NAME=quality VALUE=high>
<PARAM NAME=FlashVars VALUE="mp3name=City_of_New_Orleans.mp3">
<PARAM NAME=bgcolor VALUE=#000000>
<EMBED src="mp3player.swf" quality=high bgcolor=#000000 WIDTH="210" HEIGHT="105" NAME="mp3player"
ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"
FLASHVARS="mp3name=City_of_New_Orleans.mp3">
</EMBED>
</OBJECT>

Sualdam
06-29-2003, 10:00 PM
Colin Moock touches on it in the Definitive Guide.

Macromedia's take is at: http://www.macromedia.com/support/flash/ts/documents/flashvars.htm

And a few others:

http://www.impossibilities.com/blog/flashvarstip.php
http://www.ultrashock.com/ff.htm?http://www.ultrashock.com/tutorials/flashmx/FlashVars.php

You need to be careful because it only applies to the Flash Player 6.

farafiro
06-30-2003, 08:15 AM
good links Sualdam
thx, never used them b4

magicwand
06-30-2003, 02:06 PM
I say, magicwand should compile all thses and create a tutorial with various examples for all of us.... Yay!!!
if i write tutorial for this..willllll it be one of the tutorials in the forum???

farafiro
06-30-2003, 02:39 PM
do it and send it to Jesse
it it worth to be there, he will post it

alexcq
03-28-2005, 10:39 PM
Here's some javascript to help putting in flashvars (http://www.centralquestion.com/archives/2005/03/writeflash_flas.html) , it makes the whole process a lot easier.

http://www.centralquestion.com/archives/2005/03/writeflash_flas.html

jackSalomone
06-06-2005, 08:12 PM
I just found out that Flash isn't too happy if you try to assign the scope of a variable from HTML.

For example, I wanted to create a _global variable named "myVar". If I placed a dynamic text box on the stage at frame 1 with the variable set to "_global.myVar", I could see the assignment. The same text box copied and pasted to frame 2 showed nothing! I ended up having to write something like the following script to get my ActionScript to work:


if (myVar == undefined){
_global.myVar = "default value";
}else{
_global.myVar = myVar;
}


Folks, please let me know if anyone else has run into this, or if I am just crazy.

CyanBlue
06-07-2005, 02:37 AM
Howdy and Welcome... :)

What's not happy is not the FlashVars but the variable name you are using for the textField...
You should use instance name rather than the variable name if you are using FMX and above...

For example, remove the _global.myVar in the variable name field, and give that textField an instance name of content_txt and add this line at the bottom of that if statement...
content_txt.text = _global.myVar;

jackSalomone
06-08-2005, 11:59 PM
That is a very valid point. However, my ultimate usage had nothing to do with textfields at all, I was trying to use the variable in my script. I just had the text field example as a troubleshooting measure.

Flash just didn't seem to like me setting FlashVars="_global.myVar=whatever" (Please assume the correct syntax for the OBJECT tag throughout this paragraph). It worked well when I set FlashVars="myVar=whatever", and then assigned it to a _global scope in my first frame with the code from my previous post. Also, it acted the same way with the src="myMovie.swf?myVar=whatever" method.

CyanBlue
06-09-2005, 02:48 AM
Well... The way 'I' see it, you are not even supposed to provide the path like that...

Flash considers every variables that are passed via FlashVars or query string to be the variables in the main timeline... That's why you are required to provide your own code check routine like you have up there with the if statement... ;)

locke
06-28-2005, 01:23 AM
Is there a way to do the exact opposite of this without using Javascript?

CyanBlue
06-28-2005, 04:11 AM
Howdy... :)

I don't understand your question, what do you mean by that???

BogyDruid
11-12-2006, 11:18 PM
I have a problem. I've created a flash video player. It works well if i give values from ActionScript to the video i need to play. ie: ns.play("http://xxxxxx/com/file.flv"); but i need to pass a variable through HTML with the FlashVars parameter to the player.So could you please explain how can i do that, explain like to a noob in ActionScript pls. ie: how do you define the ActionScript variable and how the code looks in HTML.
Thanks.

anonymous
11-13-2006, 12:50 AM
This all in the same one html?

BogyDruid
11-13-2006, 02:15 AM
I need to pass a variable from HTML to the player.swf and i don't know how. How do you define in ActionScript of the player.swf the variable that is passed from HTML? And how do you write the html code so that you can view the movie you want in the player.

anonymous
11-13-2006, 02:43 AM
Still confused!

You have an html link on your page and you wish to pass on a variable to the player in your Flash movie embedded in the same html as the link?

If so, you wouldn't use FlashVars but a javascript Flash Method, SetVariable.

juskin
01-08-2009, 07:44 AM
so here is my flash var
<PARAM NAME=FlashVars value=”noIntro=bee”>

and here is the actionscript code:
stop();

if(noIntro == "bee") {
gotoAndStop(355);
} else {
gotoAndPlay(2);
}

so why is it not going and stopping at 355?