createjs

Uncaught TypeError: undefined is not a function

不打扰是莪最后的温柔 提交于 2019-12-12 01:36:06
问题 Button.js: (function () { function Button(label) { console.log(label); } }()); demo.html: <html> <head> <script src="../../lib/easeljs-0.7.1.min.js"></script> <script src="Button.js"></script> <script> window.onload = function() { var canvas, stage, button; canvas = document.getElementById("canvas"); stage = new createjs.Stage(canvas); button = new createjs.Button("Anything"); stage.addChild(button); stage.update(); } </script> </head> <body> <canvas id="canvas" width=200 height=200>Canvas is

I get an error in CreateJS: “createjs is not defined”

霸气de小男生 提交于 2019-12-12 01:19:42
问题 I have a problem with creatJS I hope you can help. var stage = new createjs.Stage(canvas); I got this error : angular.js:13642 ReferenceError: createjs is not defined. even thought i get the EaselJS in my bower-components. Thanks 回答1: I had a similar problem - in my case I added the createjs-module npm package for webpack (I use it in the Laravel wabpack mix). It appeared that there was an issue with the scope, so I had to ensure that createjs is global. So you can try to do the following:

CreateJS play a child movieclip

丶灬走出姿态 提交于 2019-12-12 00:32:51
问题 If you have a child movieclip on stage with an animation in it, can you have the main timeline play the child movieclip at a certain timeline? mc_child is a 20 frame animation with this.stop() at frame one so that it is paused at the beginning. If you add the code this.mc_child.play() or this.mc_child.gotoAndPlay(5) you get an error in createJS. "Uncaught TypeError: Cannot read property 'play' of undefined." How do you make child movieclips play at a certain frame? 回答1: You can use

EaselJs canvas dragstart event not bubbling to parent

我的未来我决定 提交于 2019-12-11 19:24:19
问题 I have a number of canvas elements, which need to be draggable. (not elements within the canvas element, i mean the actual canvas DOM node) The code looks like this <div class="top-parent" draggable="true"> <div class="inner-parent"> <canvas></canvas> </div> </div> If I just have a regular canvas element which hasn't been initialized with createjs the drag drop library i'm working works fine (I believe it works off the html5 dragstart event). If I use new createjs.Stage(canvas); the drag and

how to Include createjs library into reactjs project

柔情痞子 提交于 2019-12-11 14:18:28
问题 Hi I am creating an app on reactjs, which is canvas based, It require Createjs library, I am new for Reactjs I am not getting perfect idea how do this so I tried 2 ways one is using NPM install and other one is I kept my js into one folder and tries to import from there but nothing works for me, here my code way 1 with npm install, import createjs from 'createjs'; way 2 import downloaded js file, import createjs from '../assets/js/createjsmin'; randomly I tried import * as createjs from '..

Exporting CreateJS lib assets for use with require.js

ε祈祈猫儿з 提交于 2019-12-11 09:02:54
问题 I'm trying to use assets (vector, movieclips, etc.) exported from the Flash IDE for CreateJS but we are using require.js to manage our JS code so the exported lib JS is not directly compatible to be loaded with require.js Has anyone figured out what changes to do to the exported JS to adapt it for use with require.js? Here is an example of such an exported JS code: (function(lib, img, cjs) { var p; // shortcut to reference prototypes // stage content: (lib.Lib = function() { this.initialize()

addEventListener (and removeEventListener) function that need param

强颜欢笑 提交于 2019-12-11 07:30:09
问题 I need to add some listeners to 8 object (palms). These object are identical but the behaviour have to change basing to their position. I have the follow (ugly) code: root.palmsStatus = ["B","B","B","B","B","B","B","B"]; if (root.palmsStatus[0] !== "N") root.game.palms.palm1.addEventListener("click", palmHandler = function(){ palmShakeHandler(1); }); if (root.palmsStatus[1] !== "N") root.game.palms.palm2.addEventListener("click", palmHandler = function(){ palmShakeHandler(2); }); if (root

Why does easeljs stage.getBounds() return null?

江枫思渺然 提交于 2019-12-11 06:34:17
问题 In this example: var canvas = document.getElementById("testCanvas"); var stage = new createjs.Stage(canvas); function drawRectangle(){ var rect = new createjs.Shape(); rect.graphics.beginFill("#000").drawRect(10, 10, 100, 100); stage.addChild(rect); } function drawShapes(){ drawRectangle(); stage.update(); } drawShapes(); // Why does this call log null? console.log(stage.getBounds()); <script src="https://cdnjs.cloudflare.com/ajax/libs/EaselJS/0.8.0/easeljs.min.js"></script> <canvas id=

How i change fill color of graphics in create js

白昼怎懂夜的黑 提交于 2019-12-10 21:53:00
问题 I am using this for change color of fill in create js this is not working var shape_rect = new createjs.Shape(); shape_rect.graphics.beginFill("#FFD64B").drawRect(61, 253, 398, 25); shap_rect3.addEventListener('mouseover', function (evt) { shap_rect3.graphics.beginFill("#FFD64B").drawRect(61, 253, 398, 25); stage.update(); }); 回答1: Just a couple of things here: Firstly I noticed that the eventListener is linked to shap_rect3 but this hasn't been defined (at least not in your example). The

Change Color of Shape Mid Tween

这一生的挚爱 提交于 2019-12-10 11:54:46
问题 I'm trying to make an event that changes my shapes stroke color for 5 seconds when a button is clicked, and then the shape returns to original color after the duration. I am able to do this with clearing the entire stage and redrawing new shapes (which resets their position), but I can't figure it out with the current shapes. Q. What's the best way to approach making a change to a shapes color, during a Tween? I was also curious if there's a better way to handling tweening the shapes width?