Highlighted

ANIMATE JAVASCRIPT HELP

Explorer ,
Feb 05, 2019

Copy link to clipboard

Copied

Hi

Im new to this coding aspect of Animate and have tried to do this for days now. Ive searched high and low for answer but cant get to the bottom of it and its something simple, I know it!

I am making an HTML5 interactive map. So basically the areas are buttons. Each area has a label on the main timeline.

I have an actions layer and a labels layer.

The first frame is stop();

When the user presses the button (or chooses an area), I use the click funciton to gotoandstop("labelArea");

The problem is, when It goes to this label (which works fine), it is not playing the timeline within that Label. so on the main timeline it may go to a label on frame 2. Within frame 2, I have X amount of frames which I want to play as the animaiton when someone goes to this area. But its locked on the gotoandstop label.

Ive tried using graphics and moivieclips, using gotoandplay, gotoandstop, making label within the movieclip , using a movieclip instance name etc. but maybe my syntax is wrong.

I want the user to choose an area -> goto label on main timeline -> play the timeline within that label.

Please help if you can, I think itll be something simple.

Thanks

Hi Charlie

I hope Joseph doesn't mind when I intervene. Your problem happened to me as well. There seems to be an issue if you use gotoAndStop("toLabelWhatever") and on toLabelWhatever is only one frame in which a movieclip is placed with an independent timeline with more that one frame. What I did then and now to your file is I added a few frames (5) after lblArgoed and now the animation in the movieclip on lblArgoed plays.

Screenshot 2019-02-06 at 12.41.43.png

I don't really know the reason but it works.

Apart from that, your script in frame 1 with 602 lines of code, that could be done with about just 5% of code.

Your army of eventListeners and eventFunctions: I would use only three for all map areas. And then work with parallel arrays to determine which townName and frame-to-go are the correct ones in any given event. But that's not what you are asking.

Klaus

Views

283

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

ANIMATE JAVASCRIPT HELP

Explorer ,
Feb 05, 2019

Copy link to clipboard

Copied

Hi

Im new to this coding aspect of Animate and have tried to do this for days now. Ive searched high and low for answer but cant get to the bottom of it and its something simple, I know it!

I am making an HTML5 interactive map. So basically the areas are buttons. Each area has a label on the main timeline.

I have an actions layer and a labels layer.

The first frame is stop();

When the user presses the button (or chooses an area), I use the click funciton to gotoandstop("labelArea");

The problem is, when It goes to this label (which works fine), it is not playing the timeline within that Label. so on the main timeline it may go to a label on frame 2. Within frame 2, I have X amount of frames which I want to play as the animaiton when someone goes to this area. But its locked on the gotoandstop label.

Ive tried using graphics and moivieclips, using gotoandplay, gotoandstop, making label within the movieclip , using a movieclip instance name etc. but maybe my syntax is wrong.

I want the user to choose an area -> goto label on main timeline -> play the timeline within that label.

Please help if you can, I think itll be something simple.

Thanks

Hi Charlie

I hope Joseph doesn't mind when I intervene. Your problem happened to me as well. There seems to be an issue if you use gotoAndStop("toLabelWhatever") and on toLabelWhatever is only one frame in which a movieclip is placed with an independent timeline with more that one frame. What I did then and now to your file is I added a few frames (5) after lblArgoed and now the animation in the movieclip on lblArgoed plays.

Screenshot 2019-02-06 at 12.41.43.png

I don't really know the reason but it works.

Apart from that, your script in frame 1 with 602 lines of code, that could be done with about just 5% of code.

Your army of eventListeners and eventFunctions: I would use only three for all map areas. And then work with parallel arrays to determine which townName and frame-to-go are the correct ones in any given event. But that's not what you are asking.

Klaus

Views

284

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
Feb 05, 2019 0
Adobe Community Professional ,
Feb 05, 2019

Copy link to clipboard

Copied

Discussion successfully moved from Adobe Creative Cloud to Adobe Animate CC

Regards,
Abambo
Hard- and Software Engineer and Photographer

I'm not an Adobe employee. All advice constitutes my own opinion. Use at your risk! 🙂

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...
Feb 05, 2019 0
Adobe Community Professional ,
Feb 05, 2019

Copy link to clipboard

Copied

If using HTML5 Canvas - it should be this.stop() and not simply stop()

If you have MovieClip symbol instances that contain multiple frames at each stopping point - they should play independent of the root timeline. Are you sure these instances exist at each stopping point? Can you share your FLA?

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...
Feb 05, 2019 0
Explorer ,
Feb 06, 2019

