Ich habe HTML5-Leinwand erstellt und Rechteck wie Film (Movie1) hinzugefügt Dann habe ich Animate für Movie1 erstellt Aber ich weiß nicht, wie JS funktioniert, wenn ich versuche Animate zu stoppen.Adobe Animieren gotoAndStop für Movieclip
AS3 Aktion: Frame1
trace (this.Movie1);
this.Movie1.gotoAndStop(1);
Wie ich brauche es auf JS zu schreiben?
Ich überprüfe anders, aber alle funktionieren nicht.
this.Movie1.gotoAndStop(1);
Movie1.gotoAndStop(1);
öffnete ich Konsole IE und sah
SCRIPT5007: Kann nicht Eigentum 'gotoAndStop' undefinierter oder NULL-Verweis
auch ich
zweite Beispielthis.stop();
alert(this.Movie1);// output: MovieClip (name=null)
//this.Movie1.gotoAndStop(1);
this.addEventListener('click', alertpopup);
function alertpopup(){
//this.Movie1.gotoAndStop(1);
alert(this.Movie1); // output: undefined ???
}
Also ich schrieb bekommen entschied diese Aufgabe nur, wenn ich Code in generierte HTML-Datei am Ende Function Init() eingefügt. So etwas wie das
var canvas, stage, exportRoot;
function init() {
// --- write your JS code here ---
canvas = document.getElementById("canvas");
exportRoot = new lib.ExAS3_Canvas();
stage = new createjs.Stage(canvas);
stage.addChild(exportRoot);
stage.update();
createjs.Ticker.setFPS(lib.properties.fps);
createjs.Ticker.addEventListener("tick", stage);
Update(exportRoot);
}
function Update(root){
<!-- write your code here -->
root.stop();
//this.Movie1.name = 'Movie1';
console.log("m=" + root.Movie1);
root.Movie1.stop();
root.Movie1.addEventListener('click', alertpopup);
function alertpopup(){
root.Movie1.gotoAndStop(1);
console.log("r=" + root.Movie1);
}
}
Warum funktioniert der Code nicht von der IDE?
Ich versuche auf exportRoot
this
auf meinem ersten Frame zu ändern und es funktioniert teilweise
//this.Movie1.stop(); // it doesn't work
//exportRoot.Movie1.stop(); // it doesn't work
this.Movie1.addEventListener('click', alertpopup);
var i = 0;
function alertpopup(){
i++;
if(i==2) i = 0;
exportRoot.Movie1.gotoAndStop(i);
}
Vielen Dank für Informationen. Ich denke für jedes Programm muss ich CreateJS ohne IDE verwenden. Es wird leichter sein. Aber ich habe keinen normalen JS-Editor dafür statt Notepad ++. – askeet