업데이트 : OP의 의견을 바탕으로 새로운 제안 솔루션이 아래에 요약되어 있습니다.
수정 된 (그러나 테스트되지 않은) 솔루션을 아래에 작성했습니다. 여러분이 Flash에 비교적 익숙하지 않기 때문에 ActionScript 3의 일부분, 특히 이벤트 처리와 관련하여 명확한 부분을 명확하게 알려주는 몇 가지 "우회로"를 추가했습니다. 바닥 에 순서 상단에, 행동, 핫스팟, 루프, 및 컬 -
- 이 기본 타임 라인에 4 층 만들기 : 이 끝난부터, 이것은 내가 주 FLA 타임 라인을 설정하는 것이 방법이다
- 핫스팟 레이어에서 클립의 "마우스 가능"영역을 덮는 사각형을 만듭니다. 사각형의 색상을 alpha = 0으로 설정하고 테두리를 제거합니다. 그런 다음 MovieClip 심볼로 변환하고 스테이지 인스턴스 이름을 "hotspot_mc"로 지정합니다.
- 루프 MovieClip을 루프 레이어에 넣고 이름을 "loop_mc"로 지정합니다.
- curl MovieClip을 컬 레이어에 놓고 이름을 "curl_mc"로 지정합니다.
- 는이 라인을 따라 액션 레이어의 첫 번째 키 프레임에 코드를 추가합니다 :
import flash.external.ExternalInterface;
import flash.events.MouseEvent;
import flash.events.Event;
//Stops the main timeline on the first frame
stop();
//Makes the curl_mc invisible
//(Note: alpha varies from 0 to 1, so for instance you can make any
//clip half-transparent by typing clipName.alpha = 0.5)
curl_mc.alpha = 0;
//Stop the curl_mc clip from playing initially, we only want it to begin
//playing on rollover
curl_mc.stop();
//Make your hotspot look like a button when users mouse over it
//by setting these properties on it
hotspot_mc.useHandCursor = true;
hotspot_mc.buttonMode = true;
//We attach our event handlers to the hotspot. Because the hotspot is a
//rectangle of specific position and size it lets us control exactly where
//mouse actions will trigger events. You *could* attach the handlers to
//loop_mc instead, so a hotspot clip isn't strictly necessary, but it's
//handy. You can also make the shape in the hotspot_mc any shape you
//want, it does not need to be a rectangle.
hotspot_mc.addEventListener(MouseEvent.ROLL_OVER, onLoopRollover, false, 0, true);
hotspot_mc.addEventListener(MouseEvent.ROLL_OUT, onLoopRollout, false, 0, true);
//Lastly, to be extra fancy, let's trigger your lightbox when
//the user clicks the hotspot OR when the curl_mc dispatches
//the 'curlComplete' event (which you will set up yourself on
//the last frame of the curl_mc timeline).
hotspot_mc.addEventListener(MouseEvent.CLICK, showLightbox, false, 0, true);
curl_mc.addEventListener('curlComplete', showLightbox, false, 0, true);
//When we roll over the hotspot, hide the loop and show the curl
function onLoopRollover(e:MouseEvent):void
{
//Hide the loop animation so we can see the curl beneath it
loop_mc.alpha = 0;
loop_mc.stop();
//Show the curl animation and play it
curl_mc.alpha = 1;
curl_mc.gotoAndPlay(1);
}
//When we roll out of the hotspot, hide the curl and show the loop
function onLoopRollout(e:MouseEvent):void
{
loop_mc.alpha = 1;
loop_mc.gotoAndPlay(1);
curl_mc.alpha = 0;
curl_mc.stop();
}
//Shows the JavaScript-based lightbox
function showLightbox(e:Event = null):void
{
ExternalInterface.call('JS_ShowLightbox');
}
을 ...마지막으로, curl_mc 타임 라인의 마지막 프레임에 (당신의 카운트 다운 순서 후), 그 타임 라인의 액션 레이어의 키 프레임에 코드를 추가합니다
이
import flash.events.Event;
dispatchEvent(new Event('curlComplete'));
stop();
//dispatchEvent() is a function that sends an event out to be
//handled by any listening handler functions (like the ones on
//frame 1 of the main timeline). dispatchEvent() accepts an Event
//as a parameter, which we create new for this purpose. In turn,
//when creating a new Event, you pass in the name of the event so
//that handlers can tell them apart. This matches the event name
//passed in to addEventListener(eventName, eventHandler, false, 0, true).
//This is how event handlers basically work in AS3. By putting this
//code on the last frame of curl_mc, we use a new event to signal to
//our application that the curl animation is done.
물론,이 상황을 코딩이 하나의 방법보다 더있다. 그러나이 방법을 사용하면 응용 프로그램의 한 영역에서 이벤트를 만들고 "디스패치"하고 다른 위치에서 작성한 함수로 이벤트를 처리하는 방법을 알 수 있습니다.
HTH!
ORIGINAL 답변 :
그때, 마우스 오버 할 때까지 초기 루프를 만들 마우스가 위에있을 때 필백을 재생하는 방법을 작동하지 않을 수 있습니다. 그리고 사용자가 벗어나면 초기 애니메이션 루프로 돌아갑니다.
gotoAndPlay() 및 gotoAndStop() ActionScript 함수를 사용하십시오.
이 두 함수를 사용하여 루프를 만들고 애니메이션 재생을 제어 할 수 있습니다. 예를 들어 키 프레임을 만들 경우, 그것을 선택하고 작업 창을 열고 들어, 다음 ActionScript를 추가 할 수 있습니다
gotoAndPlay(1);
즉시 재생 헤드가이 키 프레임에 도달 한, 타임 라인으로 이동하고 프레임 1에서 재생됩니다 이렇게하면 프레임 1에서 키 프레임까지 무한 재생 루프가 생성됩니다. 재생 헤드가이 키 프레임을 누를 때마다 뒤로 건너 뛰고 다시 시작됩니다.
gotoAndPlay('rolloverStart');
사항 gotoAndStop()는 주어진 프레임으로 이동하고 거기에 애니메이션을 중지합니다 제외하고 같은 방식으로 작동합니다 : 그들은 타임 라인에 정의 된 경우
또한 같은 프레임 레이블을 사용할 수 있습니다.
사용자가 완전히 난 작은 카운트 다운 쇼 (3, 2, 1 개 상황의 종류)를 만들 필요가 다시 박리 될 때까지 구석에 남아있는 경우
, 라이트 박스를 (시작하기 전에이 jQuery를 할 것 , 또는 Flash에서 할 수 있습니까?) 브라우저에서 콘텐츠를 제공합니다.
사용자가 코너 ("핫 스팟") 위로 마우스를 가져 가면
, 보조 애니메이션을 재생하고 가지고 시작합니다 :
그냥 수행하는 두 가지 기능이있다, 명확하게 플래시는 웹 페이지
재에 라이트 박스를 제기해야한다
이 완료되는 조치 : 기능 # 1, 가장 간단한 방법은 롤오버 애니메이션 끝 부분에 카운트 다운 애니메이션을 추가하는 것입니다. 이렇게하면 끝 부분에 하나의 긴 롤오버 애니메이션이 효과적으로 생성됩니다.
Re : function # 2, 라이트를 사용하여 Javascript 기능을 호출 할 수 있습니다.당신의 카운트 다운 애니메이션의 끝에서 당신은 키 프레임을 추가하고이 액션 스크립트 3 코드를 사용할 수 있습니다
import flash.external.ExternalInterface;
ExternalInterface.call('JS_ShowLightbox');
당신이 JS_ShowLightbox (라는 웹 페이지)에 자바 스크립트 기능이있는 경우,이 호출 될 플래시이 키 프레임에 도달 할 때 .
로스
감사
HTH는이 시작하기에 좋은 장소처럼 보인다. newby로서 나는 모든 설명을 분명히 바르게 평가한다. 이 모든 것에 대한 나의 한 가지 질문은 첫 번째 부분 인 루프와 필백에 관한 것입니다. 각 세트는 라이브러리에있는 무비 클립으로 설정되어 있으며 루프는 키 프레임 1에 있고 키 프레임 2에는 필백이 있습니다.이 키 프레임으로 이동하면 해당 MC를 재생하지 않는 것처럼 보입니다. 그 (것)들을 또는 다른 것을 참조하는 다른 방법 있는가? – TheSwansonCode
ActionScript로 play() 및 gotoAndPlay()를 호출하여 MovieClip을 재생할 수 있습니다. 타임 라인의 MovieClips에는 먼저 해당 항목에 액세스하는 데 필요한 이름이 필요합니다. 예를 들어, 프레임 1의 "loop_mc"와 프레임 2의 "rollover_mc"입니다. 프레임 1의 액션 프레임에서 프레임 2의 "loop_mc.play()"및 "rollover_mc.play()"를 호출 할 수 있습니다. MovieClips, ExternalInterface.call에 대한 답변 당 액션 키 프레임이 필요합니다. –
또한 - 마우스 이벤트와 관련하여 질문을 간과했습니다. MouseEvent 및 addEventListener() 함수를 사용하여 마우스 롤오버 및 롤아웃 기능을 설정하는 방법에 대해 알고 있습니까? –