how to hide labels from Arcgisdynamic Layer javascriot/ - arcgis-js-api

I want to hide labels from Arcgisdynamic layer.
Below is the code,
var drawingOptions = new LayerDrawingOptions();
drawingOptions.showLabels = false;
var options = [];
options[0] = drawingOptions;
mylayer.setLayerDrawingOptions(options);
var sls = new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, esri.Color([255, 255, 0]), 3);
drawingOptions.renderer = SimpleRenderer(sls);
When i add the above code my layer is not showing. I am using javascript 3.0 API

Related

How do I create a timeline based animation using createJS code in Adobe AnimateCC?

I want to tween using code inside Adobe AnimateCC by using createJS, but when I try and chain them together/animate objects in a sequence, I am running into trouble as they both start at the same time (rather than the square moving then the Circle moving), here is the open AnimateCC file: http://spectrumcreative.co.nz/stackOverflow/animateWithCode.fla and here is my code:
var targetSquare = this.square;
var tweenSquare = createjs.Tween.get(targetSquare, {loop: false})
.to({x: 300}, 1500, createjs.Ease.bounceOut)
var targetCircle = this.circle;
var tweenCircle = createjs.Tween.get(targetCircle, {loop: false})
.to({x: 300}, 1500, createjs.Ease.bounceOut)
The easiest way is to use wait()
I just made animationTime variable for reuse, you can set any amount of time in wait()
var animationTime = 1500;
var targetSquare = this.square;
var tweenSquare = createjs.Tween.get(targetSquare, {loop: false}).to({x: 300}, animationTime, createjs.Ease.bounceOut)
var targetCircle = this.circle;
var tweenCircle = createjs.Tween.get(targetCircle, {loop: false}).wait(animationTime).to({x: 300}, animationTime, createjs.Ease.bounceOut);
This can be done also like this, so the second animation would start only after the first one is finished and call() will fire.
var animationTime = 1500;
var targetSquare = this.square;
var tweenSquare = createjs.Tween.get(targetSquare, {loop: false}).to({x: 300}, animationTime, createjs.Ease.bounceOut).call(function(){
var targetCircle = this.circle;
var tweenCircle = createjs.Tween.get(targetCircle, {loop: false}).to({x: 300}, animationTime, createjs.Ease.bounceOut);
});

how to return shape from mouse event evt.currentTarget.children[0]

var stage, output;
function init() {
stage = new createjs.Stage("testCanvas");
// this lets our drag continue to track the mouse even when it leaves the canvas:
// play with commenting this out to see the difference.
stage.mouseMoveOutside = true;
var circle = new createjs.Shape();
circle.graphics.beginFill("red").drawRoundRect(0, 0, 100,20,10);
//console.log(circle.graphics.command.radius);
var label = new createjs.Text("drag me", "bold 14px Arial", "#FFFFFF");
label.textAlign = "center";
label.y = -7;
var dragger = new createjs.Container();
dragger.x = 50;
dragger.y = 10;
dragger.addChild(circle, label);
stage.addChild(dragger);
dragger.on("pressmove",function(evt) {
// currentTarget will be the container that the event listener was added to:
//evt.currentTarget.x = evt.stageX;
//evt.currentTarget.y = evt.stageY;
// make sure to redraw the stage to show the change:
//console.log(evt.currentTarget.children[0].graphics.command);
var newWidth= evt.stageX - evt.currentTarget.x;
console.log(evt.currentTarget.children[0].graphics);
if(newWidth<0)
newWidth = 0;
evt.currentTarget.children[0].graphics.command.w= newWidth;
evt.currentTarget.children[1].x= newWidth/2;
stage.update();
});
stage.update();
}
this code is working fine under http://www.createjs.com/demos
(i can reach this evt.currentTarget.children[0].graphics.command.w, because evt.currentTarget.children[0] returns shape)
but not on your own html. it is there any js i need to add in the heading?
Did you checked if "pressmove" trigger?
Maybe you should use this stage.enableMouseOver(20); to enable mouse events.

three js vertices does not update

