I am praticing to convert AS2 to AS3 code . Here moviclip instance name is handle_mc. Here I have AS2 code and trying to convert into AS3. Will u please look at my code of AS3. Is my code is correct ?
AS2 Code聽
stop();
聽聽聽 var t1:Number = 0;
聽聽聽 handle_mc.onPress = function() {
聽聽聽聽聽聽聽 if (t1%26gt;=0) {
聽聽聽聽聽聽聽聽聽聽聽 if ((getTimer()-t1)%26lt;300) {
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 popContent_mc.play();
聽聽聽聽聽聽聽聽聽聽聽 } else {
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 _root.main.pop_mc.startDrag();
聽聽聽聽聽聽聽聽聽聽聽 }
聽聽聽聽聽聽聽 } else {
聽聽聽聽聽聽聽聽聽聽聽 t1 = 0;
聽聽聽聽聽聽聽 }
聽聽聽聽聽聽聽 var time:Number = getTimer();
聽聽聽聽聽聽聽 t1 = time;
聽聽聽 };
聽聽聽 handle_mc.onRelease = function() {
聽聽聽聽聽聽聽 _root.main.pop_mc.stopDrag();
聽聽聽 };
AS3 Code
stop();
聽聽聽 var t1:Number = 0;
聽聽聽 function press_handle_mc(event:KeyEvent)
聽聽聽 {
聽聽聽聽聽聽聽 if (t1%26gt;=0) {
聽聽聽聽聽聽聽聽聽聽聽 if ((getTimer()-t1)%26lt;300) {
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 popContent_mc.play();
聽聽聽聽聽聽聽聽聽聽聽 } else {
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 _root.main.pop_mc.startDrag();
聽聽聽聽聽聽聽聽聽聽聽 }
聽聽聽聽聽聽聽 } else {
聽聽聽聽聽聽聽聽聽聽聽 t1 = 0;
聽聽聽聽聽聽聽 }
聽聽聽聽聽聽聽 var time:Number = getTimer();
聽聽聽聽聽聽聽 t1 = time;
聽聽聽 }
聽聽聽
聽聽聽 function click_handle_mc(event,MouseEvent)
聽聽聽 {
聽聽聽聽聽聽聽 root.main.pop_mc.stopDrag();
聽聽聽 }
聽聽聽
聽聽聽 handle_mc.addEventListener(KeyEvent.PRESS,press_handle_mc);
聽聽聽 handle_mc.addEventListener(MouseEvent.CLICK,click_handle_mc;
No, you still have AS2 code elements in your AS3 code.聽 If you really are trying to learn this, and not just seeing if you can get people to do your design work for you, then you should be running the code, seeing what errors occur, and then researching how to fix them one at a time.聽 The compiler will be happy to tell you where you have problems.聽 That is how you will learn it.
No comments:
Post a Comment