Symbol Off On Problems

(Steve) #1 (14.4 KB)Trying to control symbols, and they can drive me nuts… but i’m sure its just me… I have attached a simple on and off method. I’m truly trying to seek the gotoAndStop on a time line from flash. So I have put this together. Any help would be great!

(Steve) #2

I have helped myself, as I have figured it out… .hopefully this will help someone else with the same problem.

Resolved with this file (14.3 KB)

(Steve) #3

And one more to help any one else like me who would like to set up a marquee. This is only a couple hours, after I discovered how to turn a symbol off and on. Enjoy!
If you have any ways of simplifying the code I would be interested. (23.7 KB)

(Greg) #4

That is a great effect, thanks for sharing it.


Very cool! :thumbsup:

(Lucky) #6

Hey dude,
Just saw your code and it was gigantic i thought there has to be an easier way than that
What if you just use the class names. This way you dont need to keep renaming your symbol and just use the same class. It also doesn’t have a set limit, it’s set to the amount of bulbs on the stage so if you add more it will still work.

var bulbs = document.getElementsByClassName("lb");
function blinkOnce(z,OnOff){
	if(typeof bulbs[(z)]!=='undefined'){
			hypeDocument.getSymbolInstanceById(bulbs[z].id).goToTimeInTimelineNamed(1, 'lever');
			hypeDocument.getSymbolInstanceById(bulbs[z].id).goToTimeInTimelineNamed(0, 'lever');
var blinker = window.setInterval(blink, 200);
var gap=4;
var blinkCount=0;
function blink() {
	if(blinkCount==gap){ blinkCount=0; }

This does the same thing, you can set the gap of the animation and its a lot lighter. Just wanted to share this way of working since it’s solved me a lot of work in coding! (20.6 KB)

(Greg) #7

We are very lucky to have Lucky around here! Thanks to all

(Steve) #8

Lucky, wow, that is awesome. I knew it could be simplified, but way beyond my imagination. Thanks you, after playing with this i’m sure you are helping me become the code monster… :slight_smile: Just in time for halloween!

(Lucky) #9

Hahah no worries!
Class names are great :smile:

(Steve) #10

Ok one more time. Couldn’t figure out why the marquee was split in half and going to different ways… so my venture to learn how lucky did what he did. Can’t thank you enough. So when I built the stage for the marquee i was coping pasting selecting all copy and pasting the symbols. And started at 1 instead of 0 for my labeling system. However VS. if adding only one symbol on at a time, then i think lucky’s code would have worked perfectly.

So I looked at the code tweeted and kicked a bit, and ended up with the final! Sharing is fun and educational. (25.2 KB)