| Tutorial Flash - HTML5 - Javascript - DKV

Latest Blog



06.07.2022

MPI Component

Library untuk pengembangan multimedia interaktif dengan Flash/Animate

23.10.2020

Virtual Lab Flash

Library untuk pengembangan laboratorium virtual dengan Flash/Animate

06.10.2020

Game Among Us

Membuat gerakan karakter seperti pada game Among Us

05.10.2020

Multimedia Interaktif Tata Surya

Membuat Multimedia Pembelajaran Interaktif tentang tata surya

04.10.2020

Animasi Rotasi Bumi 3D

Membuat animasi bumi berotasi dengan grafik 3 Dimensi

01.10.2020

Membuat Kuis Essay

Mengecek jawaban kuis essay pada aplikasi pembelajaran interaktif

12.09.2020

Membuat Game Ular Tangga

Membuat game ular tangga dengan Adobe Flash/Animate AS3

10.09.2020

Membuat Pengacak Dadu

Membuat acak dadu untuk game ular tangga/monopoly

13.07.2020

Membuat Game Onet

Membuat game mencari gambar yang sama (onet) dengan JS/HTML5

11.06.2020

Membuat Kuis CBT

Membuat kuis CBT, menyimpan nilai ke server dengan PHP dan XML


ALL BLOG

Latest Games


;
Free Games

Indonesia Soccer League

Play Indonesian Soccer League on Flash 3D Games

Viewer 3D - Simple way to load 3D model into flash application

Preparation

This tutorial will show you how to load a 3D model, in F3D (flare3D) format into flash application using Viewer3D. To do this tutorial, you need some preparation :

  • First installation of Flash Develop and Flare3D. You can check the complete guide here
  • 3D model in F3D (Flare3D) format. You can download the model file on the link at the end of this tutorial.
  • Flare3D Library in SWC format. You can find it on Flare3D installation folder

Step by step tutorial using Viewer3D

  1. Run FlashDevelop and create a new project (choose Project > New Project)
  2. Choose AS3 Project, and write "Tutorial01_Viewer3D" as name, and make sure the "Create directory for project" option is selected.
    viewer3d by wandah_w
  3. Once you press OK button, the project folder will be created. You'll find 3 different folder (bin, lib and src).
  4. Copy the 3D model file into bin folder and copy the Flare3D library file into lib folder.
    viewer3d by wandah_w
  5. Back to FlashDevelop. On the Project Manager panel (on the right side), expand the lib folder, and you'll find Flare3D library files. Right click that library and select Add To Library.
    viewer3d by wandah_w
  6. On the Project Manager panel. Right click on the Project Properties and choose Properties.
    flare3D setup by wandah_w
  7. In the Output tab, Platform group box, select Flash Player version 11.7
    flare3D setup by wandah_w
  8. Go to the SDK tab and make sure that Flex 4.6.0, AIR 3.1 or the latest version is the selected SDK . Press OK
    flare3D setup by wandah_w
  9. Now expand src folder. You'll find Main.as the main class of the project. This is the "code files". Double click that files to open it into Editor Panel.
    To load the 3D model that we have on the lib folder, we need to add some codes into Main.as. Copy the code below :
    package 
    {
    	import flash.display.Sprite;
    	import flash.events.Event;
    	import flare.basic.*;
    	import flare.core.*;
    	import flare.loaders.*;
    	import flare.system.*;
    
    	/**
    	 * ...
    	 * @author wandah
    	 */
    	public class Main extends Sprite 
    	{
    		private var scene:Scene3D;
    		private var truk:Pivot3D;		
    		
    		public function Main():void 
    		{
    			if (stage) init();
    			else addEventListener(Event.ADDED_TO_STAGE, init);
    		}
    		
    		private function init(e:Event = null):void 
    		{
    			removeEventListener(Event.ADDED_TO_STAGE, init);
    			// entry point
    			
    			// setup Viewer3D
    			scene = new Viewer3D( this );
    			scene.antialias = 2;
    			
    			// add loading listener
    			scene.addEventListener( Scene3D.PROGRESS_EVENT, progressEvent );
    			scene.addEventListener( Scene3D.COMPLETE_EVENT, completeEvent );
    			
    			// open the 3D file
    			truk = scene.addChildFromFile( "truk.f3d" );
    			
    			scene.pause();
    		}
    		
    		private function progressEvent(e:Event):void 
    		{
    			// loading event
    			trace( scene.loadProgress );
    		}
    		
    		private function completeEvent(e:Event):void 
    		{
    			// loading complete 			
    			scene.resume();
    		}
    	}
    	
    }
    				
  10. Run the project by pressing Ctrl+Enter or F5 button. If there is no mistake on the Flare3D and Flash Develop Installation, and there is no mistake with the codes then you'll see the 3d model on your flash application. You can zoom in and zoom out the model using mouse roll, and drag mouse to rotate it.

Project Output

Here the output of the project. As you can see, using Flare3D we can easily load any 3D model in F3D format with less than 10 line of viewer3D codes. Write me some feedback if about it, or if you find any problem just write a comment. Thanks!

Get Adobe Flash player

File Source

Here you can download the full source DOWNLOAD PROJECT



Share ( Ayo Berbagi )

Leave me a comment

untuk pertanyaan lebih baik di email langsung ke wandah [at] wandah [dot] com agar cepat direspon