Help with Image and Video Player plzzzzzzzzzz

Visuals, audio, animation. Blended, not stirred. If LiveCode is part of your rich media production toolbox, this is the forum for you.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

eg4am1
Posts: 17
Joined: Tue Mar 06, 2007 12:51 am

Help with Image and Video Player plzzzzzzzzzz

Post by eg4am1 » Tue Mar 06, 2007 2:04 pm

The problem is i am new to run rev and currently making a software for my final year project. the part i am stuck on is that i have a card that can display images and video both using the image area and video player in the run rev tools.the idea is tthat the user can select "open image or video" thorugh the file menu on my program and then display them on the card. i have got as far as allowing user to press open and searching through a dialogue box for images but cant figure out how can he select the image or video and display them with in the card !! can any one help please ???

thank you
kind regards Asim

marielle
Livecode Opensource Backer
Livecode Opensource Backer

Re: Help with Image and Video Player plzzzzzzzzzz

Post by marielle » Tue Mar 06, 2007 2:14 pm

Hi Asim,

Check out under "filename" in the documentation

Your code could look something like this:

Code: Select all

answer file "please select a movie file"
put it into tFile
if tFile is not empty then 
  -- An empty value means that the user pressed cancel. 
  -- We don't want the current player content to be 
  -- lost, so we only change the filename value when 
  -- tFile is not empty.
  set the filename of player "myPlayer" to tFile
end if
------------
answer file "please select an image file"
put it into tFile
if tFile is not empty then 
  set the filename of image "myImage" to tFile
end if
:idea: this assumes that there is a player control with for name "myPlayer" and an image control with for name "myImage" on the screen
:!: typed on the fly, may contain errors

Best of luck with your project,
Marielle

eg4am1
Posts: 17
Joined: Tue Mar 06, 2007 12:51 am

Re: Help with Image and Video Player plzzzzzzzzzz

Post by eg4am1 » Tue Mar 06, 2007 2:25 pm

marielle wrote:Hi Asim,

Check out under "filename" in the documentation

Your code could look something like this:

Code: Select all

answer file "please select a movie file"
put it into tFile
if tFile is not empty then 
  -- An empty value means that the user pressed cancel. 
  -- We don't want the current player content to be 
  -- lost, so we only change the filename value when 
  -- tFile is not empty.
  set the filename of player "myPlayer" to tFile
end if
------------
answer file "please select an image file"
put it into tFile
if tFile is not empty then 
  set the filename of image "myImage" to tFile
end if
:idea: this assumes that there is a player control with for name "myPlayer" and an image control with for name "myImage" on the screen
:!: typed on the fly, may contain errors

Best of luck with your project,
Marielle
----------------------------------------------------------
thank you marielle
that was a big help !!! one last question how can i set the image size and video size to be that of the image control and video control rather then the original size of the picture
regards asim

marielle
Livecode Opensource Backer
Livecode Opensource Backer

Re: Help with Image and Video Player plzzzzzzzzzz

Post by marielle » Tue Mar 06, 2007 2:37 pm

eg4am1 wrote:how can i set the image size and video size to be that of the image control and video control rather then the original size of the picture
You mean, you need to resize the picture to a smaller size? There you are getting onto some slightly more advanced concepts.

You can set some of the properties of these controls.

Code: Select all

put 200 into tImgWidth -- replace by the value you want
put 150 into tImgheight -- replace by the value you want
set the width of image "myImage" to tImgWidth
set the height of image "myImage" to tImgHeight
However, this will get you a completely distorted picture. What you want to do is resize the image while keeping its proportions. To do this, check out this forum post on geometry question (how to lock proportions)

Ah, yes, you will need to make use of lock screen and unlock screen as well... have a look for these in the doc.

(note sure this works for video, never tried)

I hope this won't be the last question ;-). Keep them coming.
Marielle

eg4am1
Posts: 17
Joined: Tue Mar 06, 2007 12:51 am

Re: Help with Image and Video Player plzzzzzzzzzz

Post by eg4am1 » Tue Mar 06, 2007 2:45 pm

marielle wrote:
eg4am1 wrote:how can i set the image size and video size to be that of the image control and video control rather then the original size of the picture
You mean, you need to resize the picture to a smaller size? There you are getting onto some slightly more advanced concepts.

You can set some of the properties of these controls.

Code: Select all

put 200 into tImgWidth -- replace by the value you want
put 150 into tImgheight -- replace by the value you want
set the width of image "myImage" to tImgWidth
set the height of image "myImage" to tImgHeight
However, this will get you a completely distorted picture. What you want to do is resize the image while keeping its proportions. To do this, check out this forum post on geometry question (how to lock proportions)

Ah, yes, you will need to make use of lock screen and unlock screen as well... have a look for these in the doc.

(note sure this works for video, never tried)

I hope this won't be the last question ;-). Keep them going.
Marielle
--------------------------------------------------------------------------------------
thank you marielle

but i think this might not be what i am looking for may be i didnt explain properly.
well if you have ever used VB you can use the set the image property to "strech image" so that the image fits in the image box .. but not resize according to the image itself . that is what i am looking for :)
kind regards asim

eg4am1
Posts: 17
Joined: Tue Mar 06, 2007 12:51 am

Re: Help with Image and Video Player plzzzzzzzzzz

Post by eg4am1 » Tue Mar 06, 2007 2:58 pm

marielle wrote:
eg4am1 wrote:how can i set the image size and video size to be that of the image control and video control rather then the original size of the picture
You mean, you need to resize the picture to a smaller size? There you are getting onto some slightly more advanced concepts.

