Hi,
There are 2 things that i notice:
Your code here is very cpu intensive. It could cause
De browser to hang if you pause with big number of millisecs cause then
you're taking all the resources cause of the while(true) ....
You could do it very lightweight with one call of setTimeout:
Try
function pause(numberMillis) {
//var now = new Date();
//var exitTime = now.getTime() + numberMillis;
//while (true) {
// now = new Date();
// if (now.getTime() > exitTime)
// return;
//}
setTimeout ("doSomethingUseful()", numberMillis);
}
function doSomethingUseful() {
alert("hi");
}
The other thing is that you call
for (i=0; i<10; i++) {
var speed=10*i;
var perce=speed;
flashProxy.call("displayText", "100");
}
That means that the function flashProxy.call("displayText", "100");
Is called ten times probably within 1 enterframe of the flash.
If I'm not wrong I've read there was an issue with this.
Only one call to flash per enterframe was possible. Otherwise the thing
would get messed up. So I would comment out the loop and call the function
just once.
function simula() {
//for (i=0; i<10; i++) {
//var speed=10*i;
// var perce=speed;
// flashProxy.call("displayText", "100");
//}
flashProxy.call("displayText", "-");
alert('fine');
}
I never got the need for using the integration kit yet, so I can't say if
your setup is ok.
Hope I helped a bit.
Good luck,
Arnoud
-----Oorspronkelijk bericht-----
Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens
[EMAIL PROTECTED]
Verzonden: maandag 8 mei 2006 15:40
Aan: osflash
Onderwerp: [osflash] (no subject)
Hi all,
I'm trying to use "Flash JavaScript Integration Kit" .... without success.
My javascript function can't call my flash functions and I don't undestand
why.
In my html I have:
<script type="text/javascript"
src="/search/jss/flash/Exception.js"></script>
<script type="text/javascript" src="/search/jss/flash/FlashTag.js"></script>
<script type="text/javascript"
src="/search/jss/flash/FlashSerializer.js"></script>
<script type="text/javascript"
src="/search/jss/flash/FlashProxy.js"></script>
<script type="text/vbscript"
src="/search/jss/flash/VBCallback.vbs"></script>
........
<SCRIPT language="Javascript">
var uid = new Date().getTime();
var flashProxy = new FlashProxy(uid, 'myFlashContent',
'/swf/JavaScriptFlashGateway.swf');
</SCRIPT>
<SCRIPT language="Javascript">
function pause(numberMillis) {
var now = new Date();
var exitTime = now.getTime() + numberMillis;
while (true) {
now = new Date();
if (now.getTime() > exitTime)
return;
}
}
function simula() {
for (i=0; i<10; i++) {
var speed=10*i;
var perce=speed;
flashProxy.call("displayText", "100");
}
flashProxy.call("displayText", "-");
alert('fine');
}
</SCRIPT>
..........
<script type="text/javascript">
var tag = new FlashTag('/swf/prova_flash.swf', 550, 400,
'7,0,14,0');
tag.addFlashVars('lcId=' + uid);
tag.setId('myFlashContent');
tag.write(document);
</script>
...........
<tr>
<td colspan="2" align="center"><INPUT TYPE="button" VALUE="Simula"
onClick="simula();"></td>
</td>
My flash actionscript frame 1 starts with:
import com.macromedia.javascript.*;
var proxy:JavaScriptProxy = new JavaScriptProxy(_root.lcId, this);
.........
function displayText(text):Void
{
testo_speed.text = text;
testo_speed.hscroll = 0;
};
stop();
But it seems that my flash action displayText is never called.
Can some give me a little help?
Thanks
Marco
_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org
_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org