Skip to main content
gwegas
Participant
June 2, 2020
Answered

A dynamic link based on frameLabel ?

  • June 2, 2020
  • 1 reply
  • 826 views

Hello !
I start with Adobe Animate and try to create a dynamic link based on what is displayed on the screen.
"FLAC", "GAUCHE" and "DROITE" are each activated by buttons ...
If anyone can help me, I would be delighted !!!
THANK YOU SO MUCH

 

var _this = this;
var contenance = _this.FLAC.currentLabel
var num1 = _this.GAUCHE.currentLabel
var num2 = _this.DROITE.currentLabel

_this.CMD.on('click', function(){
window.open('https://website.com/produit/'+ contenance +'ml/?attribute_senteur-n1='+ num1 +'&attribute_senteur-n2='+ num2, '_blank');
});

 

 

 

This topic has been closed for replies.
Correct answer Gooneybird12

Without the FLA, I can't be certain of how this is supposed to work, but shouldn't you check the currentLabel each time you click instead of just once before?

 

 

var _this = this;
_this.CMD.on('click', function(){
var contenance = _this.FLAC.currentLabel
var num1 = _this.GAUCHE.currentLabel
var num2 = _this.DROITE.currentLabel
window.open('https://website.com/produit/'+ contenance +'ml/?attribute_senteur-n1='+ num1 +'&attribute_senteur-n2='+ num2, '_blank');
})

 

1 reply

JoãoCésar17023019
Community Expert
Community Expert
June 2, 2020

Hi.

 

The string concatenation that forms the URL seems to be correct.

 

Have you checked if the values you're getting from the labels are correct?

gwegas
gwegasAuthor
Participant
June 2, 2020

The link works but the values do not change whatever the image displayed in FLAC, GAUCHE and DROITE...

Is there something missing to update each of the "currentLabel" with each click?

Thank you !!

Gooneybird12
Gooneybird12Correct answer
Participating Frequently
June 2, 2020

Without the FLA, I can't be certain of how this is supposed to work, but shouldn't you check the currentLabel each time you click instead of just once before?

 

 

var _this = this;
_this.CMD.on('click', function(){
var contenance = _this.FLAC.currentLabel
var num1 = _this.GAUCHE.currentLabel
var num2 = _this.DROITE.currentLabel
window.open('https://website.com/produit/'+ contenance +'ml/?attribute_senteur-n1='+ num1 +'&attribute_senteur-n2='+ num2, '_blank');
})