Eric Schlenker
Forum Replies Created
-
Eric Schlenker
August 2, 2008 at 10:13 pm in reply to: How can I motion track in AE and apply it to a symbol in Flash?Hey Brett,
I figured out how to make it work! The solution I found actually allows you to grab keyframes in AAE for ANY layer property and apply them to ANY layer inside Flash! I’m pretty stoked with this solution because it saves a TON of time and allows you to use AAE’s powerful motion tracking capabilities (which beats tweening in flash any day)!
“Note: in order for this to work you must have AAE CS3 (at least I think you do). If you don’t, have fun tweening 🙁
Here’s the process:
1) Motion track your video in AAE and apply the trackpoint info (X&Y keyframes) to a null layer as the target layer. Then select the null layer, hit “P” to show it’s new position KF’s, and then click the word “position” to select ALL of it’s KF’s (they should all turn yellow).
2) With all the position KF’s selected for the null layer, choose: File>Scripts…>Convert Selected Properties to Markers. This should then create a layer marker with a black dot in the middle on the null layer for every frame that has a position keyframe. (If you don’t see the markers with a black dot in it then your script might need to be replaced… I can send you the script if it doesn’t work)
This feature is new to CS3 (I think) and enables you to embed “Flash Video Cue Point and Parameter information” into the .flv video that you render from AAE. Basically every one of those layer markers with a black dot should contain the X&Y values for that layer. To see what I mean, double click on one of the markers and look at the bottom half of the Layer Marker dialogue window. The Parameter Name should be “Transform_Position” and the Parameter Value should have a bunch of numbers in it… this is your X&Y coordinates for the null layer for that frame.3) Add the comp to the render queue and change the output module format to “Adobe Flash Video.” You can still change all of your normal render settings to suit your project needs.
For my particular project I needed the .flv to maintain its transparency so I selected channels: “RGB + Alpha” Depth: “Millions of Colors+” Color: “Premultiplied (Matted).” If you don’t have any transparent areas, just keep your channel setting to the RGB default.
Anyways, when you finish choosing all your billion&1 render settings, go ahead and render out your .flv
**Move to Flash**
4) Once your .flv is rendered, open up a new flash project. I used ActionScript 3.0 and I’m not sure if it will work with 2.0… feel free to give it a shot and let me know.
5) Import your .flv to the stage as a movie clip on a new layer.
6) Put your Dynamic text field thing that you were talking about for your project on a new layer as well (or whatever graphic or element that you want the position keyframes from AAE applied to)
7) Create a third new layer and name it “Actions.” Copy this script to the actions panel:
**********************************************************************************
import fl.video.*;
var prop:String;
var obj:Object;
var val:*;YOURMOVIE.addEventListener(MetadataEvent.CUE_POINT, cp_listener);
function cp_listener(eventObject:MetadataEvent):void {
obj = eventObject.info.parameters;
for (prop in obj)
{
val = obj[prop];
if (prop == “Transform_Position”){
var results:Array = val.split(/,/)
YOURTARGETLAYER.y = Number(results[1]);
YOURTARGETLAYER.x = Number(results[0]);
};
}
}
}**********************************************************************************
You will want to change “YOURMOVIE” to whatever instance name you gave your flash video that contains the cue point markers from AAE and also change “YOURTARGETLAYER” to whatever instance name you are giving your target layer (in your case the dynamic text layer thing).
This script basically looks for (or “listens” for) a MetadataEvent… AKA the cuepoint markers you added in AAE. When it finds one, it is going to take the Transform_Position information (in this case an X&Y value) and apply it to the layer of your choice.
Hopefully it will work when you test the movie. It took me a few times to fiddle around with it to get it to work, but this is also the first time I have ever used Flash!
I think I made it sound a lot harder than it really is. After you do it once or twice, the whole process only takes about 2 minutes total… which beats 2 hours of frame-by-frame positioning layers by hand. The end result is FLAWLESS and looks incredible.
I hope this helps, Good Luck!
Eric Schlenker