Groups | Blog | Home
all groups > flash actionscript > june 2004 >

flash actionscript : JavaScript returning values to flash


redboxinteractive
6/6/2004 10:01:59 PM
OK guys, got a good working php script, but need it to run client side nbot
server side, so Im assuming javascript, but if you think somethin diff let me
know. I dont know javascript, though, so if someone could translate the php to
javascript (or other client side) that would be awesome. I know that Ill have
to adjust some values, just need to know
1. how it should look, and
2. anyone know how to view output of javascript? (some "trace" type function)
3. how to call from flash and return values to flash.
Thanks all,
-RedBox

Heres the php:

<?php
$dataURL =
// Target php file's address with initial variables appended
$sneak = file_get_contents($dataURL); //read php with
initial variables sent
$new = stristr($sneak, "URL="); //crops off
extra data at beginning
$meat = substr($new, 23, 152); //crops off end
data leaving the new variables
$redirec = ($dataURL."&".$meat); //target php's
address with new variables
file_get_contents($redirec); //read
result of php with new variables sent
?>
B
6/6/2004 10:14:02 PM
Hi, I can answer #2 and possibly point you in the right direction for #3

To view output in Javascript use this:
<script language = "javascript">
document.write ("Here is a string and a variable: " + variableName + "!!!")
</script>

In answer to #3, you might want to check out the JavaScript Integration Kit
for Macromedia Flash MX and MX 2004. You can download it at:

http://www.macromedia.com/cfusion/exchange/index.cfm?view=sn121&extID=1009905

I think it can only be used as a Dreamweaver extension, so hopefully you have
Dreamweaver.

Brenda
DannyPatterson
6/7/2004 4:02:21 AM
Trace type output can be done using the alert() funciton.

alert("Output Text");


Calling a method in javascript from Flash is a one way transaction. The
javascript method cannot return a value to flash. You would have to have your
javascript function manually pass the data back to flash via another function
call. I suggest looking into the fscommand to do this.
Jeckyl
6/7/2004 2:17:30 PM
The javascript() function finishes before the javascript code is even
started .. so you cannot return a value as a function return value.

However, your javascript code CAN directly modify values in the movie. So,
for example, you could pass the name of a variable to your javascript code
and that code can then set the variable to a value.

AddThis Social Bookmark Button