demerit
10-22-2007, 07:19 PM
Hi,
BACKGROUND:
I'm attempting to have embedded event cue points within audio-only .flv's (loaded into an FLVPlayback component) trigger animation changes within mainly AS-driven .swf movies (loaded into a movieclip, onstage).
The main movie listens for the cuepoint events and sends the event cue point parameter to a makechange function within the .swf. Inside the .swf, a switch statement takes care of making the animation changes (cases 1-n).
PROBLEM:
When one seeks (let's say from cue point/case 1 to cue point/case 8), the cue points/events/cases from 2-7 get skipped and the animation gets out-of-sync. Same with rewind.
WISH:
It'd be swell to have the animations automatically update post-seek.
GRIM REALITY:
Unless I merge the audio and animation, I am going to have to code each .swf so that whenever a seek is performed, the .swf knows exactly where the .flv playHead is and how the animation needs to be set up, making all the necessary animation changes instantaneous (and "invisibly"), so that the subsequent event cue points can pick up the animation from there.
Seems like a lot of extra work to code-in resets for each navigation cue point. But I don't relish the idea of going back and re-doing all these animations timeline-style... besides, I'd feel like I was dumbing it down instead of having it AS-driven (trying to push myself, you know).
WHERE I'M STUCK:
Axing the scrub bar, I'm setting up navigation cue points to limit the seek possibilities to pre-defined points where I can control setting up the animations properly.
However, the only useful property of the "rewind" or "fastForward" events is the playheadTime. But, using that seems a little sloppy considering the slight variation in the time it returns.
The following is how I've got the listener & function set up.
myFLVPlayback.addEventListener("fastForward",whichnavigationcuepoint);
whichnavigationcuepoint = function(eventObject:Object){
container.setupanimation(eventObject.playheadTime) ;
}
Is there any way to change the scope of the ffw/rew listeners to refer to the navigation cue point? So that whichnavigationcuepoint can send the navigation cue point's parameter to the setupanimation function within the .swf?
Or am I going to have to implement a series of if/then statements with conditions satisfied by slightly varying playheadTimes?
ADDITIONAL AS:
The main movie listens for the cue point events in the .flv and sends them to a function within the .swf:
import mx.video.FLVPlayback;
import mx.utils.Delegate;
//---------------------------------Initialize variables, create .swf container mc
var cfp:FLVPlayback;
var container:MovieClip = createEmptyMovieClip("container", getNextHighestDepth());
//---------------------------------Load external .swf
var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(this);
mcLoader.loadClip("picture004.swf",container);
function onLoadInit(mc:MovieClip) { //Add cuePoint event listener
myFLVPlayback.addEventListener("cuePoint",Delegate.create(this, fireanimation));
}
//---------------------------------Function to send animation change # to .swf
function fireanimation(oEvent:Object):Void {
container.makechange(parseInt(oEvent.info.paramete rs.whichchange));
}
Each .swf uses a switch statement to make the appropriate animation changes:
makechange = function (b:Number) {
switch (b) {
case 1 :
fadein("buckingham_mc");
break;
case 2 :
fadein("aerodynamicforceheader_mc");
break;
case 3 :
fadein("aerodynamicforceequation_mc");
break;
case 4 :
makered("aerodynamicforceequation_mc",1);
break;
case 5 :
makered("aerodynamicforceequation_mc",2);
break;
case 6 :
makered("aerodynamicforceequation_mc",3);
break;
case 7 :
//Dynamic Pressure
makered("aerodynamicforceequation_mc",4,0,"finis");
fadeout("buckingham_mc");
fadeout("aerodynamicforceheader_mc");
fadeout("aerodynamicforceequation_mc");
fadein("dynamicpressureheader_mc",.5);
break;
case 8 :
//Show equation
for (c=3; c<11; c++) {
itemname = "change"+c;
aerodynamicforceequation_mc[itemname]._alpha = 0;
}
fadein("dynamicpressureequation_mc");
break;
.
. (etc)
.
default:
break;
}
BACKGROUND:
I'm attempting to have embedded event cue points within audio-only .flv's (loaded into an FLVPlayback component) trigger animation changes within mainly AS-driven .swf movies (loaded into a movieclip, onstage).
The main movie listens for the cuepoint events and sends the event cue point parameter to a makechange function within the .swf. Inside the .swf, a switch statement takes care of making the animation changes (cases 1-n).
PROBLEM:
When one seeks (let's say from cue point/case 1 to cue point/case 8), the cue points/events/cases from 2-7 get skipped and the animation gets out-of-sync. Same with rewind.
WISH:
It'd be swell to have the animations automatically update post-seek.
GRIM REALITY:
Unless I merge the audio and animation, I am going to have to code each .swf so that whenever a seek is performed, the .swf knows exactly where the .flv playHead is and how the animation needs to be set up, making all the necessary animation changes instantaneous (and "invisibly"), so that the subsequent event cue points can pick up the animation from there.
Seems like a lot of extra work to code-in resets for each navigation cue point. But I don't relish the idea of going back and re-doing all these animations timeline-style... besides, I'd feel like I was dumbing it down instead of having it AS-driven (trying to push myself, you know).
WHERE I'M STUCK:
Axing the scrub bar, I'm setting up navigation cue points to limit the seek possibilities to pre-defined points where I can control setting up the animations properly.
However, the only useful property of the "rewind" or "fastForward" events is the playheadTime. But, using that seems a little sloppy considering the slight variation in the time it returns.
The following is how I've got the listener & function set up.
myFLVPlayback.addEventListener("fastForward",whichnavigationcuepoint);
whichnavigationcuepoint = function(eventObject:Object){
container.setupanimation(eventObject.playheadTime) ;
}
Is there any way to change the scope of the ffw/rew listeners to refer to the navigation cue point? So that whichnavigationcuepoint can send the navigation cue point's parameter to the setupanimation function within the .swf?
Or am I going to have to implement a series of if/then statements with conditions satisfied by slightly varying playheadTimes?
ADDITIONAL AS:
The main movie listens for the cue point events in the .flv and sends them to a function within the .swf:
import mx.video.FLVPlayback;
import mx.utils.Delegate;
//---------------------------------Initialize variables, create .swf container mc
var cfp:FLVPlayback;
var container:MovieClip = createEmptyMovieClip("container", getNextHighestDepth());
//---------------------------------Load external .swf
var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(this);
mcLoader.loadClip("picture004.swf",container);
function onLoadInit(mc:MovieClip) { //Add cuePoint event listener
myFLVPlayback.addEventListener("cuePoint",Delegate.create(this, fireanimation));
}
//---------------------------------Function to send animation change # to .swf
function fireanimation(oEvent:Object):Void {
container.makechange(parseInt(oEvent.info.paramete rs.whichchange));
}
Each .swf uses a switch statement to make the appropriate animation changes:
makechange = function (b:Number) {
switch (b) {
case 1 :
fadein("buckingham_mc");
break;
case 2 :
fadein("aerodynamicforceheader_mc");
break;
case 3 :
fadein("aerodynamicforceequation_mc");
break;
case 4 :
makered("aerodynamicforceequation_mc",1);
break;
case 5 :
makered("aerodynamicforceequation_mc",2);
break;
case 6 :
makered("aerodynamicforceequation_mc",3);
break;
case 7 :
//Dynamic Pressure
makered("aerodynamicforceequation_mc",4,0,"finis");
fadeout("buckingham_mc");
fadeout("aerodynamicforceheader_mc");
fadeout("aerodynamicforceequation_mc");
fadein("dynamicpressureheader_mc",.5);
break;
case 8 :
//Show equation
for (c=3; c<11; c++) {
itemname = "change"+c;
aerodynamicforceequation_mc[itemname]._alpha = 0;
}
fadein("dynamicpressureequation_mc");
break;
.
. (etc)
.
default:
break;
}