Jump to content

DONT STAY LURKING AS A GUEST,

JOIN TEF AND BENEFIT FROM MEMBERSHIP:

CLICK HERE TO JOIN.
Sign in to follow this  
Onoff

Any Java Script Raphael Framework Experts?

Recommended Posts

Onoff

...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++;
}

Share this post


Link to post
Share on other sites
Sharpend

I thinks Deke is your man :innocent 

Share this post


Link to post
Share on other sites
Barx

Java and Javascript are completely different things.

Share this post


Link to post
Share on other sites
Barx

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

Share this post


Link to post
Share on other sites
Sharpend

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. 

 

??

Share this post


Link to post
Share on other sites
Phoenix
On 10/11/2017 at 18:45, Barx said:

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!

Share this post


Link to post
Share on other sites
Rob_the_rich

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.

Share this post


Link to post
Share on other sites
Evans Electric

:C   I gave up at the word  " itterations"   TBH.

Edited by Evans Electric

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  


FORUM SPONSORS


Electrical Test Equipment
Test Meter Calibration
Test Equipment Manufacturers
Electrical & Tool Suppliers
Tool Manufacturers
Electrical Software
Green & Renewables
Label Supplies
Accounting Software
Education & Training
Motoring


To Advertise and become a Forum Sponsor of

talk.electricianforum.co.uk, please

contact the Administrator

Here Thank You.




×