Language: ChineseGermanSpanishFrenchDutchItalianRussian
123 Flash Chat Forums

Go Back   TOPCMM Community > SWFKit > SWFKit Support

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-04-2004, 07:16 AM
Member
 
Join Date: Sep 2003
Posts: 95
Default Issue relating to updateData.

Hi,

I have a Flash application that contains a number of variables on the _root level of my main .swf. My application has a volume control (which a user can increase or decrease), and so one of the variables stores how "loudly" the sound should be played. Code which sets it is similar to the following:

Code:
// set volume variable
FlashPlayer.setVariable("control.volume.vol", vol);

// play the submovie
pla.bindData("control.volume");
pla.updateData(true);

pla.targetPlay(pla.control.volume);
However, some time after this I call another SWFKit function which binds a number of OTHER variables to a different pla object using the following code:

Code:
var pla = new FlashPlayer;

//bind the variables between flash and SWFkit
pla.bindData("_root.link", "_root.name");

//collects variable values from flash
pla.updateData(true);
.
.
.
// set the variables in Flash
pla._root.link = whatever;
pla.updateData(false);
As soon as the pla.updateData(false) is invoked, the variable storing the volume is "cleared", and the sound is suddenly played as loudly as possible....

It looks like pla.updateData(false); might be deleting any variable entries that are not explicitly bound to the pla object before making the call?

I don't use setVariable here as there seemed to be a timing issue between setting the variable and Flash actually receiving it.

Any ideas would be great.

Cheers,

G.
Reply With Quote
  #2 (permalink)  
Old 05-05-2004, 08:31 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Issue relating to updateData.

The "bindData" method won't override the bound variables. When calling the second updateData method, you get three bound variables, "control.volume", "_root.link" and "_root.name". The method will update all of them.

You can call the "unbindData" method to avoid the problem. In fact, you don't need to bind a component or movie clip. I think you can do like this
Code:
pla.targetPlay("_root.control.volume");
The value of a component or a movie clip is just its name. E.g., a button named "btn" in _root, its value is "_level0.btn", so you don't need to bind it and call "updateData" to get its value.
Reply With Quote
Reply

Was this information helpful?    Yes No



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 06:16 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.