Ian_Justice Posted May 13, 2013 Share Posted May 13, 2013 Hi All, Don't know if I'm cracking up here or just plain stupid! , but how do I display a sequence of 8 jpeg pictures and get them to automatically rotate with a short delay between each page? Any help greatly recieved!!! Cheers, Ian J - PCS Ltd Link to comment Share on other sites More sharing options...
AzeoTech Posted May 13, 2013 Share Posted May 13, 2013 Depends. First, are the 8 pictures going to change or are they fixed. I'm going to also assume they are about the same size. Let's assume they are going to change. If they are fixed you can use the same technique. There are other techniques available if they are fixed and you want the images embedded in your .ctl doc. This version requires them to be on a disk. 1) create a symbol component and place it on a page where you want the jpeg's. Name the component (right click on it after selecting and select "Component Name...". Let's call it "jpegs" for this example 2) create a new sequence: private string filenamesfilenames[0] = "c:\myimage1.jpg"filenames[1] = "c:\myotherimage.jpg"filenames[2] = "c:\anotherfolder\anotherimage.jpg"// etc for as many as you wantwhile(1) for(private x = 0, x < numrows(filenames), x++) component.jpegs.loadJpeg(filenames[x]) delay(60) endforendwhile[/CODE]Run the sequence whenever you want the rotation to occur. Change the 60 to whatever delay (in seconds) you want. Link to comment Share on other sites More sharing options...
Ian_Justice Posted May 13, 2013 Author Share Posted May 13, 2013 Hey Support, Many thanks for the swift reply!! Ok - I've got the jpegs rotating, but they seem to appear half way down the screen.. Is there any way of getting them display full screen? Again - Many thanks for your replies.. Ian J - PCS Ltd Link to comment Share on other sites More sharing options...
AzeoTech Posted May 13, 2013 Share Posted May 13, 2013 Its all based on where you place the symbol component. Link to comment Share on other sites More sharing options...
Ian_Justice Posted May 13, 2013 Author Share Posted May 13, 2013 Okay doke.. Getting there now.. Just one small problem - is there a way of stopping the symbol red cross appearing briefly when the picture changes? Just spoils the transition from one picture to the next Cheers, Ian J - PCS Ltd Link to comment Share on other sites More sharing options...
AzeoTech Posted May 13, 2013 Share Posted May 13, 2013 Sure. Two ways: Method 1: keep the page from drawing while it loads: private string filenamesfilenames[0] = "c:\myimage1.jpg"filenames[1] = "c:\myotherimage.jpg"filenames[2] = "c:\anotherfolder\anotherimage.jpg"// etc for as many as you wantwhile(1) for(private x = 0, x < numrows(filenames), x++) system.delayUpdate() try component.jpegs.loadJpeg(filenames[x]) delay(1) catch() ? strLastError endcatch system.resumeUpdate() delay(59) endforendwhile[/CODE]You may have to tweak the delay(1) bigger (or ideally smaller) for best result. DelayUpdate() causes the page not to redraw itself until ResumeUpdate() is called. The thing is, I do not know if loadJpeg() is blocking, and might return immediately even though the jpeg isn't loaded. Thus the delay() to allow it to load before letting the page redraw. However, it might be blocking, in which case you can eliminate the delay(1). Try it and if you don't mind, post what works for you. The try/catch around the loadJpeg is to ensure that resumeUpdate gets called, even if there is an error. Note how resumeUpdate is outside the catch.The problem with this method is that nothing on the page will redraw while the jpeg is loading. Method #2: Create two symbol components, name then jpeg0 and jpeg1. Then change the script to:[CODE]component.jpeg0.visible = 0component.jpeg1.visible = 0private string filenamesfilenames[0] = "c:\myimage1.jpg"filenames[1] = "c:\myotherimage.jpg"filenames[2] = "c:\anotherfolder\anotherimage.jpg"// etc for as many as you wantprivate alter = 0while(1) for(private x = 0, x < numrows(filenames), x++) execute("component.jpeg" + doubletostr(alter) + ".loadJpeg(filenames[x])") execute("component.jpeg" + doubletostr(!alter) + ".visible = 0") execute("component.jpeg" + doubletostr(alter) + ".visible = 1") alter = !alter delay(60) endforendwhile[/CODE]This should work better: it simply creates to components and alternates between the two, making the other one invisible. Link to comment Share on other sites More sharing options...
Ian_Justice Posted May 13, 2013 Author Share Posted May 13, 2013 Wow - again great response and support.. Many thanks - I'll give this a try on site tomorrow.. Thank you, Ian J - PCS Ltd Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.