From 55d386aaabc040184ae5e9450b7487b47792dc06 Mon Sep 17 00:00:00 2001 From: EdgarPironti Date: Mon, 9 Nov 2015 18:14:42 -0800 Subject: [PATCH] Fixes: Prompt and userData --- examples/acScripts/ControlACs.js | 13 +++++++------ examples/acScripts/ControlledAC.js | 10 +++++----- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/examples/acScripts/ControlACs.js b/examples/acScripts/ControlACs.js index fb33dd3178..60b72446bb 100644 --- a/examples/acScripts/ControlACs.js +++ b/examples/acScripts/ControlACs.js @@ -22,8 +22,8 @@ var controlEntityPosition = { x: 0, y: 0, z: 0 }; // Script. DO NOT MODIFY BEYOND THIS LINE. Script.include("../libraries/toolBars.js"); -var filename = null; -var fileloaded = null; +var clip_url = null; +var input_text = null; var DO_NOTHING = 0; var PLAY = 1; @@ -164,7 +164,8 @@ function sendCommand(id, action) { var position = { x: controlEntityPosition.x + id * controlEntitySize, y: controlEntityPosition.y, z: controlEntityPosition.z }; Entities.addEntity({ - name: filename, + name: "Actor Controller", + userData: clip_url, type: "Box", position: position, dimensions: { x: controlEntitySize, y: controlEntitySize, z: controlEntitySize }, @@ -208,9 +209,9 @@ function mousePressEvent(event) { } else if (stopIcon[i] === toolBars[i].clicked(clickedOverlay, false)) { sendCommand(i, STOP); } else if (loadIcon[i] === toolBars[i].clicked(clickedOverlay, false)) { - fileloaded = Window.browse("Load recording from file", ".", "Recordings (*.hfr *.rec *.HFR *.REC)"); - if (!(fileloaded === "null" || fileloaded === null || fileloaded === "")) { - filename = fileloaded; + input_text = Window.prompt("Insert the url of the clip: ",""); + if(!(input_text === "" || input_text === null)){ + clip_url = input_text; sendCommand(i, LOAD); } } else { diff --git a/examples/acScripts/ControlledAC.js b/examples/acScripts/ControlledAC.js index 25c2ae72d9..8be1172080 100644 --- a/examples/acScripts/ControlledAC.js +++ b/examples/acScripts/ControlledAC.js @@ -12,7 +12,7 @@ HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/"; // Set the following variables to the values needed -var filename = "/Users/clement/Desktop/recording.hfr"; +var clip_url = "https://dl.dropboxusercontent.com/u/14127429/Clips/recording1.hfr"; var playFromCurrentLocation = true; var useDisplayName = true; var useAttachments = true; @@ -51,7 +51,7 @@ COLORS[LOAD] = { red: LOAD, green: 0, blue: 0 }; controlEntityPosition.x += id * controlEntitySize; -Avatar.loadRecording(filename); +Avatar.loadRecording(clip_url); Avatar.setPlayFromCurrentLocation(playFromCurrentLocation); Avatar.setPlayerUseDisplayName(useDisplayName); @@ -71,7 +71,7 @@ function setupEntityViewer() { } function getAction(controlEntity) { - filename = controlEntity.name; + clip_url = controlEntity.userData; if (controlEntity === null || controlEntity.position.x !== controlEntityPosition.x || @@ -147,8 +147,8 @@ function update(event) { break; case LOAD: print("Load"); - if(filename !== null) { - Avatar.loadRecording(filename); + if(clip_url !== null) { + Avatar.loadRecording(clip_url); } break; case DO_NOTHING: