View Full Version : Variables to/from Flash in Dreamweaver
AXXESS
06-29-2005, 11:53 PM
Alright, Flash/Dreamweaver gurus out there... :)
I am building applications in Dreamweaver using the CourseBuilder extension. A feature of this extension is a frameset with a static nav bar with pages loaded below as they are called from the nav bar or menu.
On each of the html pages there is an swf. Each of the swfs has a text box and buttons to show and hide the text box. What I need to do is globally control the text boxes. For instance, when "hide text" is clicked, ALL text boxes need to be hidden, even on subsequently loaded swfs.
In the past (using a Flash container rather than Dreamweaver) it was easy to set a global variable and accomplish this task. I am beginning to think that I will need JavaScript to control this function within Dreamweaver.
Anybody familiar with how this is accomplished? :)
Corey
06-30-2005, 12:55 AM
Wish I could help but I'm not familiar with the CourseBuilder extension... :o
AXXESS
06-30-2005, 08:44 AM
The CourseBuilder info was just given as reference... actually its just a frames setup with the nav bar in the upper frame controlling the pages loaded below that contain the swfs. There is other "eLearning" type stuff with CourseBuilder that is irrelevant to this example and what I am trying to accomplish.
I need the swfs to be able to set a variable for the visibility of the text boxes from any swf. I will also need each page to check this variable as it loads to determine whether or not to show the text box within each swf.
Hmm...
Corey
06-30-2005, 02:00 PM
Well off the top of my head it sounds like a job for FScommands and Javascript. :yes
AXXESS
06-30-2005, 03:44 PM
I will update when I figure this out! :yes
Corey
06-30-2005, 03:46 PM
Sounds cool, I'm timing you. [tick, tick, tick, tick] :yes
AXXESS
06-30-2005, 03:52 PM
Sounds cool, I'm timing you. [tick, tick, tick, tick]
**Insert "Jeopardy" theme music here...** :D
AXXESS
07-03-2005, 02:56 PM
It appears that pulling this one off would take some major Java knowledge and application experience. Especially due to the fact that I am trying to communicate across frames . :rolleyes
Oh well, the global variable function in Flash still works great to hide all of the sequential text boxes on a given page... :) Methinks maybe I was trying to get a little too fancy :).
As Corey once said... "Gotta steamroll these things..." :yes
Corey
07-03-2005, 03:57 PM
Naw, it's pretty easy even with frames, it's just a simple matter of variables. Not sure how your Flash is set up so I just created a simple text example for you here. It's a frameset which holds links and content pages. Just unzip and run "index.html", it's self explanatory. Note that in this case I set it up so that the hide/show links just toggle a variable, so after hiding/showing, you will still have to click on a page link to actually observe the change. :yes :)
AXXESS
07-03-2005, 04:20 PM
Thanks, I see how you are doing that with Java alone... :yes
BUT the huge issue was having a "hide text" flash button on ANY of the Flash pages communicate with the html nav frame, and then upon loading the next swf in the adjacent frame.... have the nav frame communicate the hidden text state to the loaded swf.. until "show text" is clicked again...
Corey
07-03-2005, 04:27 PM
You lost me at "adjacent" but anyhow it's just as easy any way you want to set it up, it's all just client-side variables. The bottom line is that you can set and refer to variables freely between any of your frames/swfs, it's just a matter of scripting it. It's not that hard really, you would just use flag variables. So in other words whenever a "hide" link is clicked, it sets a global variable in the nav frame, i.e. "showText=0;" and then the "show" links reset that global variable, i.e. "showText=1;". Simply set your .swf pages to check that variable onLoad with an if statment and hide/show the text accordingly. :yes
If statements in Javascript are really easy, same as in PHP, i.e.:
if (condition to meet) {
code to run
}
FWIW "Java" and "Javascript" are very different things, this is just Javascript, I have no Java programming skills. Java is significantly more difficult to learn and use than Javascript. :yes
BTW for a better analogy think of your Javascript in terms of your Flash. So you know how in Flash we refer to variables by going _root.myMovieClip.myVariable? Well it's basically the same in Javascript when we go top.frames['left'].showText... :yes
In the case of "top.frames['left'].showText", "top" means top level, "frames" is the name of your frameset (as defined by the <TITLE> tag), "left" is the name of your target frame (as defined in your frameset), and "showText" is the variable name. Almost exactly like Flash as you can see. It's a lot easier than you think for sure, Javascript has a reputation for being a very easy language to learn and use. :yes
AXXESS
07-03-2005, 06:21 PM
You lost me at "adjacent"
Sorry :) . Um, I meant the frame right below the horizontal nav frame on the top of the page. (I should have written that more clearly). :rolleyes
Thanks for the info. Possibly I was trying to read wayyy too far into this... I will keep working on this one... :yes
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.