PDA

View Full Version : Code in first frame?


nsmarina
02-17-2006, 11:21 AM
This code I usually place on a separate layer of the movie clip I'm working in. I'm using it to set a textbox to show the base and a number converted to that base. The handler should check the value in the drop-box and update a variable seen by the text-box: it works, but i'm not sure: does it conform to good actionscript practice?
I'm also confused about how you change the onEnterFrame handlers to be included in that second frame of the first scene


//These variables can prob go in an array right
base = new Number(2);
one = new Number(2);
two = new Number(4);
three = new Number(8);
result = new Number(15);
digits = new String("0 1");
zero = new Number(1);
//and this handler would go in the frame too
function numbersystem_handler(component) {
var index = component.getSelectedIndex();
switch (index) {
case 0 :
one = base=2;
two = 4;
three = 8;
digits = "0 1";
break;
case 1 :
one = base=10;
two = 100;
three = 1000;
digits = "0 1 2 3 4 5 6 7 8 9";
break;
case 2 :
one = base=8;
two = 64;
three = 512;
digits = "0 1 2 3 4 5 6 7";
break;
case 3 :
one = base=16;
two = 256;
three = 4096;
digits = "0 1 2 3 4 5 6 7 8 9 A B C D E F";
break;
}
result = zero+one+two+three;
}
// but how do I change to include this:

xxx.onRelease=function(){
trace("where should i go");
}

this.onEnterFrame = function() {
//do something cool
};