Copy link to clipboard

Copied

Hi Joseph,

Thanks for getting back to me. Its due to my lack of understanding but ive tried hard, even watching your tutorials and also some books you have had input with. I have shared the link. https://adobe.ly/2t9F3rs

If you see when opening there is two maps one will be areas and one is the county as a whole. When clicking one of those buttons, I want it to then play an embedded timeline i.e the content of that area. I have only made sample content for lblArgoed (argoed button) at the moment as an experiment as I cant get this to work so no point doing the others. But both gotoandplay and gotoandstop isnt cutting it for me.

For the purpose of just the FLA I have shared, the yellow highlighted button (Argoed) is the only one with a timeline behind it. Thanks a lot.

Charlie

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...
Feb 06, 2019 0
Advocate ,
Feb 06, 2019

Copy link to clipboard

Copied

Hi Charlie

I hope Joseph doesn't mind when I intervene. Your problem happened to me as well. There seems to be an issue if you use gotoAndStop("toLabelWhatever") and on toLabelWhatever is only one frame in which a movieclip is placed with an independent timeline with more that one frame. What I did then and now to your file is I added a few frames (5) after lblArgoed and now the animation in the movieclip on lblArgoed plays.

Screenshot 2019-02-06 at 12.41.43.png

I don't really know the reason but it works.

Apart from that, your script in frame 1 with 602 lines of code, that could be done with about just 5% of code.

Your army of eventListeners and eventFunctions: I would use only three for all map areas. And then work with parallel arrays to determine which townName and frame-to-go are the correct ones in any given event. But that's not what you are asking.

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
Reply
Loading...
Feb 06, 2019 0
Explorer ,
Feb 06, 2019

Copy link to clipboard

Copied

Hi Klaus

Thanks, I initially did have the main timeline frames larger, but then I thought, for clarity and management of each area, an embedded timeline is best. Theres no pinmt in having an embeded timeline at all if its all done on the main timeline. Im considering using a Scene for each area to keep things tidy.

Also, if the lengths of my animations change for each area, I thought doing the individual area timelines behind a movie clip would be easier to manage. I will just go with using main timeline only in this case asnd possibly scenes (although people seem to be against scenes, but im trying to keep my work tidy - the code being an exception).

I am knew to coding as you can see, and I like your terminology ARMY as it is a good analogy, but they say there is strength in numbers?! If you could help with the cleaning up of that or give me some hints that would be great, my only coding experience was VBA for Excel in the past.

The use of arrays sounds complicated to me. I know what an array is but wouldnt know how to implement it. As long as the code I used works and doesn't compromise performance, I can get by with my embarrassing coding skills.

Thanks again for your help and support.

Charlie

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...
Feb 06, 2019 1
Advocate ,
Feb 06, 2019

Copy link to clipboard

Copied

charliep11645294  wrote

Thanks, I initially did have the main timeline frames larger, but then I thought, for clarity and management of each area, an embedded timeline is best. Theres no pinmt in having an embeded timeline at all if its all done on the main timeline. Im considering using a Scene for each area to keep things tidy.

Also, if the lengths of my animations change for each area, I thought doing the individual area timelines behind a movie clip would be easier to manage.

Charlie, there might be a misunderstanding. The movieclip ("mkay") on frameLabel lblArgoed still has its own independent timeline where the animation runs. This animation in mkay is 24 frames long. The only thing that seems to be necessary on the main timeline is to have on that label more than one frame. I gave it alltogether 6 for the simple reason that then one can read the frame label. I also tried 2 frames and that works as well. Only if there is only 1 frame it stops working. The extra frames on the main timeline aren't actually played. The 24 frames in the movieclip's embedded timeline are played. But only when on main timeline is more than one frame.

I can't explain it. try this one out Dropbox - maptest16_xp.zip

Because of the parallel array stuff - I'll come back to you for this, right now too busy with my own work.

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
Reply
Loading...
Feb 06, 2019 0
cmpcperc LATEST
Explorer ,
Feb 06, 2019

Copy link to clipboard

Copied

Ah yes i see, I added an extra frame to make it two frames long and it now plays the whole animaiton, So all I need to do is make them all 2 frames long (each area). This is great Klaus.

Regarding the code, I will remove mouseover and mouseout because ive been told these are redundant for people who will access via  touchscreen device. Ill just focus on getting this working on desktop then see how to cater for devices later down the line.

Thanks 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
Reply
Loading...
Feb 06, 2019 1