Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


"Go To Webpage" Actionscript Causing Button to Disappear - otherwise appears - ??

Community Beginner ,
Feb 23, 2019 Feb 23, 2019

Copy link to clipboard

Copied

The title pretty much says it all and I'm not even bothering to include a file. Here's the sequence:

1. draw a square --> convert to symbol --> button.

2. add over and hit states (different colors) and test (in my animate cc, chrome opens to show the button, if that matters). the button works fine. I see the square and it flashes when I click it.

3. close test (close Chrome browser).

4. select button, hit F9 (actions) --> code snippets --> Actionscript --> Click To Go To Webpage...(double click)

5. don't change anything (I left adobe.com but it didn't make a difference after i tried changing it anyway to something else).

6. test again. Chrome opens up, this time blank.

7. remove actionscript from the actions (i literally deleted just the active code but left the commented language so SOMETHING was in there).

8. Button works fine again!!! I can toggle between ActionScript and no ActionScript to reliably toggle the button disappearing/reappearing 100%of the time. As stated, this is all done by just selecting control --> test.

Finally:

9. restart animate, restart computer, eventually re-install photoshop and animate (3 hours ago, obviously an iterative process)

NO CHANGE.

HELP PLEASE--THIS IS INSANE. WAS THIS BROKEN IN THE LAST UPDATE??

TOPICS
Discussions

Views

2.1K

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
community guidelines

correct answers 1 Correct answer

Advocate , Feb 25, 2019 Feb 25, 2019
Alright Patrick,I had a look at www.thirddcahistoricalsociety.org at that what you always describe as toolbar. I dug myself into the structure and logic of your <object> element (Dreamweaver work I suppose) and came finally to yourNavigationBarand from there to the code behind it:http://www.thirddcahistoricalsociety.org/animation_assets/NavigationBar/Assets/NavigationBar.jsSince I asked you "how come that you are back to Actionscript?" -  and you answered "I'm onto AS because I need animation fo...

Likes

Translate

Translate
Adobe Community Professional ,
Feb 23, 2019 Feb 23, 2019

Copy link to clipboard

Copied

Hi.

I'm sorry about that.

Can you show us the code? My best guess is that the comment characters are not being properly started/ended.

Regards,

JC

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
community guidelines
Community Beginner ,
Feb 23, 2019 Feb 23, 2019

Copy link to clipboard

Copied

Of course, but as I said, I just selected the button, then double-clicked

in the "go to webpage" icon, leaving what animate cc generated verbatim.

That text is as follows (as mentioned, when I remove it, button appears:

/* 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 ("").

*/

button_1.addEventListener(MouseEvent.CLICK, fl_ClickToGoToWebPage);

function fl_ClickToGoToWebPage(event:MouseEvent):void

{

navigateToURL(new URLRequest("http://www.adobe.com"), "_blank");

}

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
community guidelines
New Here ,
May 13, 2020 May 13, 2020

Copy link to clipboard

Copied

LATEST

This actually worked for me!

I was banging my head trying using Adobe's Animate default "Click to Go to Web Page" action and getting errors all the time. Replaced with your code like you suggested and it worked and once. 

 

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
community guidelines
Advocate ,
Feb 24, 2019 Feb 24, 2019

Copy link to clipboard

Copied

Hi Gaptooth

Just to exclude that there is anything wrong with comments not correctly started or ended, please do the follpwing:

Delete everything in the Actions panel (comment and active actionscript - empty it completely!) and make sure you instance-name you button button1 - (property panel, in every possible keyframe).

Now open Actions panel again and paste this:

button1.addEventListener(MouseEvent.CLICK, loadWebpage);

function loadWebpage(evt:MouseEvent):void {

    navigateToURL(new URLRequest("http://radio.garden/"), "_blank");

}

Now test it : once with Control -> Test Movie -> In Browser, and another time in Control -> Test Movie -> In Animate.

See if in both tests your button1 disappears or not.

Klaus

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
community guidelines
Community Beginner ,
Feb 24, 2019 Feb 24, 2019

Copy link to clipboard

Copied

Gaptooth!!! Hahaha!! I haven't checked your response yet but good to hear

from you!! That was what, 4 years ago?? Wow! Hey!!

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
community guidelines
Advocate ,
Feb 24, 2019 Feb 24, 2019

Copy link to clipboard

Copied

Hi Patrick

(instead of Gaptooth)

4 Years ago?! You must confuse me with someone else. We were in contact in this issue Easy html/js button embedding problem .

2 months ago!

Anyway, how come that you are back to Actionscript? I thought you left that behind for HTML5 solutions.

All the best

Klaus

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
community guidelines
Community Beginner ,
Feb 24, 2019 Feb 24, 2019

Copy link to clipboard

Copied

Ahhh!! I apologize--it is the name that is old. "Gaptooth columns" was the

title of my first forum post in 2014 or 2015 when I was learning

Dreamweaver and my columns looked like a broken wild west jawline!

I'm onto AS because I need animation for my page (and I'm apparently not

bad at graphic design though no training at all--also easy projects

though). Anyway, I am sorry to announce that I get exactly the same

performance with your code that I do with the computer generated code (and

I did delete everything, including comments, in the AS other than the

snippet you provided me). Button disappears entirely (no mouse icon change

or anything) with the AS snippet. Remove it, button comes back and works

fine. Is there a way to change the test browser from Chrome?

My most recent line of reasoning is that this is a browser or Norton

security problem, but short of that I am stumped. This is an absolutely

fresh Animate install, and I already have 4 or five websites with toolbars

(2 made in Animate!!) which are up and currently running fine, so other

than Animate getting broken I'm stumped...all help welcome.

Good to hear from you, Klaus.

Patrick

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
community guidelines
Community Beginner ,
Feb 24, 2019 Feb 24, 2019

Copy link to clipboard

Copied

Klaus,

I responded a bit prematurely on my last email. Importantly: I do not have the "In Animate" option--it is greyed out. As stated, though, I just made 1 button with three states (colors), so animate may not consider that a video.

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
community guidelines
Advocate ,
Feb 24, 2019 Feb 24, 2019

Copy link to clipboard

Copied

Patrick

if Control -> Test Movie -> In Animate is greyed out, that means you are working on a HTML5 Canvas document. Then your whole approach

4. select button, hit F9 (actions) --> code snippets --> Actionscript --> Click To Go To Webpage...(double click)

is in vain and wrong. You can't use Actionscript in an HTML5 Canvas document.

I just tried it myself, in a HTML 5 project, I selected --> code snippets --> Actionscript --> Click To Go To Webpage...(double click) (did the same as you) and got a new layer Actions with Actionscript like you. Script or code that is absolutely wrong in this type of project. This is actually something really stupid of Animate. The program should warn you that you're applying the wrong type of code or - better - it should not provide the technical opportunity to select such wrong code snippets. I'm quite alarmed!

Anyway, to be sure, what does it say in your FLA under File -> Publish Settings ... ?

  • Publish: Javascript/HTML or
  • Publish: Flash (.swf)

?

More to come

Klaus

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
community guidelines
Community Beginner ,
Feb 24, 2019 Feb 24, 2019

Copy link to clipboard

Copied

Klaus,

Publish settings is Javascript/HTML, with none of the 'other formats' (JPEG, etc.) boxes checked.

I swear I already did 2 toolbars that worked in animate--one is at www.thirddcahistoricalsociety.org. I swear I made that one in animate, and using HTML5 canvas.

What else would I have used? And why wouldn't an html5 canvas button work ordinarily? It seems strange that I can make a button perfectly except for the last step...mostly, though, those toolbars didn't come out of the sky!

Patrick

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
community guidelines
Advocate ,
Feb 25, 2019 Feb 25, 2019

Copy link to clipboard

Copied

Alright Patrick,

I had a look at www.thirddcahistoricalsociety.org at that what you always describe as toolbar. I dug myself into the structure and logic of your <object> element (Dreamweaver work I suppose) and came finally to your

NavigationBar

and from there to the code behind it:

http://www.thirddcahistoricalsociety.org/animation_assets/NavigationBar/Assets/NavigationBar.js

Since I asked you "how come that you are back to Actionscript?" -  and you answered "I'm onto AS because I need animation for my page" I got a sense that you are unsure about the distinctions and similarities of both concepts.

So, in NavigationBar.js from your thirddcahistoricalsociety toolbar, definately a HTML5-Canvas-Javascript concept, you applied a code snippet from the HTML5 Canvas folder in Animate, and second, in your case of this post, you applied a code snippet from the Actionscript folder in Animate. Compare:

NavigationBar.js

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

function fl_ClickToGoToWebPage_7() {

window.open("http://www.thirddcahistoricalsociety.org/Past_Events.html", "_blank");

}

and then your case of this post

/*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 (""). */

mybtn.addEventListener(MouseEvent.CLICK, fl_ClickToGoToWebPage);

function fl_ClickToGoToWebPage(event:MouseEvent):void

{

    navigateToURL(new URLRequest("http://www.adobe.com"), "_blank");

}

