Posts

how to load a bitmap and cut into pieces using ationscript 3.0

Loading a Bitmap A Loader object is a special version of a Sprite that pulls its data from an external source. You need to pair it up with a URLRequest, which handles the network file access. Here is a simple class that loads a single JPG file and places it on the screen. After creating a new Loader and a new URLRequest, we pair them with the load command. The entire process takes only three lines of code. Then, we use addChild to add the Loader object to the stage, just like a normal display object like a Sprite: package { import flash.display.*; import flash.net.URLRequest; public class BitmapExample extends MovieClip { public function BitmapExample() { var loader:Loader = new Loader(); var request:URLRequest = new URLRequest("myimage.jpg"); loader.load(request); addChild(loader); } } } It is positioned in the upper-left corner. Because the Loader object acts like a normal display object, we can also set its x and y position to center it on the sc...

Linking and Removing Event Listener easy video tutorial

Image
These videos are aimed at complete newcomers to programming and are primarily made for pre-university students. You are expected to have an understanding of Flash drawing/animation before completing these tutorials.

Embedding or loading assets in flash

The best way to get at a bitmap is to upload the bitmap in your SWF, which is handled in two different techniques, based on your compiler. First, if you are using Fold Designer, the mxmlc compiler through the control range, or the Fold compiler as an option in the Flash IDE, you can use the upload metatag to upload your bitmap resource, as was mentioned in the “Introducing Bitmap” area previously this part. If you are using the Present IDE, you can transfer the bitmap into your collection and move it for ActionScript (in this situation, perhaps as the category LogoImage). As these two techniques are not consistent for all conditions, we will not use them in the illustrations in this publication. Please see the Fold or Present certification for further details on these techniques. No issue your strategy of option for embedding, you can instantiate the bitmap using the class constructor and thrown it as a Bitmap. Since Bitmap is a DisplayObject, you can then add it immediat...

Move a Sprite at a certain speed in a specific angular direction

You can use some basic trigonometric functions to convert this angle and speed to component x and y velocities. First, you need to make sure the angle is in radians. If the angle is in degrees, convert it by using the following formula: radians = degrees * Math.PI / 180; If you ever need to convert the opposite way, use: degrees = radians * 180 / Math.PI; Once you have the angle in radians, use the Math.sin and Math.cos functions, along with the speed, to find the x and y velocities, using the following formulas: vx = Math.cos(angle) * speed; vy = Math.sin(angle) * speed; Here is an example using 135 degrees and a speed of 4 pixels per frame: package { import flash.display.Sprite; import flash.events.Event; import flash.events.TimerEvent; import flash.utils.Timer; public class AngularVelocity extends Sprite { private var _sprite:Sprite; private var _angle:Number = 135; private var _speed:Number = 4; private ...

access your web cam and take a snapshot using flash actionscript 3.0

In this post i will help you how to access your web cam and take a snap shot and save it as in JPEG format. Create a new flash file with name WebCam. Create a button with instance name "_capt " in the stage Then create a new actionscript 3 file with name "vido". copy and paste the following code into that and save it.. package {         import com.adobe.images.JPGEncoder;         import flash.display.Bitmap;         import flash.display.BitmapData;         import flash.media.Video;         import flash.media.Camera;         import flash.display.Sprite;         import flash.events.*;         import flash.display.MovieClip;         import flash.net.FileReference;         i...

change the case of a string or perform a case-insensitive comparison in action script

In this post i will help you how to change a string to uppercase,to lower case and also capitalize a first letter of a words. The " toUpperCase( ) " and" toLowerCase( ) " methods return new strings in which all the characters are uppercase or lowercase, respectively, without modifying the original string. you can use toLowerCase( ) or toUpperCase( ) to perform case-insensitive searches within strings // Displays: flash develop? trace( ex.toLowerCase( ) ); // Displays: FLASH DEVELOP? trace( ex.toUpperCase( ) ); // The original string value is unchanged: Flash designer? trace( example ); //you want to change original string, reassign the return value to it, as follows: var example:String = example.toLowerCase( ); The following will help you to change the any word for example "DeSigner" into "Designer" to capitalize the first letter of the word.The following is the code in the "main" class public static function...

carousel (3d reflected Gallery) papervision3d and As3 tutorials

Image
   Click on the above image you can get carousel (3d reflected Gallery) created using actionscript 3.0 and Papervision3d