zz使用Lingo控制QuickTime VR

时间:01/22/2007 08:59:00   作者:ChenReal    阅读:193

一、设置QuickTime VR的属性

  将此行为附于按钮之上,可以控制QTVR的下列属性:
  *Show Video:显示画面
  *Play Sound:播放声音
  *Controller:控制条
  *Preload:预读
  *DirectToStage:写屏
  *Streaming:流式
  *Loop:循环

property sourcemember,WhereTo,show_video,play_sound,preload_video,directtostage_video,Streaming_Prop,loop_video,Show_Controller

---- Get Behavior Description List ---

on getPropertyDescriptionList me
 QTMembersList=searchDigitalVideo (me)
 descriptionlist = [:]
 spriteassignlist=["Mouse Up","Mouse Down", "Mouse Enter","Mouse Leave"]
 frameassignlist=["Exit Frame","Enter Frame"]
 if QTMembersList.count > 0 then
  addprop descriptionlist,#sourcemember,[#comment:"QTVR Cast member :", \\
#format:#String,#range:QTMembersList,#default:QTMembersList[1]]
 else
  addprop descriptionlist,#sourcemember,[#comment:"QTVR Cast member :",#format:#Graphic,#default:1]
 end if
 addprop descriptionlist,#show_video,[#comment:"Set Show Video Property To :",#format:#Boolean,#default:True]
 addprop descriptionlist,#play_sound,[#comment:"Set Play Sound Property To :",#format:#Boolean,#default:True]
 addprop descriptionlist,#Show_Controller,[#comment:"Set Show Controller Property To :",#format:#Boolean,#default:True]
 addprop descriptionlist,#preload_video,[#comment:"Set Preload Property To :",#format:#Boolean,#default:True]
 addprop descriptionlist,#directtostage_video,[#comment:"Set DirectToStage Video Property To :",#format:#Boolean,#default:True]
 addprop descriptionlist,#Streaming_Prop,[#comment:"Set Streaming Property To :",#format:#Boolean,#default:True]
 addprop descriptionlist,#loop_video,[#comment:"Set Loop Property To :",#format:#Boolean,#default:True]
 if the currentspritenum <> 0 then
  addprop descriptionlist, #WhereTo, [#comment:"Where To Assign this Script ?", #format:#String,#range:spriteassignlist,#default:spriteassignlist[1]]
 else
  addprop descriptionlist, #WhereTo, [#comment:"Where To Assign this Script ?", #format:#String,#range:frameassignlist,#default:frameassignlist[2]]
 end if
 return descriptionlist
end getPropertyDescriptionList

-- Get Behavior description --

on getBehaviorDescription
 return "This Behavior Sets the True/False Properties of a Digital Video(QTVR) " & RETURN & RETURN & \\
"Parameters" & RETURN & \\
"* Source Digital Video Cast member." & RETURN & \\
"* True/False" & RETURN & \\
"* Where to attach this Script"
end

-- Events --

on mouseUp me
 if WhereTo="Mouse Up" then
  SetProperties
 end if
end

on mouseDown me
 if WhereTo="Mouse Down" then
  SetProperties
 end if
end

on mouseEnter me
 if WhereTo="Mouse Enter" then
  SetProperties
 end if
end

on mouseLeave me
 if WhereTo="Mouse Leave" then
  SetProperties
 end if
end

on enterframe
 if WhereTo="Enter Frame" then
  SetProperties
 end if
end

on exitFrame
 if WhereTo="Exit Frame" then
  SetProperties
 end if
end

-- Custom Handlers --

on SetProperties
 if member(sourcemember).type = #QuickTimeMedia then
  member(sourcemember).controller=Show_Controller
  member(sourcemember).video=show_video
  member(sourcemember).sound=play_sound
  member(sourcemember).preload=preload_video
  member(sourcemember).DirectToStage=directtostage_video
  member(sourcemember).streaming=Streaming_Prop
  member(sourcemember).loop=loop_video
 end if
end

------ Availbale for both Frame & Sprite Script ------

on isOKToAttach (me, aSpriteType, aSpriteNum)
 case aSpriteType of
  #graphic:
   return true
  #script:
   return True
 end case
end isOKToAttach

------ Search for QT Member ------

on searchDigitalVideo me
 AVIMembersList = []
 maxCastLib = the number of castLibs
 repeat with theCastLib = 1 to maxCastLib
  maxMember = the number of members of castLib theCastLib
  repeat with memberNumber = 1 to maxMember
   theMember = member(memberNumber, theCastLib)
   if theMember.type = #QuickTimeMedia then
    if theMember.name = EMPTY then
     AVIMembersList.append(theMember)
    else
     AVIMembersList.append(theMember.name)
    end if
   end if
  end repeat
 end repeat
 return AVIMembersList
end

  二、控制QuickTime VR的热区

  下面的代码用于实现对QTVR热区的控制:

-- 电影角本
on startmovie
 sprite(1).VRHotSpotEnterCallback = #MyEnterHotspot
 sprite(1).VRNodeEnterCallback = #MyEnterNode
 sprite(1).VRNodeExitCallback = #MyExitNode
 sprite(1).VRTriggerCallback = #MyVRTrigger
end

on MyEnterHotspot me, id
 set VRHotSpotSprite = the spritenum of me
 put "mouse entered hotspot" && id && "of sprite" && sprite VRHotSpotSprite
end

on MyEnterNode me, id
 -- 在此加入命令行,点击热区后触发
 set multiNodeVRspr = the spritenum of me
 put "mouse entered node" && id && "of sprite" && sprite multiNodeVRspr
end

on MyExitNode me, id
 set exitmultiNodeVRspr = the spritenum of me
 put "mouse exited node" && id && "of sprite" && sprite exitmultiNodeVRspr
end

 

评论
0/200