Pyramids using AS3 drawing API

Let’s continue from where we finished last post. We have Triangle AS3.0 class up and running and we want to use it and draw some pyramids.If you look carefully you will notice that every pyramid consist of two triangles. This is actually simplified version where only two sides are visible and front side triangle has 3 x 60 degrees angles. This is the reason why we need only top pyramid point coordinates and its height, because with some simple math we can easily find other points.Here is Pyramide.as classpackage com.blogspot.flanture.triangles{ import com.blogspot.flanture.triangles.Triangle; import flash.display.Sprite; import flash.geom.Point; public class Pyramide extends

You Might Also Like...

  • Visual Rectangles Intersection AS3 Example

    946 readersActionScript3.0 Rectangle class is part of the flash.geom package besides Point, Matrix, Transform and ColorTransform. Any visual representation of rectangles has to be implemented by programmer. One way of doing it is to create new class and here I wanted to include rectangle color as initial parameter, so this new class vRectangle (from visual rectangle,

  • Energy Bar Flash Game AS3 Tutorial

    937 readersIn some Flash games author often has a need to display energy bar for hero character or enemy character or both. In this tutorial you will learn how to create reusable energy bar which you can ..., well reuse, in all your future projects. Code is pure ActionScript 3.0. I'm trying to develop this habit

  • The “in” operator

    368 readersJuten Tach, i work with Actionscript for some time now, but i wasn’t aware of that little thing. You can use “in” for checking, if an attribute/field exists in an object, like so: package { import flash.display.Sprite; public class Test extends Sprite { public function Test() { [...]

  • Quick Tip: How to Export Flash to PNG with HYPE

    1522 readersWith Flash you can create some awesome code generated graphics. Often you’d like to save these graphics as an image, so you can edit them afterwards with image editing software or just showcase them. We’ll use the HYPE framework from Joshua Davis and Branden Hall to save our code-generated graphics as a PNG. View Screencast Don’t like

  • Random Generator updated to AS3

    818 readersIf you are blogger, are you happy to see your older posts are still read and commented, even years has past? I am. Especially if I see ppl are using my older code for learning. That's why I updated AS2 Random Number Generator to AS3 version. There is one new getRan function which return random

  • Ononmin Flash prototype – step 3

    285 readersIn this 3rd part we’ll manage stage edges and balls collisions. You’re invited to read steps 1 and 2 if you didn’t already. The main function does not change. 1 2 3 4 5 6 7 8 9 10 11 package { import flash.display.Sprite; public class onon extends Sprite { // field_mc has a parameter

  • Encapsulating RemoteObject in Flex 4

    872 readersWith the ease of customization of Flex, you can expedite the production of their applications by encapsulating internal routines (the player) or external, by creating a custom component that will be used for any application. Here I board the DataGrid, but with the simplicity of ActionScript, you realize that you will can easily change it

  • Interesting Tutorial: Make a Magnetic Button in Flex 4

    735 readersThis interesting tutorial explains how to make a magnetic button in Flex 4 with a simple example. Here is the source code of this class which extands spark button: package com.flexblog.components {     import flash.events.MouseEvent;     import flash.ui.Mouse;        import mx.core.FlexGlobals;     import mx.events.FlexEvent;     import mx.events.MoveEvent;        import spark.components.Button;     import spark.effects.Move;

  • Using a class in flashx.textLayout package prevents the constructor from accessing Stage

    754 readers“Text Layout Framework example: News layout” in the [Help] yields the run-time error #1009. Because using a class in flashx.textLayout package prevents the constructor from accessing the Stage instance. As the test script below shows, the Stage object is available after the DisplayObject.addedToStage event, which is dispatched twice. package { import flash.display.Sprite; import flash.events.Event; import

  • Quick Tip: Check Flash Player Version Using ActionScript 3

    985 readersIn this Quick Tip, I’ll show you how to get and display the Flash Player Version using ActionScript. Let’s take a look! Final Result Preview Here’s the final result we will be working towards: Step 1: Brief Overview Using the Capabilities class, we’ll get the Flash Player version and Operating System then display them in a series of TextFields. Step