• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

call button in movie clip

New Here ,
Jun 28, 2016 Jun 28, 2016

Copy link to clipboard

Copied

how does the script call button in movie clip in a scene.

if the button in the moving scene occurs.

TOPICS
ActionScript

Views

373

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 28, 2016 Jun 28, 2016

Copy link to clipboard

Copied

i don't understand your question.

if including an image would help you to explain, you can do that by clicking the 'insert image' icon here.

Screenshot - 6_28_2016 , 9_42_27 AM.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 28, 2016 Jun 28, 2016

Copy link to clipboard

Copied

I make a maze game with multiple choice questions.

if the player played and touched the first sign, the matter will appear in the stage. the problems I faced a script if the answer is correct then the question will be lost and continue the game. and if not then game over.Untitled.png

this script

import com.greensock.*;

import com.greensock.easing.*;

//NO. 1

//variabel deteksi keyboard & kecepatan player

var gerakAtas:Boolean = false;

var gerakBawah:Boolean = false;

var gerakKiri:Boolean = false;

var gerakKanan:Boolean = false;

var kecepatan:int = 6;

var jalanNomor:int=1;

//saat pertama kali mulai, frame player berhenti di diam_depan

mobil.gotoAndStop(1);

//tanda di maze terlihat

tanda1.visible = true;

tanda2.visible = true;

tanda3.visible = true;

tanda4.visible = true;

tanda5.visible = true;

//NO. 2

//====================================   KEYBOARD DOWN  ========================================

stage.addEventListener(KeyboardEvent.KEY_DOWN, tekantombol);

function tekantombol(e:KeyboardEvent):void {

  //jika tombol keyboard atas ditekan

  if(e.keyCode==Keyboard.UP) {

  gerakAtas=true;

  }

  //jika tombol keyboard kiri ditekan

  if(e.keyCode==Keyboard.LEFT) {

  gerakKiri=true;

  }

  //jika tombol keyboard kanan ditekan

  if(e.keyCode==Keyboard.RIGHT) {

  gerakKanan=true;

  }

  //jika tombol keyboard bawah ditekan

  if(e.keyCode==Keyboard.DOWN) {

  gerakBawah=true;

  }

//NO. 10

  //JIKA PLAYER TERKENA TANDA

  //TANDA 1

  if (mobil.hitTestObject(tanda1) && tanda1.visible==true) {

  //tanda menjadi tidak terlihat

  tanda1.visible = false;

  //soal berjalan ketengah stage

  tampilsoal()

  this.soal1.gotoAndStop("soalpertama");

  }

  //TANDA 2

  if (mobil.hitTestObject(tanda2) && tanda2.visible==true) {

  //tanda menjadi tidak terlihat

  tanda2.visible = false;

  tampilsoal()

  this.soal1.gotoAndPlay("soalkedua");

  }

  //TANDA 3

  if (mobil.hitTestObject(tanda3) && tanda3.visible==true) {

  //tanda menjadi tidak terlihat

  tanda3.visible = false;

  tampilsoal()

  this.soal1.gotoAndPlay("soalketiga");

  }

  //TANDA 4

  if (mobil.hitTestObject(tanda4) && tanda4.visible==true) {

  //tanda menjadi tidak terlihat

  tanda4.visible = false;

  tampilsoal()

  this.soal1.gotoAndPlay("soalkeempat");

  }

  //TANDA 5

  if (mobil.hitTestObject(tanda5) && tanda5.visible==true) {

  //tanda menjadi tidak terlihat

  tanda5.visible = false;

  tampilsoal()

  this.soal1.gotoAndPlay("soalkelima");

  }

}

//NO. 3

//====================================   KEYBOARD UP  ========================================

stage.addEventListener(KeyboardEvent.KEY_UP, angkattombol);

function angkattombol(e:KeyboardEvent):void {

  if(e.keyCode==Keyboard.UP) {

  gerakAtas=false;

  mobil.gotoAndStop("diam_belakang");

  }

  if(e.keyCode==Keyboard.LEFT) {

  gerakKiri=false;

  mobil.gotoAndStop("diam_kiri");

  }

  if(e.keyCode==Keyboard.RIGHT) {

  gerakKanan=false;

  mobil.gotoAndStop("diam_kanan");

  }

  if(e.keyCode==Keyboard.DOWN) {

  gerakBawah=false;

  mobil.gotoAndStop("diam_depan");

  }

}

//NO. 4

//====================================   ENTER FRAME  ========================================

stage.addEventListener(Event.ENTER_FRAME, eframe);