I'm using three.js r67, and vertices does not seem to be updated.
I set geometry.dynamic = true, geometry.verticesNeedUpdate = true.
Circle is moving, but line is static....
Someone could help me?
var scene = new THREE.Scene();
var renderer = new THREE.WebGLRenderer();
var g = new THREE.CircleGeometry( 4, 16 );
var m = new THREE.MeshBasicMaterial({color: 0x114949});
var circle = new THREE.Mesh( g, m );
circle.position.x = 2;
circle.position.y = 2;
circle.position.z = -1;
scene.add( circle );
var material = new THREE.LineBasicMaterial({color: 0xDF4949, linewidth: 5});
var geometry = new THREE.Geometry();
geometry.vertices.push(new THREE.Vector3(0, 0, 0));
geometry.vertices.push(new THREE.Vector3(1, 1, 0));
geometry.verticesNeedUpdate = true;
geometry.dynamic = true;
var line = new THREE.Line(geometry, material);
scene.add(line);
var update = function() {
circle.position.x += 0.01;
line.geometry.vertices[0].x = circle.position.x;
};
var render = function() {
renderer.render(scene, camera);
};
var loop = function() {
update();
render();
requestAnimationFrame(loop, renderer.canvas);
};
loop();
Note: The legacy Geometry class has been replaced with the BufferGeometry class.
If you want to update the vertex positions of your BufferGeometry, you need to use a pattern like so:
mesh.geometry.attributes.position.array[ 0 ] += 0.01;
mesh.geometry.attributes.position.needsUpdate = true;
After rendering, you need to reset the needsUpdate flag to true every time the attribute values are changed.
three.js r.147

Google Apps Script Cannot find method createFile((class))

