frankikos 0 Denunciar post Postado Dezembro 23, 2008 Olá pessoal...paz e bem e feliz natal p todos! Seguinte...tenho um "joguinho" onde o user irá arrastar as "peças" para encaixar nos devidos lugares. Até ai, tudo bem, consegui fazer sem problemas! Acontece que estou querendo colocar um "aviso" para aparecer ao final de todas as peças encaixadas e ao mesmo tempo, habilitar um botao de "proxima tela". O cod que estou usando para arrastar as "peças": /////////////////////// 1º item_menu e alvo target1.onPress = function() { this.startDrag(true); } target1.onRelease = function() { if(this.hitTest(alvo1)) { this.stopDrag(); } else { this.stopDrag(); this._y = 29; //cordenada y do ponto inicial this._x = 74,5; //cordenada x do ponto inicial } } //////////////////////// 2º item_menu e alvo target2.onPress = function() { this.startDrag(true); } target2.onRelease = function() { if(this.hitTest(alvo2)) { this.stopDrag(); } else { this.stopDrag(); this._y = 60,4; //cordenada y do ponto inicial this._x = 86,2; //cordenada x do ponto inicial } } //////////////////////// 3º item_menu e alvo target3.onPress = function() { this.startDrag(true); } target3.onRelease = function() { if(this.hitTest(alvo3)) { this.stopDrag(); } else { this.stopDrag(); this._y = 91,8; //cordenada y do ponto inicial this._x = 66,2; //cordenada x do ponto inicial } } //////////////////////// 4º item_menu e alvo target4.onPress = function() { this.startDrag(true); } target4.onRelease = function() { if(this.hitTest(alvo4)) { this.stopDrag(); } else { this.stopDrag(); this._y = 123,2; //cordenada y do ponto inicial this._x = 76,9; //cordenada x do ponto inicial } } //////////////////////// 5º item_menu e alvo target5.onPress = function() { this.startDrag(true); } target5.onRelease = function() { if(this.hitTest(alvo5)) { this.stopDrag(); } else { this.stopDrag(); this._y = 154,6; //cordenada y do ponto inicial this._x = 64,2; //cordenada x do ponto inicial } } //////////////////////// 6º item_menu e alvo target6.onPress = function() { this.startDrag(true); } target6.onRelease = function() { if(this.hitTest(alvo6)) { this.stopDrag(); } else { this.stopDrag(); this._y = 186,0; //cordenada y do ponto inicial this._x = 67,3; //cordenada x do ponto inicial } } //////////////////////// 7º item_menu e alvo target7.onPress = function() { this.startDrag(true); } target7.onRelease = function() { if(this.hitTest(alvo7)) { this.stopDrag(); } else { this.stopDrag(); this._y = 217,4; //cordenada y do ponto inicial this._x = 72,3; //cordenada x do ponto inicial } } //////////////////////// 8º item_menu e alvo target8.onPress = function() { this.startDrag(true); } target8.onRelease = function() { if(this.hitTest(alvo8)) { this.stopDrag(); } else { this.stopDrag(); this._y = 248,8; //cordenada y do ponto inicial this._x = 64,3; //cordenada x do ponto inicial } } //////////////////////// 9º item_menu e alvo target9.onPress = function() { this.startDrag(true); } target9.onRelease = function() { if(this.hitTest(alvo9)) { this.stopDrag(); } else { this.stopDrag(); this._y = 280,2; //cordenada y do ponto inicial this._x = 76,8; //cordenada x do ponto inicial } } //////////////////////// 10º item_menu e alvo target10.onPress = function() { this.startDrag(true); } target10.onRelease = function() { if(this.hitTest(alvo10)) { this.stopDrag(); } else { this.stopDrag(); this._y = 311,6; //cordenada y do ponto inicial this._x = 76,5; //cordenada x do ponto inicial } } //////////////////////// 11º item_menu e alvo target11.onPress = function() { this.startDrag(true); } target11.onRelease = function() { if(this.hitTest(alvo11)) { this.stopDrag(); } else { this.stopDrag(); this._y = 343,0; //cordenada y do ponto inicial this._x = 73,9; //cordenada x do ponto inicial } } //////////////////////// 12º item_menu e alvo target12.onPress = function() { this.startDrag(true); } target12.onRelease = function() { if(this.hitTest(alvo12)) { this.stopDrag(); } else { this.stopDrag(); this._y = 374,4; //cordenada y do ponto inicial this._x = 86,9; //cordenada x do ponto inicial } } /////////////////////// segunda parte p exibir mensagemVejam aqui, uma imagem do "joguinho": Acho que consegui me expressar legal né....aguardo ajuda!!! Compartilhar este post Link para o post Compartilhar em outros sites
Freelife 2 Denunciar post Postado Dezembro 23, 2008 Boa tarde... Não sei se tem alguma maneira mais fácil de fazer, mas acho que você teria que fazer uma condição para verificar a posição dos objetos. Tipo: Se(target1._x == seu valor && target1._y == seu valor){ então a variável "a" = 1 } else if(taget2._x == seu valor && target2._y == seu valor){ então a variável "b" = 1 } Depois faça uma condição para verificar os valores das variáveis "a", "b"... se a condição for verdadeira mostre a mensagem e o botão, senão... motre uma mensagem tipo "tente novamente". Acho que é isso, mas talvez alguém ainda tenha uma maneira mais fácil. Abraços e boas festas Compartilhar este post Link para o post Compartilhar em outros sites
frankikos 0 Denunciar post Postado Dezembro 23, 2008 Caramba......deu um nós na minha cabeça!! sabe, eu até tentei usar +- um cod do fabio Henrique...mas nao rolou! Agradeço a ajuda e vou ver se pinta mais alguma sugestao!! Compartilhar este post Link para o post Compartilhar em outros sites
Freelife 2 Denunciar post Postado Dezembro 23, 2008 Noite galera... Então... como eu disse não sei se tem alguma maneira fácil de fazer isso... mas fiz um exemplo... http://rapidshare.com/files/176237244/Teste_de_Alvo.rar é como eu aprendi a fazer.... Abraços e até mais... Compartilhar este post Link para o post Compartilhar em outros sites
frankikos 0 Denunciar post Postado Dezembro 24, 2008 Boa noite Free......caracas...interesante. Saquei as "variaveis"....agora, vou adaptar p/ o meu cod e ver se funfa... Só vai faltar habitiar o botao de "proxima página"....Mas já dá para quebrar uma "árvore"... ...mais uma vez, Santo Forum!! como a gente aprende com isso hien! Mas ainda não vou fechar o topico!! Abraços e Santo natal para você e p todos!!! Compartilhar este post Link para o post Compartilhar em outros sites
Freelife 2 Denunciar post Postado Dezembro 24, 2008 Pra você tbém! Santo natal! Que Deus esteja conosco! O botão de próxima eu tinha esquecido, mas basicamente é só colocar dentro do if que está dentro da função verificar: verificar = function(){ if( a == 1 && b == 1 && c == 1 && d == 1){ resultado = "Parabéns! Você acertou!"; botaonext_btn._visible = true;//deixa o botão visível se estiver tudo certo. trace(a +"/"+ b +"/"+ c +"/"+ d); } else{ resultado = "Oh que pena... Tente novamente!!!" } } Abraços Compartilhar este post Link para o post Compartilhar em outros sites
frankikos 0 Denunciar post Postado Dezembro 26, 2008 Nossa Free....agradeço mesmo... Acabei me esquecendo de dizer (antes da Noite de Natal), que usei o cod e deu certinhu...e para o botao, eu tinha pensado em chamar um "frame" mais a frente - mas vendo sua ajuda denovo, me abriu os olhos e ajudou novamente!!!! Outra vez obrigado e sou fã incondicional desse Forúm!!! Vamos ver no que dá!! Compartilhar este post Link para o post Compartilhar em outros sites