CODE SNIPPET: Dynamic banner in a few clicks

Useful functions

Documentation DCO Enabler -> ENABLER ADOBE ANIMATE CC -> Useful functions

 

 

ClickTag : 

You can add two types of clickTag (more information):

 

1. A clickTag on your entire scene:

 

Click on “⧯ ClickTag: All Stage“, the following code is injected:

stage.addEventListener("stagemousedown", function(e){click(e);} );
function click(e){ADventori.click();}

The click is now managed. But not the mouse cursor, click on” Cursor Enable : Stage“, the code below appears:

stage.canvas.style.cursor = "pointer";

The clickTag in the entire scene is now correctly implemented.

 

Result:

 

 

2. One or more clickTags on your buttons or movieClips:

 

Select your movieClip, and click on “ ClickTag: MovieClip“. The following code is injected:

/*this.item1, this.item2...  --> Button/Clip To make clickable
Add a listenner on each element that calls the click function with parameter url of the click
*/
this.movieClip_1.addEventListener("click", function(event){click(event,ADventori.data.url)});
function click(event,url){ADventori.click(event,url);}

Make sure to reference the correct URL (see above).

The click is now managed on the movieClip, but not the mouse cursor.

Two options are available: either declare the movieClip as a “button” or click on “✋ Cursor Enable: MovieClip”.  The code below appears:

this.movieClip_1.cursor = "pointer";
var frequency = 5;
stage.enableMouseOver(frequency);

 

Result:

 

 

 

Useful comments:

 

Mobile touch✋ : You can activate the “Touch” option for mobile in your banners.

  • Either in the entire scene, by clicking on “☎ Touch Enable all Stage for Mobile”.
  • Either in a movieClip, by selecting it and clicking on “☏ Touch Enable MovieClip for Mobile”.

Loop : You can also control the number of loops in your banner: select the last frame and click on “♋ NbLoop”:

ADventori.AdobeAnimate.maxLoop(this,2);

Enter the desired number of loops.

 

Result: