Recent Widgets


Register for DashboardWidgets

Recent Forums Posts

Partners


iCompositions

MacDesktops.net

RSS Showcase
RSS Comments
RSS Forums

This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. Posted in: Widget Development

Cant send flash variables

Author Message
geckointernet



Joined: 06 Jul 2008
Posts: 1
Location: Vancouver

Posted: Wed Aug 20, 2008 - 2:41 pm    Post subject: Cant send flash variables Reply with quote

I am trying to use SetVariable to change a value of a flash movie embedded in the widget. Every time i run this:

window.document.movieObject.SetVariable("testValue", "test");

the javascript in the widget seems to silently stop executing, i have tried wrapping it in a try / catch, but that does not alert any errors

Here is the javascript snippet.

var fm = window.document.movieObject;
if(fm){
var settime = function(){
var t = (new Date().getTime());
alert(fm.id +" "+t); // alerts MovieObject 121926099713
try{
fm.SetVariable("_root:audio_time", t);
}catch(e){
alert("error "+e);
} // alerts nothing
alert(fm.id +" "+t); // alerts nothing
}
//settime();
setInterval(settime, 1500);
}

Have anyone had any success sending variable to flash at runtime?
View user's profile Send private message Send e-mail Visit poster's website Widgets
thewilson



Joined: 28 Aug 2008
Posts: 18

Posted: Thu Aug 28, 2008 - 2:46 pm    Post subject: Reply with quote

Are you certain that fm is evaluating to true? If you never enter that first block you wont get any further.

It looks like this is something flash specific google brought me here
http://www.adobe.com/support/flash/publishexport/scriptingwithflash/scriptingwithflash_03.html

SetVariable takes two strings as an argument.

With the information on that site and assuming you named the embed and object tags id="movieObject"

Code:

var movie = window.document.movieObject;
var t = (new Date().getTime());
if(movie)
{
var testValue = movie.GetVariable("_root:audio_time");
      if(testValue != null)
      {
        movie.SetVariable("_root:audio_time", ""+t);
      }
      else
      {
        alert("Object exists variable does not");
      }
}
else
{
alert("Object does not exist");
}



This is running with the information off of the Adobe site I don't have the software to create a custom flash object to test with.

Good Luck post status updates please Very Happy
View user's profile Send private message Send e-mail Widgets
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.

 
Powered by phpBB © 2001, 2002 phpBB Group