PDA

View Full Version : javaS


bahrami
05-02-2002, 06:48 PM
Hello!!

Does anyone here know the code of how to display the screen-width in a flash textfield.

I tested this,

on (release) {
_root.text = getURL ("javascript:(screen.width)");
}

but it shows the result in a browserWindow

Jesse
05-03-2002, 11:30 AM
You've got the right idea but you need to write a JS function which will return the answer to Flash. See the FSCommand library tutorial which covers how to comunicate between JS and Flash.

bahrami
05-05-2002, 04:47 PM
I have this now!!

<script language="javascript">
var screenW = screen.width;
// flashfilename is the id of the swf, as set in the object and embed code. screenWidth is the variable in the swf that holds the screen width value.
window.document.flashfilename.setVariables("screenWidth", screenW);
</script>


But I still can't find how to sent the variable from js to flash(FSCommand help here).
if you know anything please drop me a note here!!

"cheers" like YOU use to say ;)

Jesse
05-07-2002, 02:29 PM
I've always avoided thsi to be honest but from my understanding of the process this line should do the variable setting:
window.document.flashfilename.setVariables("screenWidth", screenW);
Does this code appear and get executed before the Flash movie in the HTML? Maybe you need to put the code in a function and call the function after the embed tags of the Flash file... not too sure really.

tg
05-07-2002, 07:28 PM
this was done by developette.com. they read the value into flash from flash using getURL("javascript:...");
here is the source i got from their site.