0
마우스 클릭시 다른 배열로 교체하고 싶은 Flash var 배열이 있습니다.마우스 클릭시 Flash var 배열을 바꿀 수 있습니까?
현재 빈 MC에 초기 배열을 완벽하게로드합니다. 이제 사용자가 buttonMC를 누르면 var productTxt2로 바꿔야합니다. 내 코드는 아래와 같습니다.
AS2 코드 :
var productTxt1 = new Array(
"Product Name 1", "Price 1", "Headline 1", "Copy 1");
var productTxt2 = new Array(
"Product Name 2", "Price 2", "Headline 2", "Copy 2");
_root.createEmptyMovieClip("productInfoMC", 0);
with (productInfoMC){
var txt1:TextField = createTextField("name", 1, 0, 0, 0, 0);
var txt2:TextField = createTextField("price", 2, 0, 0, 0, 0);
var txt3:TextField = createTextField("headline", 3, 0, 0, 0, 0);
var txt4:TextField = createTextField("copy", 4, 0, 0, 0, 0);
txt1.htmlText = _root.productTxt1[0];
txt1.autoSize = true;
txt2.htmlText = _root.productTxt1[1];
txt2.autoSize = true;
txt3.htmlText = _root.productTxt1[2];
txt3.autoSize = true;
txt4.htmlText = _root.productTxt1[3];
txt4.autoSize = true;
}
감사합니다 -이 거의 작동합니다. 단추를 클릭하면 이전 배열 텍스트가 사라지지만 새 배열 텍스트가 표시되지 않습니다. –
@ Justin Cross - 'buttonMC.onPress = function() { \t var tmpArr : Array = productTxt1 [0] == tfArr [0] .htmlText? productTxt2 : productTxt1; updateText (tmpArr); }' – www0z0k