Skip to main content
Participant
December 18, 2014
Question

Errors 1084 and 1086, need help !

  • December 18, 2014
  • 1 reply
  • 224 views

Hello !

First, I apologize for my english, I'm a french graphic student trying to develop an animation in Flash, using AS3.

My problem is : I'm using a sound, and I want it to stop when you click on my object (Montagne), and then restart it if you click again.

Here's my code :

import flash.media.Sound;

import flash.media.SoundChannel;

import flash.events.MouseEvent;

import flash.net.URLRequest;

var music:Sound = new Sound(new URLRequest("fond.wav"));

var sc:SoundChannel = Sound.play();

sc.play();

Montagne.addEventListener(MouseEvent.CLICK, stopMusic);

function stopMusic(event:MouseEvent){

  if(Montagne.currentFrameLabel =="Etape_2"){

  trace("youpi");

  sc.stop();

  }else{

  (Montagne.currentFrameLabel =="Etape_3"){

  trace("itizok");

  sc.play();

  }

  }

}

I have two syntax errors that I can't correct :

1086 : expecting semicolon before left brace

1084 : expecting right brace before left brace

I googled it many times, but I'm definitively blocked...

A little help could be so great ! Thank you in advance !

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
December 18, 2014

try:

import flash.media.Sound;

import flash.media.SoundChannel;

import flash.events.MouseEvent;

import flash.net.URLRequest;

var music:Sound = new Sound(new URLRequest("fond.wav"));

var sc:SoundChannel = Sound.play();

Montagne.addEventListener(MouseEvent.CLICK, stopMusic);

function stopMusic(event:MouseEvent){

  if(Montagne.currentFrameLabel =="Etape_2"){

  trace("youpi");

  sc.stop();

  }else{

if  (Montagne.currentFrameLabel =="Etape_3"){

  trace("itizok");

  sc = music.play();

  }

  }

}