function eframe(e:Event):void {

  //saat gerakan atas==true maka animasi player berada di jalan belakang

  //dan memanggil fungsi animasiJalan()

  if(gerakAtas==true) {

  mobil.y -=kecepatan;

  mobil.gotoAndStop("jalan_atas");

  //NO. 6

  //panggil fungsi animasi jalan

  animasiJalan();

  }

  else if(gerakBawah==true) {

  mobil.y +=kecepatan;

  mobil.gotoAndStop("jalan_depan");

  //NO. 6

  //panggil fungsi animasi jalan

  animasiJalan();

  }

  else if(gerakKiri==true) {

  mobil.x -=kecepatan;

  mobil.gotoAndStop("jalan_kiri");

  //NO. 6

  //panggil fungsi animasi jalan

  animasiJalan();

  }

  else if(gerakKanan==true) {

  mobil.x +=kecepatan;

  mobil.gotoAndStop("jalan_kanan");

  //NO. 6

  //panggil fungsi animasi jalan

  animasiJalan();

  }

  //NO. 7

  //ubah variable jalannomor menjadi 1 agar player berhenti

  else {

  jalanNomor=1;

  }

  //NO. 9

  //DETEKSI MAZE

  while (s.hitTestPoint(mobil.x, mobil.y-jarakatas, true)) {

  mobil.y++;

  }

  while (s.hitTestPoint(mobil.x, mobil.y+jarakbawah, true)) {

  mobil.y--;

  }

  while (s.hitTestPoint(mobil.x-jarakkiri, mobil.y, true)) {

  mobil.x++;

  }

  while (s.hitTestPoint(mobil.x+jarakkanan, mobil.y, true)) {

  mobil.x--;

  }

}

//NO. 5

//================================   FUNGSI ANIMASI JALAN  ==================================

function animasiJalan() {

  jalanNomor++;

  if(jalanNomor>=16) {

  jalanNomor=1;

  }

  if(mobil.body) {

  mobil.body.gotoAndStop(jalanNomor);

  }

}

//NO. 8

//buat variabel jarak player dengan maze

var jarakatas = mobil.width/2;

var jarakbawah = mobil.width/2;

var jarakkanan = mobil.width/2;

var jarakkiri = mobil.width/2;

  function tampilsoal(){

  TweenLite.to(soal1, 2, {x:400, y:240, alpha:1, ease:Expo.easeOut});

  //matikan fungsi tombol keyboard

  stage.removeEventListener(KeyboardEvent.KEY_DOWN, tekantombol);

  }

  var a:Boolean =true

  var b:Boolean =true

  var c:Boolean =true

  var d:Boolean =true

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 28, 2016 Jun 28, 2016

Copy link to clipboard

Copied

kglad​ i need your help. i confused

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 28, 2016 Jun 28, 2016

Copy link to clipboard

Copied

i still don't understand what you're asking.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 28, 2016 Jun 28, 2016

Copy link to clipboard

Copied

my script in scene "Level 1" and response options were on the movie clip "soal"

I wanted the car, if played on a sign, and the matter will come to the stage. eg a, b, c is the wrong answer and d correct answers. if the answer is wrong, then the scene " Level 1" moved on scene "Game over". and if the answer is correct, question will disappear and continue the game. i use script TweenLite greensock to show  question.

my problem in detection question. in the detection of the question is an example of the calculation of the mathematical multiplication. i want The multiple choice questions. I'm confused here

// FUNCTION TO DISPLAY PROBLEM =============================== ============= ====================

function appearquestion () {

// About walking into the middle stage

TweenLite.to (soalmc, 1, {x: 400, y: 240, alpha: 1, ease: Expo.easeOut});

// Turn off the keyboard function keys

stage.removeEventListener (KeyboardEvent.KEY_DOWN, tekantombol);

}

// =============================== FUNCTION DETECTION OF ANSWERS TRUE / FALSE =========== ======================

function detection question () {

// IF CORRECT ANSWERS

if (qustionmc.answer.text == questionmc.number1.text * questionmc.number2.text) {

TweenLite.to (questionmc, 1, {y: -200, alpha: 0, ease: Expo.easeOut});

stage.addEventListener (KeyboardEvent.KEY_DOWN, tekantombol);

}

// IF ANY ANSWERS

else {

stage.removeEventListener (Event.ENTER_FRAME, eframe);

stage.removeEventListener (KeyboardEvent.KEY_DOWN, tekantombol);

stage.removeEventListener (KeyboardEvent.KEY_UP, angkattombol);

// Go to the scene game over

gotoAndStop ("menugameover", "Game Over");

}

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 29, 2016 Jun 29, 2016

Copy link to clipboard

Copied

LATEST

it's going to be difficult to help you because of language differences and because of your setup.

the main problem with your setup is that relevant code appears to be on different frames (and may even be on different timelines).  that makes debugging via a forum difficult.

i would create an array (or object) of questions and correct answers (and possibly goto frame labels) and use that array/object to determine which question to present and to determine which answer is correct (and possibly which frame to goto).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines