# Collision problem loaded swf

**URL:** https://forum.kirupa.com/t/collision-problem-loaded-swf/331404
**Category:** flash
**Created:** [July 25, 2013, 12:37pm UTC](https://forum.kirupa.com/t/collision-problem-loaded-swf/331404 "2013-07-25T12:37:54Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![andresandei](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@andresandei](https://forum.kirupa.com/u/andresandei)
#### Post date: [July 25, 2013, 12:37pm UTC](https://forum.kirupa.com/t/collision-problem-loaded-swf/331404/1 "2013-07-25T12:37:54Z")

</div>

[COLOR=#000000][FONT=verdana]I have a swf that works pretty good by itself, but when this swf is loaded for another one the collision doesn’t work…[/FONT][/COLOR]

[COLOR=#000000][FONT=verdana]It’s a game, the person need to shoot on the bottles, mira is the “aim” , when the person press spacebar the stone goes in direction where mira is…[/FONT][/COLOR]

[COLOR=#000000][FONT=verdana]the code is:[/FONT][/COLOR]  
[COLOR=#000000][FONT=verdana]ActionScript Code:

[COLOR=#993300]if[/COLOR] ([COLOR=#993300]Key[/COLOR].[COLOR=#993300]isDown/COLOR && !chegou) { [COLOR=#993300]for[/COLOR] (i=0; i\<4; i++) { [COLOR=#F000F0]_//colisão com paredes do labirinto:_[/COLOR] lcX = (mira.\_x-mira.[COLOR=#993300]width[/COLOR])+(mira.[COLOR=#993300]width[/COLOR]\*2); lcY = (mira.\_y-mira.[COLOR=#993300]height[/COLOR])+(mira.[COLOR=#993300]height[/COLOR]\*2); [COLOR=#993300]if[/COLOR] ([COLOR=#993300]\_root[/COLOR][[COLOR=#0000FF]“pinga”[/COLOR]+i].[COLOR=#993300]hitTest[/COLOR](lcX, lcY, [COLOR=#993300]true[/COLOR]) && !chegou) { estourar = [COLOR=#0000FF]“nada”[/COLOR]; [COLOR=#993300]if[/COLOR] (i == escolhidoN) { estourar = [COLOR=#993300]\_root[/COLOR][[COLOR=#0000FF]“pinga”[/COLOR]+i]; verificarFunct(i); } [COLOR=#993300]else[/COLOR] { [COLOR=#993300]trace/COLOR; estourar = [COLOR=#0000FF]""[/COLOR]; \_level10.score -= 1; [COLOR=#993300]\_root[/COLOR].scoreLocal -= 1; } chegou = [COLOR=#993300]true[/COLOR]; } } [COLOR=#993300]\_root[/COLOR].donodobar.[COLOR=#993300]gotoAndPlay/COLOR; arma.mao.mao2.[COLOR=#993300]gotoAndPlay/COLOR; atirar = [COLOR=#993300]true[/COLOR]; }

[/FONT][/COLOR]
