por
Ceone » 23 May 2013 17:41
Funciones necesarias....
function ObjectFunctionPrefix(sObjectType)
local nObjType = Page.GetObjectType(sObjectType)
if nObjType == OBJECT_BUTTON then
return Button
elseif nObjType == OBJECT_LABEL then
return Label
elseif nObjType == OBJECT_PARAGRAPH then
return Paragraph
elseif nObjType == OBJECT_IMAGE then
return Image
elseif nObjType == OBJECT_FLASH then
return Flash
elseif nObjType == OBJECT_VIDEO then
return Video
elseif nObjType == OBJECT_WEB then
return Web
elseif nObjType == OBJECT_INPUT then
return Input
elseif nObjType == OBJECT_HOTSPOT then
return Hotspot
elseif nObjType == OBJECT_LISTBOX then
return Listbox
elseif nObjType == OBJECT_COMBOBOX then
return Combobox
elseif nObjType == OBJECT_PROGRESS then
return Progress
elseif nObjType == OBJECT_TREE then
return Tree
elseif nObjType == OBJECT_RADIOBUTTON then
return RadioButton
elseif nObjType == OBJECT_RICHTEXT then
return RichText
elseif nObjType == OBJECT_CHECKBOX then
return CheckBox
elseif nObjType == OBJECT_SLIDESHOW then
return Slideshow
elseif nObjType == OBJECT_GRID then
return Grid
elseif nObjType == OBJECT_PDF then
return PDF
elseif nObjType == OBJECT_QUICKTIME then
return QuickTime
elseif nObjType == OBJECT_XBUTTON then
return xButton
elseif nObjType == OBJECT_PLUGIN then
return Plugin
else
return nil
end
end
function GetSec(strObject, strBackgroundChannel)
local Sec = nil;
local tObj = ObjectFunctionPrefix(strObject);
if tObj then
if Audio.GetLength(strBackgroundChannel) ~= -1 then
local tPos = tObj.GetPos(strObject);
local tSize = tObj.GetSize(strObject);
local tMouse = System.GetMousePosition(true);
local tAudio = Audio.GetLength(strBackgroundChannel);
Sec = (tMouse.X-tPos.X)*(tAudio/tSize.Width);
end
end
return Sec;
end
Y en el objeto que desees lo siguiente:
(ON CLICK)
e_Pos = GetSec(this, CHANNEL_BACKGROUND);
if e_Pos ~= nil then
Audio.Seek(CHANNEL_BACKGROUND, SEEK_SPECIFIC, e_Pos);
end
He tenido que modificar un poco por que Slider esta realmente echo para esta función y Progress tiene muchas limitaciones pero bueno... tu quieres un progress pues tirale...
La función GetSec lo que hace es decir el segundo donde se tiene que enviar y eso se consigue haciendo unas matemáticas realmente simples en la que intervienen la posición del objeto, la medida del objeto y por ultimo la posición del mouse... algo realmente muy simple en el que sabiendo estos datos se puede saber la posición de la canción donde la quieres enviar... No he redondeado el numero, pero bueno eso ya es cosa tuya...
- HIDE: ON
- Hidebb Message Hidden Description