A Flash Developer Resource Site














Internet Commerce

Partners & Affiliates














Developer Channel

internet.com


Featured Flash FLA
Gallery Downloads 11336 Flash Movies | 2 New Flash Movies Added
What's New | Top 100

Featured FLA

» Author: Surjit Dhami
» Title: Book
» Description: Book
» More by Surjit Dhami


Random FLAs | Add Flash Movie
Featured Flash Site
Gallery Downloads 5848 Flash Sites | 0 New Flash Links
What's New | Top 100 Flash Site

Featured Site

» Posted in the Flash Kit Links section
» Title: All-American Rejects
» Description: Get to know this great band by exploring their "practice room".


Random Links | Add your own Flash Related Links
Flash Tutorials 1277 Tutorials 7 New Tutorials Added!
What's New | Top100

» Create xml slideshow with free template
» How to Insert a Multilingual Subtitle Into Your Flash Video Studio
» How to Create Cool Halloween Slideshow
» Debugging flash using the Firebug console
» Create Flash Slideshow on Blogger
» FLASH TRICKS IN WEB ADVERTISING: FLASH BANNERS
» HTML Photo Gallery Tutorial
» Create your first flash site – PART 1
» How to Make a Flash Photo Gallery
» Unknown Tag: Title10
Random Tutorial | Add Site

Sr Instructional Designer D2L-Moodle,Clearance
WSI Nationwide, Inc.
US-NJ-Fort Monmouth

Justtechjobs.com Post A Job | Post A Resume


Tutorials Home What's New Top Rated Submit myTutes Random!

Search Tutorials


Categories Creating 'Track-Points' in Adobe After Effects and using them in a Flash Animation
Author: Martin Overmars | Website: http://www.56k.nl/ |

 
Page 4
«prev 1 2 3 4

Step 3: Using the XML with ActionScript

Basic stuff: placing your FLV on stage

-File -> New... (CTRL+N) -> Flash Document (so, just what you would do normally) -> Ok.

-Click on frame1 on layer1 to select it.
-Window -> Components (CTRL+F7) -> FLV Playback - Player 8 -> FlvPlayback -> doubleclick -> you can exit the components window if you please.
-Leftclick on the component.
-Activate the parameters tab.
-Change the 'contentPath' to the location of your flv. Make sure the 'Match source file dimensions' box is checked.
-Change the 'skin' to 'none' or what you prefer.

-Activate the Properties Tab.
-Modify -> Document... (CTRL+J) -> change the default demensions: W(idth) and H(eight) to the values inside the properties window. -> Change the Frame Rate to the same of your movie, ex. 25 fps -> Ok
-Change both the X and the Y in the properties tab to 0.

Scripting

-Select frame1 on layer1.
-Window -> Actions (F9) -> paste alle script
//create an empty var, ready for XML content.
var xmlContent:XML = new XML();
//ignore empty elements like  instead of
//formatting them to  etc.
xmlContent.ignoreWhite = true;
//the first frame is the first frame where the movie starts playing..
//so start with index 0
i = 0;
//every frame in the flash file is a frame of the flv movie because we synched those
//so we can change the cooords of the animation in refference
//to the coords in the xml file each time the flash file enters a new frame
onEnterFrame = function () {
 //The flv might be playing before the xml is loaded but shit happens
 if (xmlIsLoaded == true) {
 //if the animation is out of synch with the flv..
 offset = -Math.round(25/2);
 //assign the framenumber to a variable
 newNumber = xmlContent.firstChild.childNodes[3].firstChild.childNodes[i+offset].childNodes[0].firstChild.firstChild.nodeValue;
 //assign the new x cooord to a variable
 newX = xmlContent.firstChild.childNodes[3].firstChild.childNodes[i+offset].childNodes[1].firstChild.firstChild.nodeValue;
 //assign the new y cooord to a variable
 newY = xmlContent.firstChild.childNodes[3].firstChild.childNodes[i+offset].childNodes[2].firstChild.firstChild.nodeValue;
 //if there are still framenumbers in the xml file then actualy give the movieClip it's new position
 if (newNumber != undefined) {
 theMovingObject._x = newX;
 theMovingObject._y = newY;
 //Track(newNumber+","+newX+","+newY);
 }
 }
 //Increment the number with one for each time a frame is entered.
 i++;
};
//If the xml file is loaded into flash then...
xmlContent.onLoad = function(loooaded:Boolean) {
 if (xmlContent.hasChildNodes()) {
 //Only start doing things with the xml when it's loaded already,
 //else we're only going to get a big pile of nonesence and maybe bugs.
 xmlIsLoaded = true;
 //As you might have seen or not, there is a pile of useless thingies
 //in the xml file, so when the xml is loaded
 //get rid of the useless elements in it.
 xmlContent.firstChild.childNodes[3].firstChild.firstChild.removeNode();
 xmlContent.firstChild.childNodes[3].firstChild.firstChild.removeNode();
 xmlContent.firstChild.childNodes[3].firstChild.firstChild.removeNode();
 xmlContent.firstChild.childNodes[3].firstChild.firstChild.removeNode();
 xmlContent.firstChild.childNodes[3].firstChild.firstChild.removeNode();
 xmlContent.firstChild.childNodes[3].firstChild.firstChild.removeNode();
 xmlContent.firstChild.childNodes[3].firstChild.firstChild.removeNode();
 xmlContent.firstChild.childNodes[3].firstChild.firstChild.removeNode();
 xmlContent.firstChild.childNodes[3].firstChild.lastChild.removeNode();
 xmlContent.firstChild.childNodes[3].firstChild.lastChild.removeNode();
 xmlContent.firstChild.childNodes[3].firstChild.lastChild.removeNode();
 xmlContent.firstChild.childNodes[3].firstChild.lastChild.removeNode();
 } else {
 //If the file is unreadable, then let me know
 //there is a big chance that you missed my note earlier in my tutorial
 //about that new-versions-of-excel xml thingy.
 Track("XML loading-errorblah");
 }
};
//Start loading the xml file wherein we'd put all
//coordinates and stuff from After Effects
xmlContent.load("07positions.xml");
-Create a movieclip called 'theMovingObject' with your object in it. Like the icecube or the helmet with the propellor on it in the examples I brought up earlier.
-Insert -> New symbol(CTRL+F8) -> make it available for actionscript.

-Make sure it also has the instance name 'theMovingObject'.

And that's it! Sort of... =) hope it was of 'some' use.

Martin

«prev 1 2 3 4

» Level Intermediate

Added: : 2007-05-02
Rating: 10.00 Votes: 2
Hits: 992
» Author
Digital Media Design Student
» Download
Download the files used in this tutorial.
Download (2215 kb)
Get conversion and unzipping tools for PC and Mac here!

» Forums
More help? Search our boards for quick answers!

Please rate this tutorial, 10 is the top rating, you can also click the comments link to read/write a review.
10 9 8 7 6 5 4 3 2 1
Read or Post Comments
 
   
 

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs