View Full Version : Cancel running/testing?
doomtoo
August 7th, 2009, 04:14 PM
Any way to cancel the flash application if it gets stuck in an infinite loop? I keep having to close the program because it's getting stuck somewhere, either infinite loop or something redundant, but taking forever to track it down...
smeared
August 7th, 2009, 04:51 PM
you gotta figure it out.. post it here, we'll help.
doomtoo
August 7th, 2009, 05:56 PM
If flash freezes up, it doesn't post stuff to the trace box!?
The problem is, (which may not be too helpful) I can move/scroll my world fine. I can click on guys and "kill" them fine. But some combination of moving and killing causes it to freeze-
I can get it repeatable... I put trace statements before and after blocks of code to find out where it freezes, but like I said above, I think it freezes before flash outputs all the traces....
I click on a guy to kill him- as soon as I click (after moving/killing other guys) it freezes. I added traces to only show when a click has happened.
It seems to get through every function, and finish the "onEnterFrame", but freeze before starting the next one.
I basically have a main loop for my game:
private function onEnterFrame(event:Event):void
{
if(mouse_down)
trace("in on enter frame, about to update map");
Map1.Update(pointer);
if(mouse_down)
trace("done updating map, going to update entities");
for(var i=0;i<entities.length;i++)
{
entities[i].UpdatePosition(Map1);
if(entities[i].state1==entities[i].STATE_DEAD)
{
trace("an entity is dead");
//items.push(item_handler.GetItem(new Intpoint(entities[i].worldPos.x, entities[i].worldPos.y)));
Map1.tiles[Map1.numX*entities[i].worldPos.y+entities[i].worldPos.x].walkable=true;
Map1.tiles[Map1.numX*entities[i].worldPos.y+entities[i].worldPos.x].interactive=false;
Map1.tiles[Map1.numX*entities[i].worldPos.y+entities[i].worldPos.x].object_on_tile=null;
entities.splice(i,1);
}
//entity might be gone by now
else if(Map1.dest.x==entities[i].worldPos.x&&Map1.dest.y==entities[i].worldPos.y&&hero.state1==hero.STATE_IDLE)
{
hero.state1=hero.STATE_ATTACK;
hero.target=entities[i];
trace("attacking entity= "+i);
hero.timer=getTimer();
hero.target=entities[i];
hero.target.TakeDamage(hero.damage);
}
}
if(mouse_down)
trace("done updating entities, going to update hero");
hero.Update(Map1);
if(mouse_down)
trace("done updating hero, going to scroll screen")
if(mouse_up)
{
hero.state1=hero.STATE_MOVING;
//also have to check if mouse click was on enemy unit, and move beside enemy instead of on top of- and check path for enemy
if (this.mouseY<430) {
Map1.ScrollScreen();
}
trace("hero is moving");
}
if(mouse_down)
trace("done scrolling screen");
mouse_up=false;
if(mouse_down)
trace("done setting mouse_up to false");
}
I see the last trace, then flash is frozen... It must not be outputting the traces when they actually occur since this only freezes on a bad guy (so it must be going through the OnEnterFrame again, just not outputting any traces because it freezes)
doomtoo
August 7th, 2009, 06:10 PM
This is as2, but the concepts apply: http://www.kirupa.com/developer/actionscript/trigonometry.htm
google "actionscript trigonometry"
Eh, wrong thread? I'm fine with trig :D
creatify
August 7th, 2009, 06:32 PM
Eh, wrong thread? I'm fine with trig :D
Haha - yep, whoops!
doomtoo
August 8th, 2009, 03:32 PM
I think I found the error- a for loop that had an extra condition that wasnt being met.
But is there any "real" method of debugging aside from using the trace statement? In C++/console you can output before something actually happens- in flash, it appears to output only after successfully finishing a frame.
My for loop was after like 10 trace output statements which where never shown, since frash wouldn't output them if it got stuck in a loop further along in the frame!
Any way around that aside from just making sure you never have a continuous loop?
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.