PDA

View Full Version : Help to show Pictures in an object


Abidar
12-28-2005, 01:26 AM
Hi every body

I want to use MediaPlayer to play some music.
It's simple. But I want to show some pictures when a music playing.

I use below code in MediaPlayer.play()

for count = 1, 10 do
Image.Load("obj1", "AutoPlay\\Images\\photos\\"..Math.Random(8, nil)..".jpg");
numLoopCount=0
repeat
numLoopCount = numLoopCount + 1;
until numLoopCount == 100000;
end


But until images changing, program is hanged & nothing work.

Please help me

Corey
12-28-2005, 01:32 AM
Hi. Why not just create a video file using a program such as Photo Story (http://www.microsoft.com/windowsxp/using/digitalphotography/photostory/default.mspx), and then serve that in AMS?

Abidar
12-28-2005, 01:45 AM
Very Thanks
It's good idea.
But I want to use pictures. because I can change pictures simply. but, if i use a movie I should create a new file when my pictures changed.

Roboblue
12-28-2005, 05:06 PM
First, name all the pic files in alphanumerical sequence with in the sequence you want to display them and put them in the Images folder (Frame1.jpg, Frame2.jpg, etc). Then note the length in time of the music file (or just loop it if you don't want a synchronized finish). Divide the music length in seconds by the number of image files (music is 360 seconds / 60 images = 6 seconds per image).
Insert an image object where ever on the page. Insert the media player and have it load and play the music file on Page On Show, loop off. Also in Page On Show, add
---start frame
nFrame = 1;
---length of time in milliseconds for each image to be shown for synchronization
Page.StartTimer(6000)

Add to On Timer
---use the number of images to show where to stop walking in this case 60 images
if nFrame > 60 then
else
end
Image.Load("Image1", "Autoplay\\Images\\Frame"..nFrame..".jpg")nFrame = nFrame + 1

this will stop the slideshow at approximately the end of the music. you may have to adjust the numbers to get it exact.

If you want to loop the the whole thing with synchro, them insert this in the On Timer event
Add to On Timer
---use the number of images to show where to stop walking in this case 60 images
if nFrame > 60 then
nFrame = 1
end
Image.Load("Image1", "Autoplay\\Images\\Frame"..nFrame..".jpg")nFrame = nFrame + 1

Roboblue
12-28-2005, 05:43 PM
Insert an image object where ever on the page.

change this to:
Insert an image object where ever on the page, and load the 1st image in the image object properties (frame1.jpg in this example).

Also, the timer won't be exact. I find that adding 1 to the total images, then dividing song length gets it close. In this example, using 60 images, just divide the song length by 61. But keep the line
if nFrame > 60 then as it is.