2013-10-15 52 views
0

我在影片剪辑元件中设置了一个图库。当用户点击主舞台上的剪辑时,我希望它转到作为图库开头的影片剪辑的第2帧。这甚至有可能吗?影片剪辑元件中的图片库。 CS6,AS3

这里是我的代码:

package { 
import flash.display.*; 
import flash.events.*; 
import flash.media.Sound; 
import flash.media.SoundMixer; 
import flash.net.URLRequest; 

public class Deftones extends MovieClip{ 

function Deftones() { 

swerve1.addEventListener(MouseEvent.MOUSE_DOWN, dragStartS); 
swerve1.addEventListener(MouseEvent.MOUSE_UP, dragEndS); 
polt1.addEventListener(MouseEvent.MOUSE_DOWN, dragStartS); 
polt1.addEventListener(MouseEvent.MOUSE_UP, dragEndS); 
rd1.addEventListener(MouseEvent.MOUSE_DOWN, dragStartS); 
rd1.addEventListener(MouseEvent.MOUSE_UP, dragEndS); 
gauze1.addEventListener(MouseEvent.MOUSE_DOWN, dragStartS); 
gauze1.addEventListener(MouseEvent.MOUSE_UP, dragEndS); 
stop1.addEventListener(MouseEvent.CLICK, stopMusic); 
var sound1:Sound= new Sound(); 
var sound2:Sound= new Sound(); 
var sound3:Sound= new Sound(); 
var sound4:Sound= new Sound(); 
sound1.load(new URLRequest("music/Swerve_City.mp3")); 
sound2.load(new URLRequest("music/Poltergeist.mp3")); 
sound3.load(new URLRequest("music/Romantic_Dreams.mp3")); 
sound4.load(new URLRequest("music/Gauze.mp3")); 

function dragStartS(e:MouseEvent){ 
    e.currentTarget.startDrag(); 
} 
function dragEndS(e:MouseEvent){ 
    e.currentTarget.stopDrag(); 
    if (swerve1.hitTestObject(speaker1)){ 
      SoundMixer.stopAll(); 
      sound1.play(0); 
      title.text=" Swerve City"; 
      swerve1.x= 218.30; 
      swerve1.y= 135.10; 
    } 
    else if (polt1.hitTestObject(speaker1)){ 
      SoundMixer.stopAll(); 
      sound2.play(0); 
      title.text=" Poltergeist"; 
      polt1.x= 217.55; 
      polt1.y= 165.35; 
    } 
    else if (rd1.hitTestObject(speaker1)){ 
      SoundMixer.stopAll(); 
      sound3.play(0); 
      title.text="Romantic Dreams"; 
      rd1.x= 217.55; 
      rd1.y= 195.60; 
    } 
    else if (gauze1.hitTestObject(speaker1)){ 
      SoundMixer.stopAll(); 
      sound4.play(0); 
      title.text="  Gauze"; 
      gauze1.x= 217.55; 
      gauze1.y= 225.85; 
    } 
} 
function stopMusic(e:MouseEvent){ 
     SoundMixer.stopAll(); 
    } 
} 
function photoGallery(){ 
    photos1.addEventListener(MouseEvent.CLICK, startGallery); 
    photos1.next1.addEventListener(MouseEvent.CLICK, nextPhoto); 
    photos1.prev1.addEventListener(MouseEvent.CLICK, prevPhoto); 

    function startGallery(e:MouseEvent){ 
     photos1.gotoAndStop(2); 
    } 
    function nextPhoto(e:MouseEvent){ 
     photos1.nextFrame(); 
    } 
    function prevPhoto(e:MouseEvent){ 
     photos1.prevFrame(); 
    } 
} 

}}

任何帮助将不胜感激。

回答

0

是不是你的代码已经到了第2帧?

photos1.gotoAndPlay(2);

+0

否请参阅,我有文本“乐队照片”,它是动画片段。当用户在主舞台上点击时,我想让动画片段的第二帧显示在舞台上。第二帧是画廊开始的地方。我可能会这样做都是错误的。以上只是图库部分的代码。拥有整个代码会有帮助吗? –

+0

我认为这将是一个好主意。我仍然不完全确定你的意思。 – Zoron19

+0

编辑我的代码,所以它都在那里。所以是的,电影剪辑应该基本上作为一个链接打开并启动我的画廊。我在想,我想要做的事是不可能的。 –