HTML5 coding an 'if' function

Community Beginner ,
Aug 01, 2020 Aug 01, 2020

Copy link to clipboard

Copied

Hi,

I had a Flash website that I have been eager to repurpose as an HTML5 Canvas site.  I have been working with the code wizard and I'm glad to say that the first page is now 90% there.  However, there is one thing that I just can't get to work.  Here's what should happen:

A movie clip (van_mc) with a nested clip (vanmove_mc) is covered by an invisible button (van_btn01).  The nested clip has a "stop" script on frame 1 (or frame 0 in HTML5 code, but I will use the Animate timeline numbers to explain)).  On rollover the button sends the nested clip move to the "over" state on frame 2.  On button rollout, the nested movie clip returns to frame 1.  On button click, the nested movie clip moves to frame 3 and runs the remaining animation in the movie clip, with the final frame sending the user to a new web page.

 

All of that is working perfectly.  The problem is that whilst I want the rollout function to work until the button is clicked, once it has been clicked I want to disable it; otherwise it interrupts the final part of the nested movie clip and we return to its frame 1.  Everything is fine if the user stays over the button, but they are not guaranteed to do so after they click.

 

Here's the code I've used, adapted from the wizard code:

 

var _this = this;
stage.enableMouseOver(3);
_this.van_btn01.on('mouseout', function () {

if (_this.van_mc.vanmove_mc.currentFrame < (2)); {
_this.van_mc.vanmove_mc.gotoAndStop('car_still');
}
});

 

I've also sent the main timeline (_this) to a second frame that does not contain the button, but the rollout still seems to affect the action.

 

I hope that amkes sense.  Any help gratefully received.

 

Thanks.

 

Paul

Views

87

Likes

translate

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

Adobe Community Professional , Aug 03, 2020 Aug 03, 2020
try:   var _this = this;stage.enableMouseOver(3);_this.van_btn01.on('mouseout', function () { if (_this.van_mc.vanmove_mc.currentFrame < 2) {_this.van_mc.vanmove_mc.gotoAndStop('car_still');}});

Likes

translate

Translate

Translate
Adobe Community Professional ,
Aug 03, 2020 Aug 03, 2020

Copy link to clipboard

Copied

try:

 

var _this = this;
stage.enableMouseOver(3);
_this.van_btn01.on('mouseout', function () {

if (_this.van_mc.vanmove_mc.currentFrame < 2) {
_this.van_mc.vanmove_mc.gotoAndStop('car_still');
}
});

Likes

translate

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 ,
Aug 03, 2020 Aug 03, 2020

Copy link to clipboard

Copied

Fantastic.  Thank you so much kglad.  It worked perfectly.

Now to add it to the other 11 similar buttons.

Best wishes.

Paul

 

Likes

translate

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
Adobe Community Professional ,
Aug 05, 2020 Aug 05, 2020

Copy link to clipboard

Copied

you're welcome.

Likes

translate

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