jQuery(this) and ExternalInterface -
hey guys, i've got externalinterface call javascript function. how can use jquery target .swf called function?
for example, i'm calling "changeobject" function using externalinterface. how jquery modify same flash files object tag? have , doesn't work:
function changeobject() { jquery(this).css('height','500px'); };
jquery(this) get's returned undefined. not know id of object element. it's dynamic id. there multiple .swf's on page too.
thanks!
so set new flashvar unique playerid. this:
var flashvars = {}; flashvars.src = '<?= $this->get('link') ?>'; flashvars.playerid = '<?= "flash-".uniqid(); ?>'; var params = {}; params.allowscriptaccess = 'always'; var attributes = {}; attributes.id = '<?= $this->get('attributeid') ?>'; swfobject.embedswf('<?= $this->get('pluginurl') ?>/flash/wiredriveplayer.swf', 'no-flash-content', '100%', '100%', '10.0.0', 'expressinstall.swf', flashvars, params,attributes);
i setup flashvar in actionscript (in model.as):
// add "declare private vars" section private var _playerid:string; // add private function init(flashvars:object) section _playerid = flashvars.playerid; //add public functions section public function playerid():string { return _playerid; } //add public function endofitem() section // inform javascript flv has stopped playing externalinterface.call("stoppedplaying", _playerid);
then in javascript have playerid use this:
function stoppedplaying(playerid) { // when flv starts playing var playerid = '#' + playerid jquery(playerid).css('background','red'); }
so use arg playerid instead of (this) in jquery. happy!
Comments
Post a Comment