Featured FLA
» Author: Bugra Ozden
» Title: Skatalog v9 - product catalog
» Description: Create your product catalog easly and publish on your website or Create your image gallery, documents list, portfolio. Fully XML Driven
» More by Bugra Ozden
Featured Site
» Posted in the Flash Kit Links section
» Title: Creative DW Image Show PRO
» Description: Creative DW Image Show PRO is a Dreamweaver extension which enables the user to create multimedia presentations. It combines the features of the popular Creative DW Image Show with the ability to add professional text effects to slides (similar to After Effects). The product is very customizable: the user can choose the duration of the transition effects, the slide motion start and end position, zoom and panning type for both images and texts.
The ActionScript coding for "planet1", the planet object, is a bit different from that
last chunk of code. Instead of dealing with objects' reaction to player movement, the
planet1 script deals with setting the size of the planet, which, as we have seen above, is what
determines the simulated speed variables. Open the Actions box for the "planet1" instance
and enter the following code:
This time, in the (load) section, we set the starting size of the object (_height and _width)
as well as the starting location (_x and _y). We also introduce the "thrust" variable, which
will be an important part of the starfield objects as well. This is the forward speed of the
player. It begins as 0, and is influenced by keystrokes. At the end of the (load) section,
there is a very important piece of code, the "swapDepths" command. The planet is created on
its own layer, which is above the layer that holds player1, but it would ruin the effect
we're going for if the planet appeared in front of the target, so we have to switch the
depths of "planet1" and "player1". In the (enterFrame) section, we first see that as the
width of the planet object grows, so does the speed at which it seems to approach the
player ("approachSpeed"). After getting the correct value for "approachSpeed", we then
apply it to grow the size of the planet, making it seem to get closer. At the end of the
script are two keystroke handlers. Hitting the TAB key increases the thrust, hitting the CONTROL
key decreases it.