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