2009-10-13 7 views
0

두 프레임의 Flash CS3 애니메이션이 있습니다. 첫 번째 프레임에서 네 개의 이미지를 프레임에로드하고 TweenLite를 사용하여 성공적으로 회전합니다. 사용자가 버튼을 클릭하면 변수 (resumeVideoOn)가 사용자가보고있는 현재 이미지를 나타내도록 설정되고 해당 비디오를 재생하는 frame2로 이동합니다. 동영상 재생이 끝나면 버튼을 클릭하여 동영상을 재생하거나 버튼을 클릭하여 frame1로 돌아갈 수 있습니다 (간단한 gotoAndPlay (1) 호출). 사용자가 frame1로 돌아 오면 'resumeVideoOn'값을 감지하여 애니메이션 루프를 다시 시작할 함수를 결정합니다. 초기 이미지를 올바르게로드합니다. 그러나 일련의 함수 (이 함수에서 호출되는 다른 트윈이 올바르게 작동한다는 사실과 흔적 때문에 말할 수 있음)를 통해 계속 실행되는 동안 원래 이미지 만 표시됩니다 (다른 세 이미지는 TweenLite가 호출 함)이 표시되지 않습니다. 나는 지금 잠시 동안 동그라미에 갔다. 다음은 많이 있지만 코드의 일부는, 그래서 난 단지 필요한 물건을 넣어 시도 : 또한플래시 AS3 트위터 및 XML 문제

// pull in images and video properties thru XML 
var myXMLLoader:URLLoader = new URLLoader(); 
myXMLLoader.load(new URLRequest("flash.xml")); 
myXMLLoader.addEventListener(Event.COMPLETE, processXML); 

function processXML(e:Event):void { 
    var myXML:XML = new XML(e.target.data); 
    my_videos = myXML.VIDEO; 
    my_total = my_videos.length(); 
    if(my_total > 0) { 
     makeContainers(); 
     callImgs(); 
    } else { 
     trace("put alternate case here in case nothing is loaded");   
    } 
} 

function makeContainers():void { 
    main_container = new Sprite(); 
    addChild(main_container); 

    main_container.addChild(image1); 
    main_container.addChild(image2); 
    main_container.addChild(image3); 
    main_container.addChild(image4); 

    setChildIndex(DisplayObjectContainer(main_container),0); 
} 

function callImgs():void { 
    var img_loader1 = new Loader(); 
    img_loader1.load(new URLRequest(my_videos[0][email protected])); 
    image1.addChild(img_loader1); 
    wtv1 = my_videos[0][email protected]; 
    video1 = my_videos[0][email protected]; 

    var img_loader2 = new Loader(); 
    img_loader2.load(new URLRequest(my_videos[1][email protected])); 
    image2.addChild(img_loader2); 
    wtv2 = my_videos[1][email protected]; 
    video2 = my_videos[1][email protected]; 

    var img_loader3 = new Loader(); 
    img_loader3.load(new URLRequest(my_videos[2][email protected])); 
    image3.addChild(img_loader3); 
    video3 = my_videos[2][email protected]; 
    wtv3 = my_videos[2][email protected]; 

    var img_loader4 = new Loader(); 
    img_loader4.load(new URLRequest(my_videos[3][email protected])); 
    image4.addChild(img_loader4); 
    wtv4 = my_videos[3][email protected]; 
    video4 = my_videos[3][email protected]; 
} 

function imgLoaded(e:Event):void { 
    var my_img:Loader = Loader(e.target.loader); 
    image1.addChild(my_img); 
} 


//tween and go to video on frame 2 if clicked on myFrame1() 
function myFrame1():void { 
    //image 1 
    image1.alpha = 100;// start faded down 

    TweenLite.to(selectedFrame, 1, {x:501.6, overwrite:1}); 
    TweenLite.to(image1, 1, {alpha:0, delay:3, overwrite:0}); 
    TweenLite.to(image2, 1, {alpha:1, delay:3, overwrite:0}); 
    //wtv1 
    if(wtv1 == "right") { 
     TweenLite.to(watchthevideo_right_mc, 1, {alpha:1}); 
     watchthevideo_right_mc.addEventListener(MouseEvent.CLICK, playVideo1); 
     TweenLite.to(watchthevideo_right_mc, 1, {alpha:0, delay:3, overwrite:0, onComplete:myFrame2}); 
    } else { 
     TweenLite.to(watchthevideo_left_mc, 1, {alpha:1}); 
     watchthevideo_left_mc.addEventListener(MouseEvent.CLICK, playVideo1); 
     TweenLite.to(watchthevideo_left_mc, 1, {alpha:0, delay:3, overwrite:0, onComplete:myFrame2}); 
    } 
} 

function playVideo1(e:MouseEvent):void { 
    //kill all tweens 
    TweenLite.killTweensOf(watchthevideo_right_mc); 
    TweenLite.killTweensOf(watchthevideo_left_mc); 
    TweenLite.killTweensOf(image1); 
    TweenLite.killTweensOf(image2); 
    TweenLite.killTweensOf(image3); 
    TweenLite.killTweensOf(image4); 
    videoFile = video1; 
    resumeVideoOn = 1; 
    gotoAndPlay(2); 
} 

// on frame 2 
// after video is played 
function returnShow(e:MouseEvent):void { 
    TweenLite.to(_replayButton, 1, {alpha:0, overwrite:0}); 
    TweenLite.to(_returnButton, 1, {alpha:0, overwrite:0}); 
    _replayButton.visible = false; 
    _returnButton.visible = false; 
    TweenLite.to(rectangle, 1, {alpha:0, overwrite:0}); 

    //reset all video data 
    removeChild(video); 
    removeChild(pause_mc); 
    removeChild(play_mc); 
    removeChild(volslide_mc); 
    removeChild(controls_mc); 
    removeChild(controlBacker_mc); 
    removeChild(_replayButton); 
    removeChild(_returnButton); 

    gotoAndPlay(1); 
} 

// when the user returns to frame 1, the variable 'resumeVideoOn' is checked 
// in an if statement to determine where to resume. the if statement is run, 
// then goes to function myFrame2 (or whatever the next frame is), but the image 
// is not changing 

을 내 xml 파일은 다음과 같습니다

<?xml version="1.0" encoding="UTF-8"?> 
<MYLIST> 
<VIDEO VIDURL="videos/video1.flv" WTVPOS="right" IMG="imgs/image1.jpg" /> 
<VIDEO VIDURL="videos/video2.flv" WTVPOS="left" IMG="imgs/image2.jpg" /> 
<VIDEO VIDURL="videos/video3.flv" WTVPOS="right" IMG="imgs/image3.jpg" /> 
<VIDEO VIDURL="videos/video4.flv" WTVPOS="left" IMG="imgs/image4.jpg" /> 
</PHHLIST> 

답변

0

가 그냥 알아 냈어 , 관심 누구 ... 을 위해 나는 일 것을 볼 수 있었다, 나는 비디오 윈도우에 비해 디스플레이 창 큰 드래그하면 2 프레임에 사용자를 보내는 함수에

removeChild(main_container); 

을 추가 할 필요 원본 이미지가 여전히 스테이지에 있었기 때문에 사용자가 프레임 1로 돌아 왔을 때 표시되는 모든 이미지를 차단합니다.