Can you spot the differences? And don't say the link to adobe.com, that's not the point here.

  1. the methods: window.open(..) as opposed to navigateToURL(..)
  2. the events: "click" as opposed to MouseEvent.CLICK bla

Hence if you would do the same in the case of this post as you did with NavigationBar.js, there wouldn't be any problems.

Apart from that I find it quite odd that every link in your toolbar opens in a new window or tab. That's quite unsual for links within the same domain/website. if you change the code snippet from

window.open("http://www.thirddcahistoricalsociety.org/Past_Events.html", "_blank");

to

window.location.href = "http://www.thirddcahistoricalsociety.org/Past_Events.html";

then it always opens in the same window or tab.

Klaus

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
community guidelines
Community Beginner ,
Feb 25, 2019 Feb 25, 2019

Copy link to clipboard

Copied

Thank you!!! A wonderful teacher as always, and yes, I have learned from your lesson--that you for taking the time to teach me. Again.

Patrick

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
community guidelines
Advocate ,
Feb 26, 2019 Feb 26, 2019

Copy link to clipboard

Copied

Nice response, cheers Patrick.

All good until the next lesson

Klaus

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
community guidelines
Community Beginner ,
Feb 27, 2019 Feb 27, 2019

Copy link to clipboard

Copied

Klaus,

I thought I'd mention something that you brought up which may be bothering

other people. All of this heartache has resulted from a lack of clear

instruction from Adobe (I feel) on some basic "what am I doing wrong?"

kinds of things, and I feel I can prove that. So, why do I have the

"_blank" in all my pages? Well, in part because I had to start using iFrame

for the banner video (since Flash is dead, not Adobe's fault), but also

because the object strategy has a similar issue as iFrame--the result is

that the "_self" causes the window to be refreshed to a new page that is

either just the banner or just the toolbar, since each is in its own little

webpage, too. So, I'm cleaver enough to balance the cards such that you

can't tell I'm doing it wrong, at the cost of opening up new pages all the

time. It's bad form, but no one told me how to use these tools. Now, if I

want to imitate a Youtube video (my experience so far) great, but you can

expect to get a lot more of these stupid questions since I don't know what

I'm doing. I would just think that Adobe would have more of an interest in

that.

And, as a final note, I will say that I gave the official Adobe tutorials a

go, and they were fine for as far as they went, but they still tend to

cover basics (I know how to start projects and play videos) without telling

me what the heck Actionscript is!

Put another way, I'm clearly intelligent enough to become trapped in all

kinds of sophisticated, creative ways, so extend me the courtesy that I can

learn and teach me how to fish (Adobe), not a scripted way to catch a small

fish in a controlled environment...what (he asked) is a fishing rod?

Patrick

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
community guidelines
Advocate ,
Mar 01, 2019 Mar 01, 2019

Copy link to clipboard

Copied

Hi Patrick

The transition from the dominance of Flash in the last decade 2001 - 2011 to the HTML5 mobile device era of this decade is for many still not over and a cause for grievance. That in general.

I remember from our dialogue back in December that I encouraged you to drop your concept of building your banners and toolbars in the Old School approach with Animate (and good/old Flash still on your mind) and try instead new things like CSS animation or Javascript manipulation of CSS prioperties like Opacity, Top, Left etc.

But you insisted on the Old School style. And here of course everything is in flux, no Flash Player anymore invisibly inserting itself into the Document Object Model (DOM), nowadays users are asked first to allow this kind of plug-in intrusion. So, Old School, yes, but with Javascript and Canvas flavour please. And so, it might all seem the same old Banners and Toolbars, but beneath the bonnet it's totally different. It's javascript now, and CreateJS. It's different properties, methods and scopes. This often doesn't go so smoothly, particularly with old mindsets still ticking.

'Adobe' will try to teach you to fish, but it is more up to everybody using Adobe's or other's tools, to learn and reach a certain level of independence from the Industry.

D.I.Y. Patrick

Klaus

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
community guidelines
Community Beginner ,
Mar 01, 2019 Mar 01, 2019

Copy link to clipboard

Copied

Klaus,

The irony!! I have taken you at your word, actually! The problem has been

I'm too involved to get a break to learn the correct way--I haven't had the

opportunity to take a week or two break!! Plus, my wife found out 2 weeks

ago she's pregnant with our first child, so now I wonder if ever!

I really am going to get this down, I promise!!

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
community guidelines
Advocate ,
Mar 01, 2019 Mar 01, 2019

Copy link to clipboard

Copied

Patrick,

all my congratulations and best wishes to your wife and you and the coming new citizen of this Earth.

All of you take all the time you need.

Klaus

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
community guidelines