View Full Version : AS2 to AS3 Problem
Blommestein
May 31st, 2007, 12:43 PM
Attached are two fla's of an edited version of Strille's Tile-Based Engine, one in AS2, the other in AS3. I'm trying to convert the functional AS2 version into AS3, but I'm not having much luck.
Several errors arise and I've no idea why, even when debugging.
Could anyone please take a look and try to figure it out? If anything is unclear, say so.
Thanks. :)
Blommestein
June 1st, 2007, 03:32 PM
Anyone?
Breen
June 1st, 2007, 03:58 PM
I looked at your code, and it seems like a port to AS3 is not as easy as you might think. The reason I didn't reply to your thread, is because your fla seems to be a pretty big mess, I spent 20 minutes trying out some stuff, but saw no light at the end of the tunnel. The engine is doing things that work in AS2, but aren't at all "good" practices.
I would suggest your either learn how the engine works, figure it out, and do a refactor to AS3, or you stick with the AS2 version. It seems it's gonna be more work to migrate it, then to recode it from scratch. Most certainly, if you don't understand how it exactly all fits together.
Blommestein
June 1st, 2007, 04:02 PM
I understood it for the most part in AS2. However I think I know what the problem is, or at least one of them, if you see my thread not too far away from here title 'for..in different in AS3'. Thanks for your 20 minutes though, I appreciate the attempt.
Blommestein
June 1st, 2007, 05:31 PM
Nevermind, creating works, deleting does not.
Blommestein
June 2nd, 2007, 11:01 PM
Well I did convert most of it to AS3, but it turns out it still doesn't function properly when deleting movieclips, but adding them works.
I know it is a bit much to ask others to fix my problems for me, but I am working on it as well at this time, I just think an outside (and also more experienced) perspective never hurt.
Again, there are 2 version of the fla, one working, one no, so one can simply compare the two.
Thanks in advance, anyone is welcome to use this modified version of Strille's engine once it's fixed.
_____
Zip with old files removed, see a few posts down. :)
Breen
June 3rd, 2007, 07:39 AM
I'm getting a runtime error #1010, in dr(), which is the method that deletes childs, and possibly explains the problem.
var holder:Array = [misc,solid,cloud,item,path1,path2,enemy]
That array, are you sure all the items in that clip actually exist?
Dark Viper
June 3rd, 2007, 08:10 AM
Interesting editing. I cant find the problem at the moment.
I've doing the same as you (converting Strilles engine to AS3) and I've done that and have just completed implementing collisiion detection and am now working on shooting. It wasn't easy but it is fun.
Blommestein
June 3rd, 2007, 01:13 PM
I'm getting a runtime error #1010, in dr(), which is the method that deletes childs, and possibly explains the problem.
var holder:Array = [misc,solid,cloud,item,path1,path2,enemy]
That array, are you sure all the items in that clip actually exist?Yeah I'm sure, look right above that line. But it's giving me errors in draw on the second for..in, I think it was a[ax + 1][ay]. Thanks for trying to help.
Interesting editing. I cant find the problem at the moment.
I've doing the same as you (converting Strilles engine to AS3) and I've done that
You converted the original tilebased engine to AS3? If so, could I see it? Thanks for trying to help.
I forgot to add that the WASD keys do the scrolling in both.
Blommestein
June 3rd, 2007, 03:30 PM
Sorry I had attached the wrong AS2 version, the previous one didn't have scrolling.
____________
Edit: Alright I've managed to get rid of the errors but adding if statements beforehand to check if the sub-arrays of a are defined or not. However it still does not work, and I am working on it. Any help would of course be appreciated. Latest AS3 version attached.
Blommestein
June 3rd, 2007, 08:05 PM
Yeah so in case that isn't clear, the errors are gone, however it still does not function properly. Don't forget to disable Keyboard shortcuts when testing in Flash.
__________________________
Ah I've figured it out, or at least exactly where it is wrong. In dr(), the for..in loop (first one seen) that iterates through every object in holder[i], where that represents one of the many holder moviclips, does not run! Does anyone know why??
Thanks once again.
Blommestein
June 4th, 2007, 12:15 AM
YES IT WORKS!
As you may have noticed all my threads have been somehow related to this.
Thank you, TheCanadian for all of your help.
Though you can't see it, the tiles are being deleted when they go off screen. (http://img158.imageshack.us/my.php?image=as3enginenewtest2eu4.swf)
Dark Viper
June 4th, 2007, 05:40 AM
You might have to edit that a bit. (In that uploaded SWF) you can see the tiles being deleted before they actually disappear off the screen when you are scrolling up.
If I may, what kind of game are you creating with this engine?
Blommestein
June 4th, 2007, 12:32 PM
Ah thanks for pointing that out I mistyped a dimension.
Well I'm trying to keep it on the low until I finish it, but check your PM for a demo in AS2.
Dark Viper
June 4th, 2007, 01:35 PM
Cool, same here I want mine secret until I've made significant progress. Nice demo by the way :)
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.