hitcounter
This site is an rss/xml news reader containing our favorite feeds. All articles are the copyrighted material of the blogs that wrote them.

2/9/2010 AS3 Tutorial: Controlling the Main Timeline of
a SWF Embedded at Compile-Time

New Tutorials Blog Entry :

AS3 Tutorial: Controlling the Main Timeline of a SWF Embedded at Compile-Time

Today I was working a a new piece of the Essential Flash Games framework that allows sponsor swf files to be embedded at compile time and displayed before a game reaches the title screen. I am using Flash Develop and the Flex SDK, but the embed compiler directive is also available in the latest versions of the Flash IDE. I wanted to embed rather than load to ensure that the final swf file is a single self-contained unit that can be easily spread to game portals. I tried this a number of different ways to no avail. Most of the standard swf embed code works fine with assets inside the library of embedded swf, but not when trying to control the main time line of the swf itself. So, this is what we are going to cover: If you have been trying to embed swf files at compile time but cannot get you code to recognize the embedded swf, or the totalFrames attribute of the embedded swf returns 0, or if the swf only shows the final frame of your animation then read on. I had all of those problems today and more, but finally figured out a method to make this work properly.

Controlling the Main Time Line of a swf file embedded at run time.

1. Here is the asset that we are going to embed. I Embed all of my assets in a separate Library class as Static Const variables. This could just as easily be in the main document class for your game or application. I will do it the later way here to keep it uncomplicated. This assumes that the 8bitrocketlogo2.swf is in the same folder as the document class. This swf is a multi frame animation with 85 frames on the main time line. (its just important that there is more than a single frame)... [more]

Read The Full Article:
http://www.8bitrocket.com/newsdisplay.aspx?newspage=36607


Add to del.icio.us   Digg this   Post to Furl   Add to reddit   Add to myYahoo!
Website designed by Bartosz Brzezinski
Powered by blogdig.net