You can set some of the properties of these controls.

Code: Select all

put 200 into tImgWidth -- replace by the value you want
put 150 into tImgheight -- replace by the value you want
set the width of image "myImage" to tImgWidth
set the height of image "myImage" to tImgHeight
However, this will get you a completely distorted picture. What you want to do is resize the image while keeping its proportions. To do this, check out this forum post on geometry question (how to lock proportions)

Ah, yes, you will need to make use of lock screen and unlock screen as well... have a look for these in the doc.

(note sure this works for video, never tried)

I hope this won't be the last question ;-). Keep them coming.
Marielle
---------------------------------------------------------------------------
hi again marielle
i think i got it figured out !! thnx one question though how can i empty the image control or reset it through a "button"
regards asim

marielle
Livecode Opensource Backer
Livecode Opensource Backer

Re: Help with Image and Video Player plzzzzzzzzzz

Post by marielle » Tue Mar 06, 2007 8:22 pm

eg4am1 wrote:"strech image" so that the image fits in the image box ..
I have been a VB user in the past, but haven't used it for a long long time, so I can't be sure I understand your request correctly.

What I understand is that you would like the image to fit exactly within a given box. There is no preset property for this in revolution. But you can use the
"scale.touchingBoudingRect" function on this other forum page to achieve this effect. TouchingBoundingRect will ensure that the picture is always resized to exactly fit the dimensions of the box (preserving the proportions, though). scale.withinBoudingRect will resize the picture only if it's dimensions are bigger than the box. If the picture already fits within the box, then no resizing takes place.

Best,
Marielle

(note that though pushing on the quote button is the easiest way to reply to any post it is good practice not to copy the full post... it makes it quite difficult to find your reply)

marielle
Livecode Opensource Backer
Livecode Opensource Backer

Re: Help with Image and Video Player plzzzzzzzzzz

Post by marielle » Tue Mar 06, 2007 8:24 pm

eg4am1 wrote:how can i empty the image control
Why not give a try to :

Code: Select all

set the filename of image "myImage" to empty

eg4am1
Posts: 17
Joined: Tue Mar 06, 2007 12:51 am

Re: Help with Image and Video Player plzzzzzzzzzz

Post by eg4am1 » Wed Mar 07, 2007 4:33 am

marielle wrote:
eg4am1 wrote:how can i empty the image control
Why not give a try to :

Code: Select all

set the filename of image "myImage" to empty
---------------------------------------------------------------------------------
thank you very much !! you have made a lot of my problems easier !! God bless you :D .
i will be bugging you soon with some more question i hope you wont mind

kind regards Asim

eg4am1
Posts: 17
Joined: Tue Mar 06, 2007 12:51 am

Re: Help with Image and Video Player plzzzzzzzzzz

Post by eg4am1 » Wed Mar 07, 2007 1:00 pm

marielle wrote:
eg4am1 wrote:how can i empty the image control
Why not give a try to :

Code: Select all

set the filename of image "myImage" to empty
---------------------------------------------------------------------------------------
hiya i have a new question for you :) hope you can help.
i need to allow the user to be able to edit text in a text box .. like he can change font, size, color, bold and italic e.t.c . in VB for e.g you can call the windows font dialogue box easily and use that for this purpose. is something similiar available for runtime rev ?

kind regards Asim

marielle
Livecode Opensource Backer
Livecode Opensource Backer

Re: Help with Image and Video Player plzzzzzzzzzz

Post by marielle » Wed Mar 07, 2007 1:10 pm

Hi Asim,

Okay, I will answer... but please do me the favour to ask your question without quoting the full text :-D. This makes this all thread very difficult to read.

eg4am1
Posts: 17
Joined: Tue Mar 06, 2007 12:51 am

help with text box

Post by eg4am1 » Wed Mar 07, 2007 1:21 pm

sorry about that. i am sending the question again

"hiya i have a new question for you Smile hope you can help.
i need to allow the user to be able to edit text in a text box .. like he can change font, size, color, bold and italic e.t.c . in VB for e.g you can call the windows font dialogue box easily and use that for this purpose. is something similiar available for runtime rev ?"
thank you for your help
kind regards Asim

marielle
Livecode Opensource Backer
Livecode Opensource Backer

Re: help with text box

Post by marielle » Wed Mar 07, 2007 1:47 pm

Hi Asim,

Thanks :-).

Uhu, your project is rapidly expanding. In rev, you cannot call a "windows font dialogue" (perhaps because this is a cross-platform tool). However, it's not too difficult to build your own text formatting palette.

You will find some functions to format the text in a text box in the collapsing toolbar stack available on the open stack gallery. Check out under the "text Formatter" menu item.

Right click on the blue arrow to download the stack on your computer.

There is a similar font utils stack in my personal collection of stacks. This was early work, when I was still learning how to program in runrev. The code could be better written.

If you come up with something that you would like to be added to the stacks gallery simply let me know. That gallery welcomes the contributions from all community members ;-).

Marielle

eg4am1
Posts: 17
Joined: Tue Mar 06, 2007 12:51 am

you are the best !!! :)

Post by eg4am1 » Wed Mar 07, 2007 2:19 pm

:D thank you very much !!
you have been a big help !. tough stages in my project are yet to come so i hope you aren't fed up of me already !! lol .
thnx again
kind regards asim

marielle
Livecode Opensource Backer
Livecode Opensource Backer

Re: you are the best !!! :)

Post by marielle » Wed Mar 07, 2007 4:35 pm

Always happy to help :-).

Post Reply

Return to “Multimedia”