Skip to main content
Scorpio Jack
Participating Frequently
March 24, 2016
Answered

Buttons and actions

  • March 24, 2016
  • 1 reply
  • 14465 views

I haven't used Flash in over a decade and I am brand new to Adobe Animate (got it yesterday).

I am trying to apply a go to web page action to a button, but overtime I do that it overwrites my stop action for the animations. after exerting as an .swf file, my go to web link doesn't work and the animation doesn't stop. Where should I apply the button go to action if not on the main stage, and how do I get the animation to stop without getting errors?

Please help.

Thanks,

Jack

This topic has been closed for replies.
Correct answer UDESCO

so it looks like I was doing a couple things wrong, keying my code manually from the tutorial, I keyed the letter f and the numeral 1 instead of "fl_" corrupting my function code.

I still haven't figured out how to export this file for my universally user-friendly banner. I just published and viewed in my browser, an empty, white rectangle.

Thanks, again!!!


Hi,

This is a comprehensive resource of everything you may need - Need HTML5 Ads? Adobe Animate CC to the Rescue! | Adobe Animate Team Blog

For starters, you can try exporting non interactive banners made in HTML5 canvas doctype. Then add code at appropriate frames wherever you need.. Eg. add this.stop() in the last frame to stop animation loop-over.

Use Code snippets to add actions for commonly used tasks - like a click handler. (Make sure you use the appropriate code snippet as per the current document.) Also, please note that  Code snippets are more for reference. In case you wish to add/combine multiple actions you may need to make adjustments should you see any error in the Browser console.

If you're still getting stuck, post your Fla file/code here for us to look at.

1 reply

Legend
March 24, 2016

It's impossible to know exactly what you're doing wrong without seeing your code.

Scorpio Jack
Participating Frequently
March 25, 2016

This is the code in the on the main stage > action layer > last frame:

/* Stop at This Frame

The Flash timeline will stop/pause at the frame where you insert this code.

Can also be used to stop/pause the timeline of movieclips.

*/

stop();

This stops the animation correctly.

When I apply an HTML 5 action (Click to go to Web page) to a button instance on the same stage, Animate adds the following code below the stop code, so my code now looks like this:

/* Stop at This Frame

The Flash timeline will stop/pause at the frame where you insert this code.

Can also be used to stop/pause the timeline of movieclips.

*/

stop();


/* Click to Go to Web Page

Clicking on the specified symbol instance loads the URL in a new browser window.

Instructions:

1. Replace http://www.adobe.com with the desired URL address.

   Keep the quotation marks ("").

*/

this.movieClip_8.addEventListener("click", fl_ClickToGoToWebPage_8);

function fl_ClickToGoToWebPage_8() {

  window.open("http://www.adobe.com", "_blank");

}

Animate informs me that I can only apply the requested action to a movie clip and converts my button instance, then I get the following error message:

Scene 1, Layer 'Actions', Frame 129, Line 20, Column 2  1120: Access of undefined property window.

When I view my new .swf file anyway in preview, the stop action no longer applies, looping my animation indefinitely, and the button doesn't link to anything. (I intentionally left the adobe link in there just for testing.)

Thanks for your help,

Jack

Legend
March 25, 2016

"HTML5 Canvas" snippets are intended for use with HTML5 Canvas documents. Of course they won't work in an AS3 document. The snippet you want is under ActionScript / Actions / Click to Go to a Web Page.