I just started scripting my first Google App and i can't seem to get pass this error.
What my script does is that it creates a form that allows users to enter data into a google spreadsheet.
And upload a file into the folder BIO.
Please help me out!
This is the code.
function doGet(e) {
var app = UiApp.createApplication().setTitle('New app');
var doc = SpreadsheetApp.openById('0AvOeZM3IzF-GdDRyV3NiTjBreC1ONXh0cHdDMlFhRGc');
var grid = app.createGrid(5, 2);
grid.setWidget(0, 0, app.createLabel('Code:'));
grid.setWidget(0, 1, app.createTextBox().setName('codeName'));
grid.setWidget(1, 0, app.createLabel('Uploaded Date'));
grid.setWidget(1, 1, app.createTextBox().setName('date'));
grid.setWidget(2, 0, app.createLabel("maid's Name"));
grid.setWidget(2, 1, app.createTextBox().setName('maidName'));
//creates vertical panel and declare as panel
var panel = app.createVerticalPanel();
panel.add(grid);
var form = app.createFormPanel().setId('frm').setEncoding('multipart/form-data');
panel.add(app.createFileUpload().setName('thefile'));
form.add(panel);
//creates submit button and declare as button
var button = app.createButton('submit');
//notsure
var handler = app.createServerHandler('b');
//notsure
handler.addCallbackElement(grid);
//notsure
button.addClickHandler(handler);
//add submit button to panel.
panel.add(button);
//addpanel to application
app.add(panel);
//display application
app.add(form);
return app;
}
function b(e) {
var doc = SpreadsheetApp.openById('0AvOeZM3IzF-GdDRyV3NiTjBreC1ONXh0cHdDMlFhRGc');
var lastRow = doc.getLastRow(); //Find the last row
var cell = doc.getRange('a1').offset(lastRow, 0); //finds the next empty cell in column A
cell.setValue(e.parameter.codeName);//i can access paremeter codeName because i setname('codeName') just now.
cell.offset(0, 1).setValue(e.parameter.date);
cell.offset(0, 2).setValue(e.parameter.maidName);
var Blob = e.parameter.thefile;
var folder = DocsList.getFolder('BIO');
folder.createFile(Blob);
var app = UiApp.getActiveApplication();
var label = app.createLabel('File Upload Sucess')
app.close(); //close widget
return app; //close widget
}
Thank you guys in advance!
Jasper.
In order to upload a file in a form you have to use a doGet() / doPost() structure and use a submitButton instead of the 'normal' button you are using.
Note that this configuration does not require to add a callBackElement.
Note also that the form must contain only one element and that the fileUpload widget must be a child of the form. I changed a bit the organization of your Ui creation to make it (hopefully) more clear.
You code should be as follows (didn't check for typos) :
function doGet() {
var app = UiApp.createApplication().setTitle('New app');
var doc = SpreadsheetApp.openById('0AnqSFd3iikE3dFBub2t1Ry1PaXJUMUVkSVVSempCenc');
var form = app.createFormPanel();
var panel = app.createVerticalPanel();
var grid = app.createGrid(5, 2);
grid.setWidget(0, 0, app.createLabel('Code:'));
grid.setWidget(0, 1, app.createTextBox().setName('codeName'));
grid.setWidget(1, 0, app.createLabel('Uploaded Date'));
grid.setWidget(1, 1, app.createTextBox().setName('date'));
grid.setWidget(2, 0, app.createLabel("maid's Name"));
grid.setWidget(2, 1, app.createTextBox().setName('maidName'));
//creates vertical panel and declare as panel
panel.add(grid);
panel.add(app.createFileUpload().setName('thefile'));
form.add(panel);
app.add(form);
var button = app.createSubmitButton('submit');
panel.add(button);
return app;
}
function doPost(e) {
var doc = SpreadsheetApp.openById('0AvOeZM3IzF-GdDRyV3NiTjBreC1ONXh0cHdDMlFhRGc');
var lastRow = doc.getLastRow(); //Find the last row
var cell = doc.getRange('a1').offset(lastRow, 0); //finds the next empty cell in column A
cell.setValue(e.parameter.codeName);//i can access paremeter codeName because i setname('codeName') just now.
cell.offset(0, 1).setValue(e.parameter.date);
cell.offset(0, 2).setValue(e.parameter.maidName);
var Blob = e.parameter.thefile;
var folder = DocsList.getFolder('BIO');
folder.createFile(Blob);
var app = UiApp.getActiveApplication();
var label = app.createLabel('File Upload Success')
app.add(label);
return app; //close widget
}
EDIT following your comment :
to get the url of the file you just uploaded, change the code like this :
...
var folder = DocsList.getFolder('BIO');
var url = folder.createFile(Blob).getUrl();
Logger.log(url);
...

is it possible to to apply mouse/touch events to masks with EaselJs?

Is it possible to add mouse events to a shape mask? I have the mask working, and have animated it in other tests. But now I want to know if masks can be clicked and dragged.
You can see the example here: http://www.webnamehere.com/mask/mask.html
And although Easeljs never never seems to work in jsFiddle, you can also see the code here: http://jsfiddle.net/8kbu3/1/
var circle = new createjs.Shape();
var Galaxy;
$(document).ready(function() {
canvasWidth = "1024px";
canvasHeight = "768px";
stage = new createjs.Stage('demoCanvas');
createjs.Touch.enable(stage);
$("#demoCanvas").attr({width:canvasWidth, height:canvasHeight});
Galaxy = new Image();
Galaxy.src = "images/galaxy.jpg";
Galaxy.onload = handleImageLoad;
function handleImageLoad() {
GalaxyBitmap = new createjs.Bitmap(Galaxy);
GalaxyBitmap.x = 0;
GalaxyBitmap.y = 0;
containerGalaxy = new createjs.Container();
containerGalaxy.addChild(GalaxyBitmap);
containerGalaxy.x = 0;
containerGalaxy.y = 0;
circle = new createjs.Shape();
circle.graphics.beginFill('blue').drawCircle(80,80,50).endFill();
containerGalaxy.mask = circle;
stage.addChild(containerGalaxy);
stage.update();
}
circle.onClick = function(evt){
alert('what the F?');
}
circle.onPress = function(evt){
var offset = {x:circle.x-evt.stageX, y:circle.y-evt.stageY};
evt.onMouseMove = function(ev) {
circle.x = ev.stageX+offset.x;
circle.y = ev.stageY+offset.y;
console.log("circle X: " + circle.x + " | Y: " + circle.y);
stage.update();
}
}
Thanks guys
To receive an click-event you have to add the circle to the stage (stage.addChild(circle)) or to a child of the stage, even if it acts as a mask - in your case it might be better to take a transparent dummy-object as the click-listener.