Highlighted

Buttons and actions

New Here ,
Mar 24, 2016

Copy link to clipboard

Copied

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

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.

Topics

How to

Views

10.8K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Buttons and actions

New Here ,
Mar 24, 2016

Copy link to clipboard

Copied

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

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.

Topics

How to

Views

10.8K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Mar 24, 2016

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
Mar 25, 2016

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Mar 25, 2016

Copy link to clipboard

Copied

"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.

Likes

2 Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
Mar 25, 2016

Copy link to clipboard

Copied

my file is called <name>.fla (Canvas). I thought this was an HTML 5 canvas file. This may also be the root cause of my other question on the board, what are the correct publish/export specs to create a multi-user, multi-platform, multi-device ad banner.

confused and frustrated...

Thanks

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Mar 25, 2016

Copy link to clipboard

Copied

You've said that you're creating a SWF. Canvas documents cannot create SWFs.

If you're working in a Canvas document, only use Canvas snippets. If you're working in an AS3 document, only use ActionScript snippets. The code you posted above is a mix of both.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
Mar 25, 2016

Copy link to clipboard

Copied

OK, so I am working in a canvas doc , at least this is how my file name displays:

.fla (canvas)  

so then my problem is two-fold:

A) How do I create a button in which the action to go to a web site does not interfere or cancel the stop action at the end of the sequence?

and

B) What are the correct export or publish parameters needed to create my universally user-friendly banner ad?

🙂

Thanks,

YOU ROCK!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Mar 25, 2016

Copy link to clipboard

Copied

Button actions have absolutely nothing to do with stopping or starting the timeline.

To make a click on a button open a web page, just create a button symbol, name it, then paste the standard code on the timeline:

/* 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.mybutton.addEventListener("click", fl_ClickToGoToWebPage);

function fl_ClickToGoToWebPage() {

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

}

Likes

1 Like

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
Mar 25, 2016

Copy link to clipboard

Copied

RE: "Button actions have absolutely nothing to do with stopping or starting the timeline."

Yes, I understand, but after inserting the "go to url" action, my "stop" action no longer works, continuously looping my animation. I'm assuming this is because all actions go on the same action layer.

If you go a few panels up in this thread, you'll see my code where Animate added the "go to" code directly under my "stop" action.

I've tried multiple export/publish actions and nothing seems to work.

This code looks slightly different, I'll try this next.

Thanks again!!!!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Mar 25, 2016

Copy link to clipboard

Copied

That stop action shouldn't work at all, since the correct syntax in Canvas mode is "this.stop();".

When things suddenly stop working in Canvas mode, it's almost always because of a JavaScript error somewhere. Pop open the developer console (F12) and look for error messages.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
Mar 25, 2016

Copy link to clipboard

Copied

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!!!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Employee ,
Mar 27, 2016

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
Mar 28, 2016

Copy link to clipboard

Copied

Hi Nipun,

Thanks for this. My animations, links, and actions all work perfectly when I Control > Test my animation in my browser. It's the publish settings I seem to be having trouble with. My Dreamweaver code shows only a blank rectangle the size of my stage.

Jack

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...