PDA

View Full Version : Controlling movie clip with dynamic text variable


howdy
08-14-2008, 02:10 PM
Hi,

I'm trying to get some html links to control a .swf. I'm going to use setVariable to change a dynamic text box's Var. When the Var changes, I want a movie clip to play.

So far, I've been able to get the Var to update based on a form button in the html:


<SCRIPT LANGUAGE="JavaScript">
<!--
function changetext(str){
if(window.Dog) window.document["Dog"].SetVariable("var_myText", str);
if(document.Dog) document.Dog.SetVariable("var_myText", str);
}
//-->
</SCRIPT>
</head>
<body bgcolor="#ffffff">

<object classid="yada yada" codebase="http://yada yada" width="75" height="150" id="Dog">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="Dog.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<embed src="Dog.swf" quality="high" bgcolor="#ffffff" width="75" height="150" name="Dog" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
<form name="form1" method="post" action="">
<input type="button" name="One" value="hello" onClick="changetext('hello')">
</form>
</body>


This updates my dynamic text box Var (var_myText) with "hello." I've cleared the Var out initially using:

var_myText.text = ""

I want a movie clip to play when it gets a value from setVariable. In fake syntax, basically:


stop(); //bc i don't want it to play until i send a value

if (var_myText.text = "hello"){
movieClip.play();
}

Make any sense? I'm always surprised that people are so helpful, so thanks in advance for your time and knowledge.

John

howdy
08-14-2008, 08:02 PM
I needed to use an onEnterFrame loop to check the variable constantly.