문제

The question may be a little confusing so I will try to simplify it the best I can

I have 2 movieclips on stage with instance names mc1 & mc2

The code in frame is as follows

mc1.onRelease = function() {
    col = new Color(this);
    col.setRGB(Math.random()*"0xFFFFFF");
}
mc2.onRelease = function() {
    orig_col = new Color(mc1);
    new_col = new Color(this);
    new_col.setRGB(orig_col.getRGB()*"0xFFFFFF");
}

The mc1 function is working fine(it's color is getting randomized). But when a user clicks mc2, it gets some weird color, not the color of mc1

Basically, I want when we press mc2, it's color will be what mc1's is..

Please help me fix this...

Thanks!!

도움이 되었습니까?

해결책

This seems helpful for the script of mc2 (the script of mc1 is fine)

mc2.onRelease = function() {
    orig_col = new Color(mc1);
    new_col = new Color(this);
    full_color = "0x"+orig_col.getRGB().toString(16);
    new_col.setRGB(full_color);
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top