Flash Gallery | Flash Templates | Flash Menu | Flash Design | Flash Audio & Video

flash page flip

Actionscript 3.0 video tutorials

+ Reply to Thread
Results 1 to 2 of 2

Thread: Attach image from library with Flash CS3 and Actionscript 3.0

  1. #1
    Administrator Living At The FlepStudio! Flep is on a distinguished road
    Join Date
    Jul 2007
    Posts
    5,459
    Rep Power
    8

    Attach image from library with Flash CS3 and Actionscript 3.0

    amazing Flash templates
    With Actionscript 2.0 you could ' attach ' an image from the library using the loadBitmap method of the BitmapData class.
    In Actionscript 3.0 this method has been removed, given the implementation of the Bitmap class.
    So, let see how to load an image from the gallery ...
    I create an FLA that I save as ' attacca_immagine.fla ' .
    I import an image from the gallery ( file>import>import to library and browse until I find the image I wish to use ). I create the Document Class, an AS file that I save as ' AttaccaImmagine.as ' and implemented like so:
    Code:
    package
    {
    	import flash.display.MovieClip;
    	import flash.display.Bitmap;
    	
    	public class AttaccaImmagine extends MovieClip
    	{
    		public function AttaccaImmagine()
    		{
    			attacca();
    		}
    		
    		private function attacca():void
    		{
    			var immagine:Immagine=new Immagine();
    			var bitmap:Bitmap=new Bitmap(immagine);
    			addChild(bitmap);
    		}
    	}
    }
    Now I create another class, another AS file that I save as ' Immagine.as ' :
    Code:
    package
    {
    	import flash.display.BitmapData;
    	
    	public class Immagine extends BitmapData
    	{
    		public function Immagine()
    		{
    			super(0,0);
    		}
    	}
    }
    I go back to the FLA, I select the image in the gallery and right click>linkage and in the Class field of the newly opened window, I insert ' Immagine '.
    Now I can launch the SWF noticing the image on stage :)

    Source files:
    Attached Files

  2. #2
    Junior Member Settled In anroy is on a distinguished road
    Join Date
    Jan 2010
    Posts
    1
    Rep Power
    0

    Re: Attach image from library with Flash CS3 and Actionscript 3.0

    Thanks Flep, that is a helpful example of using bitmap data.

+ Reply to Thread

Similar Threads

  1. Replies: 12
    Last Post: 25-11-09, 08:36
  2. Replies: 1
    Last Post: 19-03-09, 08:37
  3. Create Library book system for Flash PHP
    By clonez in forum Flash CS3 | PHP | mySQL
    Replies: 0
    Last Post: 21-10-08, 16:11
  4. Library Sounds with Flash CS3
    By Flep in forum Tutorials
    Replies: 0
    Last Post: 25-09-07, 16:36
  5. Attach Movie da swf caricato
    By tem in forum Actionscript 3.0 avanzato
    Replies: 20
    Last Post: 25-08-07, 20:44

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Optimization by vBSEO