影片剪辑符号中的图片库。 CS6,AS3

时间:2013-10-15 04:09:09

标签: actionscript-3 flash-cs6

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

这是我的代码:

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();
    }
}

} }

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:0)

您的代码是否已经进入第2帧?

photos1.gotoAndPlay(2);