Working in Designer, that was the first combination I found that the script worked when I played them out through the sequence. On Xpression Studio, it will work in OnOnline.
As you suggested, I moved the Datalinq Key script to OnOnline:
' datakey
dim vari as xpTextObject
dim keys as xpDatalinqKeys
dim key as xpDatalinqKey
'find the text object by name that the key value will come from
self.GetObjectByName("BasePage", vari)
'find the keys in the scene and find the specific datalinq key by name
self.GetDatalinqKeys(keys)
keys.GetKeyByName("datakey", key)
'copy the content of the source text field to the datalinq key
key.AsString = vari.text
'refresh datalinqs in the scene
Self.RefreshDatalinqs()
...and to pull the photos, I added a script event to the scene director:
'photos
dim self
dim imagefile as xpTextObject
dim imagefile2 as xpTextObject
dim imagefile3 as xpTextObject
dim photo as xpBaseObject
dim photo2 as xpBaseObject
dim photo3 as xpBaseObject
dim filepath1 as string
dim filepath2 as string
dim filepath3 as string
Self.GetObjectByName("ImageFile",ImageFile)
Self.GetObjectByName("ImageFile2",ImageFile2)
Self.GetObjectByName("ImageFile3",ImageFile3)
filepath1 = "V:\YourVoiceYourVote\LocalCandidates"& ImageFile.text & ".png"
filepath2 = "V:\YourVoiceYourVote\LocalCandidates" & ImageFile2.text & ".png"
filepath3 = "V:\YourVoiceYourVote\LocalCandidates" & ImageFile3.text & ".png"
Self.GetObjectByName("Photo",Photo)
Self.GetObjectByName("Photo2",Photo2)
Self.GetObjectByName("Photo3",Photo3)
photo.SetVolatileTextureFile(0, filepath1)
photo2.SetVolatileTextureFile(0, filepath2)
photo3.SetVolatileTextureFile(0, filepath3)
The photos would not load. I tried versions with and without materials applied to the photo quads.
This script did work in Designer in OnOnline.
I was still very concerned that my scene might have corrupted elements that might be preventing the script from working and tried everything I could think of to rule that out.
With scenes that use the GetMaterial,GetShader,SetFileName script in OnSceneOnline & OnSceneOffline:
'photo
dim ImageFile as xpTextObject
dim Photo as xpBaseObject
dim picmat1 as xpMaterial
dim picshad1 as xpBaseShader
dim FilePath1 as String
Self.GetObjectByName("ImageFile", ImageFile)
Self.GetObjectByName("Photo", Photo) 'gets the quad object
Photo.GetMaterial(0, picmat1) 'gets the quad's material
picmat1.GetShader(0, picshad1) 'gets the quad's material's shader
FilePath1 = "V:\YourVoiceYourVote\LocalCandidates" + ImageFile.Text + ".png" 'sets the filepath1
picshad1.SetFileName(FilePath1) 'sets the shader's filepath to the above filepath1
...and the Datalinq Key script in OnBeforeOnline:
' datakey
dim vari as xpTextObject
dim keys as xpDatalinqKeys
dim key as xpDatalinqKey
'find the text object by name that the key value will come from
self.GetObjectByName("BasePage", vari)
'find the keys in the scene and find the specific datalinq key by name
self.GetDatalinqKeys(keys)
keys.GetKeyByName("datakey", key)
'copy the content of the source text field to the datalinq key
key.AsString = vari.text
'refresh datalinqs in the scene
Self.RefreshDatalinqs()
It seems that the Datalinqs feeding my ImageFile text fields were preventing the script from running.
If I unhook the Datalinq blocks in Visual Logic, and typed in the filenames I wanted in the XpressionStudio sequence, the script pulled the photos correctly.
#XPression