2013-02-15 5 views
0

나는 boy draw에서 skin, hair, shirt colors를 바꿀 심볼이있는 .fla 파일을 가지고 있습니다. 머리 색깔을 의미CreateJS - 오브젝트의 색상 변경

// 1Hair 
this.shape_226 = new cjs.Shape(); 
this.shape_226.graphics.f("#FCDEC4").s().p("AA").cp(); 
this.shape_226.setTransform(0.1,-95.3);` 

당신은 색상 (#의 FCDEC4)을 볼 수있다, 나는이

처럼, 하나 개의 변수 (boyHair)의 색상을 교체 시도 : 나는 CreateJS로 내보낼 때 나는이있어

을 :

// 1Hair 
this.shape_226 = new cjs.Shape(); 
this.shape_226.graphics.f(boyHair).s().p("AA").cp(); 
this.shape_226.setTransform(0.1,-95.3);` 
파일의 init 함수는이 같은 파일 내 주요 자바 스크립트 값을 설정

//Modified from exported file of Flash Toolkit for CreateJS 
var canvas, stage, exportRoot; 
function init() { 
    canvas=document.getElementById("canvas"); 
    exportRoot=new lib.characters(); 

    stage=new createjs.Stage(canvas); 
    stage.addChild(exportRoot); 
    stage.update(); 

    createjs.Ticker.setFPS(24); 
    createjs.Ticker.addListener(stage); 
} 

생성

var boyHair="#000000"; 

처음에는 코드가 변경되었지만 코드 값을 나중에 수정하면 캔버스에 영향을주지 않으므로 stage.update()으로 시도했지만 아무것도 수행하지 않습니다.

이러한 색상을 비현실적으로 변경하는 방법이 있는지 알고 계십니까? 사전

답변

0

에서

덕분에 현재있는 방법이 없다 - 당신은 색상이 변경 될 때 당신의 모양을 재구성해야합니다.

1

봅니다이

var canvas, stage, exportRoot; 
function init() 
{ 
canvas=document.getElementById("canvas"); 
exportRoot=new lib.characters(); 
stage=new createjs.Stage(canvas); 
stage.addChild(exportRoot); 
createjs.Ticker.setFPS(24); 
createjs.Ticker.addEventListener ("tick", tick); 
} 
tick =function() 
{ 
    var boyHair="#000000"; 
    stage.update(); 
} 
처럼 뭔가를 할 수