html var to flash text area
- Started
- Last post
- 19 Responses
- xrusos
ok, so i know html doesn't have variables!
BUT, here's what i want to do...
i have a project with a flash header. part of the header is the title of the page (i.e. Latest News, Portfolio, Contact, etc.)
Instead of creating separate swf's for each page, i'd just like the pagetitle text to be a variable that reads some line in the the html code.
make sense? i'm sure it'll probably have to be done through js in some way, but i'm not sure. i also want to avoid sending .htm?var=PageTitle - type variables in the url (looks gross, and can be changed)
alright, what'd'ya say? a tutorial on the issue? a sample fla?
- shaft0
"flashvars" is your google search keyword. Ehh, ok:
http://www.macromedia.com/suppor…
When you've mastered it, try to figure out how these headers work: http://www.shauninman.com
Pretty neat trick.
- xrusos0
thanks... i'm looking into it.
as for shaun's site... i'm a step ahead of you there. i've already implemented some mose menus in my day. they are sweet, but only for standards compliant browsers (not IE!).
more on how to for those menu's:
http://www.mezzoblue.com/archive…
- unfittoprint0
A simple way to do it is to pass the variable though an HTML tag. Check the following link for more info: http://www.macromedia.com/suppor…
- arlo0
What he said. If you have 4 or 5 html pages that all require the header to be custom, do it in the embed/object tags. The end user won't see that. If you have one template page as the handler though, querystringin' it wouldn't be that bad, as it acts as a page indicator of sorts.
- xrusos0
okay, let me spice it up another notch...
so my html page loads a loader.swf page that in turn loads 2 more swfs that make up the header (nav and background swfs).
so... the loader.swf doesn't need the variable - BUT it does need to pass the variable on to the nav.swf ---
HOW do i do that?
- shaft0
xrusos, shaun did there just the thing you were asking about - passing variables to headers using flashvars, but in a kind of interesting way. Takes a while to figure out.
- xrusos0
ah, you're talking about his FIR deal? gotcha.
- arlo0
LocalConnection can make them talk.
- shaft0
April 19 - see? The mystery came out just for you :)
- unfittoprint0
you can pass variables using javascript and then use document.write to er, write the variable value in the embed tag of the flash object.
- xrusos0
thanks, but that looks too complicated... i just need a simple pagetitle variable sent from the html to the loader swf to the final swf. and the last step is the only gap.
what about FSCommand or JavaScript solutions?
- xrusos0
(sorry, didn't refresh. my last response was intended for arlo)
thanks unfit, reading through it now.
- xrusos0
okay, can't i just include a bit of ActionScript in the loader/middle-man swf that re-introduces the variable that the html doc sent?
like this:
html doc - sends pagetitle var
loader swf - reads pagetitle var
loader swf - sets pagetitle var to "pgt", then sets filename to nav.swf? + pgt
loader swf - says something like loadmovienum(filename, 1)so what would the actionscript look like for this?
btw, i really appreciate your help. you guys are champs.
- xrusos0
ah ha!
var PageTitle;
pgt = PageTitle;
path = "/path/nav.swf?PageTitle=";
loadMovieNum(path+pgt, 2);and it works!
- Mick0
You can pass variables through the embed/object tag where you insert your movie name...
embed src = "movie.swf?pagetitle=home" - done. change the pagetitle value on each html page.
- shaft0
embed src = "movie.swf?pagetitle =home" is limited to 256 characters only and each instance of "?" makes the browser reload the swf again. I would go with the flashvars option.
- shaft0
btw, xrusos, all you need to do to pass the variables is: loadMovieNum("second.swf", 1, "GET");
or just
loadMovieNum("second.swf", 1);
and access the variables _level0.variable
- xrusos0
thanks shaft.
how do i do that if the variable is just a text area? label the text area variable, "_level0.qwerty"?
will that work?
and the "GET" strategy, does that get all variables from the current movie and pass them on?
- shaft0
"label the text area variable, "_level0.qwerty"?"
Exactly.
"and the "GET" strategy, does that get all variables from the current movie and pass them on?"
As far as I tried, only the _root variables, probably current mc's.
Strange thing, when you load a mc into an empty target mc without GET, you can't access the _root variables from it. Somebody correct me if I'm wrong.