Any Java Script Raphael Framework Experts?

Talk Electrician Forum

Help Support Talk Electrician Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

OnOff

Mad Inventor™
Supporting Member
Joined
Dec 25, 2011
Messages
5,470
Reaction score
80
...on here?

Son is having trouble. Hes a VB'er so Java is new.

Wants a loop for a start that does so many iterations - he can do that.

Loop should stop without needing a break command then continue running the code?

It's a video clip or something that needs to loop "i" times then the rest of the code runs.

He's been looking. Said he's spent 5 hours on it (and he will have). From the very, very little I understand he can enter "play the video" as five separate commands and after the 5th time the rest of the code automatically runs. That's inelegant and inefficient. It's when he writes a single command that says "play the video 5 times" that everything just stops rather than continuing to run the rest of the code.

Hope that makes sense!

Someone else suggested:

int amount = 0;
boolean trip = false;
while (amount < 5 && !trip) {
/* Code in here to do what ever and set trip = false if you want to exit. 
The exit can only happen at the end (as part of the start of) the loop */
amount++;
}

 
I believe you may be leaving out bits of info, if not, it should be pretty simple.

something like

function loopVideo(reps) {
for (i = 0; i < reps; i++) {
//play video
)
}


then just call loopVideo(number of times)

Hmm OK, just re-read the OP, not really understanding what you mean by 'without needing a break'

If the above isn't helpful, wanna try explaining again? lol

 
Now don't understand the gobbledygook but i think what he's trying to say is?

Someone lands on page,

clicks 'play video' 

the video or segment repeats x (5) number of times,

then the rest of video plays. 

??

 
Hmm OK, just re-read the OP, not really understanding what you mean by 'without needing a break'

If the above isn't helpful, wanna try explaining again? lol


I think what he means, is that he was looking for a FOR loop that repeats a given number of itterations as you have provided, rather than an end less loop and a command instead the loop to break out of it prematurely.

Sort of the struture of  the following (don't think this is actually the correct sytax for any language......)

counter = 0
Do while True
counter = counter + 1
if counter = 5
exit
endif
end while


I seem to remember doing something like that in Dbase, I'm not sure if it lacked a FOR loop or I'd just been taught a bad style!

 
If it is only 5 times, just use the 5 play video lines. Inelegant, but if it works then it is good code.

Syntax is everything in coding, he could insert something like "System.err.println()" into the loop to put any errors out to the console for debugging.

 
Top