PDA

View Full Version : [MX] loadMovie - swfLiveconnect



M.C.B.
March 2nd, 2004, 01:47 PM
wazup people!

I need an urgent help!!!

I need do load an JPG dynamically. The URL is variable pase by Javascript.

So... I have do create de variable in the JS e send it fo Flash.

I'm getting this variable already. Using swfLiveconnect, and in the javascript the method SetVariable(var,value);

I'm changing de value of the var. I can chage textfields, but the method loadMovie isn't working, by putting de URL param as the variable I get from javascript.

Could you help me?

Here goes the code I'm using:

HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script language="JavaScript" type="text/javascript">
var Url = "01.jpg";

function loadJpg()
{
Url = "01.jpg";
document.myMov.SetVariable("location",Url);
setTimeout(loadJpg,1*1);
}
</script>

</head>

<body>

<object id="myMov" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="550" height="400">
<param name="movie" value="zoom_component.swf">
<param name="quality" value="high">
<embed name="myMov" swfLiveconnect="true" src="zoom_component.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="550" height="400"></embed></object>

</body>
</html>



FLASH

getURL("javascript:loadJpg()");
loadMovie(location,mcComp.mcImg.mcTarget);


Thanks!!!

M.C.B.
March 2nd, 2004, 02:41 PM
Yo!!! I did!!!

Here's the right way of doing this:


Java Script
<script language="JavaScript" type="text/javascript">

function loadJpg()
{
Url = "01.jpg";
document.myMov.SetVariable("location",Url);

}
</script>


FLASH

_root.location = "";
getURL("javascript:loadJpg()");
_root.watch("location", function(name, oldValue, newValue){//Watches if de value is changed. Then, if Yes, execute a function
txtLoc.text = newValue;
mcComp.mcImg.mcTarget.loadMovie(newValue);
});

claudio
March 2nd, 2004, 02:43 PM
Try:
getURL("javascript:loadJpg()");
function updateVar() {
if (location != undefined) {
clip.loadMovie(location);
clearInterval(id);
}
}
id = setInterval(updateVar, 50);

claudio
March 2nd, 2004, 02:53 PM
Ah yes, better use Object.watch :beam: