Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • EspaƱol
      • FranƧais
      • PortuguĆŖs
  • ę—„ęœ¬čŖžć‚³ćƒŸćƒ„ćƒ‹ćƒ†ć‚£
  • ķ•œźµ­ ģ»¤ė®¤ė‹ˆķ‹°
0

When using 'playbackwards()' can't see movie next time I want to play it.

Contributor ,
Oct 06, 2013 Oct 06, 2013

Hi All,

I'm banging my head here:
I have sound cues in a sound file that make tweened movie clips play. (They change alpha state so they fade up.) When I fade up one I also fade down the previous image using 'playbackwards()'.

However, I need to repeat images and it looks like  if I use 'playbackwards()' on an movie clip, I don't see it when I try to play()' it again (play it forwards again).


If I just make the previous image invisible when showing the next image, that previous image will show next time I need to play it...I just can't use 'playbackwards()' on it if I need to play that movie clip again.

Here's some of my code:

// On Cue Point
function onCuePoint(event:CuePointEvent):void
{

//find the movie clip asociated with the string name of the cue in the soundtrack
for ( var faceImg : * in faceImgs ) //run thru all mdImgs
{
  //if the sound cue string name = the faceImg string name
  //then dissolve up the faceImg MC and dissolve down the current faceImg, if there is one

  var newFaceName : String = faceImgs[ faceImg ];

if (event.name == newFaceName) //Find the faceImg MC that matches the cue point name
  {  
   //dissolve up the new faceImg
   faceImg.visible = true;
   faceImg.play(); //face dissolves up
   trace ("faceShowing :" + faceImg);
  
   //dissolve down the current faceImg
   currentFaceImg.playBackwards();
   //currentFaceImg.stop();
   //currentFaceImg.visible = false;
   trace ("previous Img:  " + currentFaceImg);
  
   //The new faceImg becomes the 'current faceImg'
   currentFaceImg = faceImg;
  }

}

}


I've posted the folder with the fla file in question (and sound cue files, etc) here:
http://home.comcast.net/~samiri/director/TEST_soundCues.zip

Any help is greatly appreciated.

TOPICS
ActionScript
2.0K
Translate
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

correct answers 1 Correct answer

Community Expert , Oct 06, 2013 Oct 06, 2013

as mentioned in message 5, you need to terminate that loop:

stop();

function playBackwards():void
{
addEventListener(Event.ENTER_FRAME, enterFrame);
}


function enterFrame(e:Event):void
{

      prevFrame();

if(this.currentFrame==1){

removeEventListener(Event.ENTER_FRAME,enterFrame)

}

}

Translate
Community Expert ,
Oct 06, 2013 Oct 06, 2013

where's playBackwards()?

Translate
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
Contributor ,
Oct 06, 2013 Oct 06, 2013

it's 20 lines down on the above code quote.

In my main timeline frame script it's on line 92

This is a file that is better to look at:

http://home.comcast.net/~samiri/director/TEST_playBackwards.zip

thanks

Translate
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 ,
Oct 06, 2013 Oct 06, 2013

someone may download and correct your file but you'll have to wait.

otherwise, where is  playBackwards() defined?

Translate
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
Contributor ,
Oct 06, 2013 Oct 06, 2013

sorry.

I think I know what you're asking now:

it's defined in the last frame of a frame script in the movie clips that do the tweening (fading up their alpha).

IOW: A frame script in the last frame of the movie clip receives the 'playbackwards()' command from the main timeline frame script (the code copied above) and it runs the movie clip in reverse causing it to fade down the alpha state.

Translate
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 ,
Oct 06, 2013 Oct 06, 2013

you probably need to remove the event listener if you're using an enterframe event or, if you're using a time, stop the timer.

if you don't understand the above, copy and paste the playBackwards() code.

Translate
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
Contributor ,
Oct 06, 2013 Oct 06, 2013

Here's the code in the last frame of the movie clips that fade with the alpha tween:

stop();

function playBackwards():void
{
addEventListener(Event.ENTER_FRAME, enterFrame);
}


function enterFrame(e:Event):void
{
      prevFrame();
}

BTW: There's no script in the first frames of those movie clips.

Thanks

Translate
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
Contributor ,
Oct 06, 2013 Oct 06, 2013

This might be more info than you want but here is the whole frame script in the main timeline:

// Import classes
import net.quip.sound.SoundSync;
import net.quip.sound.CuePointEvent;
import flash.utils.Dictionary; //This allows the building of dictionaries
// Import mx.transitions.Tween; //NEED THIS??

// Stop main timeline
stop();

var faceImgs : Dictionary = new Dictionary(); //This is the dictionary variable that handles all the face images as group

var currentFaceImg:Object = new Object(); //make an object that will hold the current face MC
currentFaceImg = face1_MC; //..fill it with the name of the first faceImg in the variable that holds the current faceImg.
currentFaceImg.visible = true;
currentFaceImg.play();

// Hide all the faceImgs and stop them from playing (except the first one)
//face1_MC.visible = false;
//face1_MC.stop();
face2_MC.visible = false;
face2_MC.stop();
face3_MC.visible = false;
face3_MC.stop();


//======================================================================

loadFaceImgDictionary();


function loadFaceImgDictionary() : void
{
faceImgs  [ face1_MC ] = "face1";
faceImgs  [ face2_MC ] = "face2";
faceImgs  [ face3_MC ] = "face3";
}


// Create an instance of SoundSync
var ss:SoundSync = new SoundSync();
// Use instance to add cue points to sound file
//puts a cuePoint in the soundtrack at the millisecond locationi indicated after the comma
ss.addCuePoint("face3", 2500); //dissolve up face3 (and automatically dissolve down face 1 with code below in 'on cue point')
ss.addCuePoint("face2", 4000); //dissolve up face2 (and automatically dissolve down face 3)
ss.addCuePoint("face3", 12000); //dissolve up face3 again (and automatically dissolve down face 2) <== This is where the problem occurs. We don't see the face3_MC again. It might be there but with a 0% alpha state...I don't know (Any faceImg that the 'playbackwards()' was used on won't show on the stage again.)


// Use instance to load external MP3
ss.load(new URLRequest("hisBoy.mp3"));
ss.play();


// Assign event handlers
ss.addEventListener(CuePointEvent.CUE_POINT, onCuePoint);
ss.addEventListener(Event.SOUND_COMPLETE, onSoundComplete);

// On Cue Point
function onCuePoint(event:CuePointEvent):void
{

//currentFaceImg.stop();

//find the movie clip asociated with the string name of the cue in the soundtrack
for ( var faceImg : * in faceImgs ) //run thru all mdImgs
{
  //if the sound cue string name = the faceImg string name
  //then dissolve up the faceImg MC and dissolve down the current faceImg, if there is one
 
  var newFaceName : String = faceImgs[ faceImg ];

if (event.name == newFaceName) //Find the faceImg MC that matches the cue point name
  {  
   //dissolve up the new faceImg
   faceImg.visible = true;
   faceImg.play(); //face dissolves up

  
   //dissolve down the current faceImg
   currentFaceImg.playBackwards();

     
   //The new faceImg becomes the 'current faceImg'
   currentFaceImg = faceImg;
  }

}

}

// On Sound Complete
function onSoundComplete(event:Event):void
{
  stop();

}

Thanks again.

Translate
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 ,
Oct 06, 2013 Oct 06, 2013

as mentioned in message 5, you need to terminate that loop:

stop();

function playBackwards():void
{
addEventListener(Event.ENTER_FRAME, enterFrame);
}


function enterFrame(e:Event):void
{

      prevFrame();

if(this.currentFrame==1){

removeEventListener(Event.ENTER_FRAME,enterFrame)

}

}

Translate
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
Contributor ,
Oct 07, 2013 Oct 07, 2013

Thanks Kglad,

I understand now: The eventListener was causing the movie to continue to play in reverse and I was seeing a 0% alpha movie clip when I tried to play it again (even if I tried to stop it before trying to play again.)

Thanks again for the lesson.

Translate
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 ,
Oct 07, 2013 Oct 07, 2013
LATEST

you're welcome.

Translate
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