Loadingscreen?

Software: Away3D 4.x

u6792345, Newbie
Posted: 24 August 2013 12:51 PM   Total Posts: 12

Hi all, how to make a loading screen ?

   

Avatar
SharpEdge, Member
Posted: 29 August 2013 11:11 AM   Total Posts: 94   [ # 1 ]

It’s too generic asking how to do a loading screen, what are you talking about? SplashScreen for AIR mobile? desktop? Loading screen for 3d model download and parsing?
As you should know Flash it’s not multithreaded (even if now we have workers) so while the 3d model is loaded inside the scene i don’t think it’s possible to receive some kind of ProgressEvent and build a loading screen.

What you could do is a sort of step loading screen, capturing each step event and showing some text or percent:

Like:
-Downloading object 0%
-Parsing object 30%
-Loading object 60%

   

Avatar
dottob, Jr. Member
Posted: 31 August 2013 03:29 AM   Total Posts: 49   [ # 2 ]

Maybe like this?

Make a away3d.swf,and load the away3d.swf

...
var 
away3d_Loader:Loader = new Loader();
away3d_Loader.contentLoaderInfo.addEventListener(Event.COMPLETEonAppLoaded);
 
away3d_Loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESSonProgress);
 
away3d_Loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERRORonAppIO);
 
away3d_Loader.load(new URLRequest("away3d.swf"));

function 
onProgress(e:ProgressEvent):void
{
 
var per:int = ((100 e.bytesTotal) * e.bytesLoaded);
 
preloader.text per "%";
}
... 

This is what I do loading…*^_^*

Ps:
in away3d.swf,do this:

package
{
...
public class 
A3dswf extends Sprite
 {
...
public function 
A3dswf()
  
{
   super
();
   if (
stagesetTimeout(init0);
   else 
addEventListener(Event.ADDED_TO_STAGEinit);
  
}
  
  
private function init(e:Event null):void
  {
...
                           
}
                 }
   

Avatar
SharpEdge, Member
Posted: 02 September 2013 09:59 AM   Total Posts: 94   [ # 3 ]

What’s the need for this?

if (stagesetTimeout(init0); 

never seen that piece of code.

   

u6792345, Newbie
Posted: 03 September 2013 09:40 AM   Total Posts: 12   [ # 4 ]

Can you write and give me the file? thanks

   

u6792345, Newbie
Posted: 03 September 2013 09:40 AM   Total Posts: 12   [ # 5 ]

Can you write it to this code for me please, i almost don’t know anything about as3

package
{
 import away3d
.containers.*;
 
import away3d.entities.*;
 
import away3d.materials.*;
 
import away3d.primitives.*;
 
import away3d.utils.*;
 
 
import flash.display.*;
 
import flash.events.*;
 
import flash.geom.Vector3D;

 
[SWF(backgroundColor="#000000"frameRate="60"quality="LOW")]
 
 
public class Basic_View extends Sprite
 {   
  [Embed
(source="/../embeds/floor_diffuse.jpg")]
  
public static var FloorDiffuse:Class;
  
  private var 
_view:View3D;
  
  private var 
_plane:Mesh;
  
  public function 
Basic_View()
  
{
   stage
.scaleMode StageScaleMode.NO_SCALE;
   
stage.align StageAlign.TOP_LEFT;
   
   
_view = new View3D();
   
addChild(_view);
   
   
_view.camera.= -600;
   
_view.camera.500;
   
_view.camera.lookAt(new Vector3D());
   
   
_plane = new Mesh(new PlaneGeometry(700700), new TextureMaterial(Cast.bitmapTexture(FloorDiffuse)));
   
_view.scene.addChild(_plane);
   
   
addEventListener(Event.ENTER_FRAME_onEnterFrame);
   
stage.addEventListener(Event.RESIZEonResize);
   
onResize();
  
}
  
  
private function _onEnterFrame(e:Event):void
  {
   _plane
.rotationY += 1;
   
   
_view.render();
  
}
  
  
private function onResize(event:Event null):void
  {
   _view
.width stage.stageWidth;
   
_view.height stage.stageHeight;
  
}
 }

 

   

Avatar
dottob, Jr. Member
Posted: 03 September 2013 10:23 AM   Total Posts: 49   [ # 6 ]
SharpEdge - 02 September 2013 09:59 AM

What’s the need for this?

if (stagesetTimeout(init0); 

never seen that piece of code.

It’s a test about if the stage is prepare,without those codes,away3d.swf can not be loading

Use:Adobe flash cs6

package
{
 import away3d
.containers.*;
 
import away3d.entities.*;
 
import away3d.materials.*;
 
import away3d.primitives.*;
 
import away3d.utils.*;
 
 
import flash.display.*;
 
import flash.events.*;
 
import flash.geom.Vector3D;

 
import flash.utils.*;

 
[SWF(backgroundColor="#000000"frameRate="60"quality="LOW")]
 
 
public class Basic_View extends Sprite
 {   
  [Embed
(source="assets/floor_diffuse.jpg")]
  
public static var FloorDiffuse:Class;
  
  private var 
_view:View3D;
  
  private var 
_plane:Mesh;
  
  public function 
Basic_View()
  

   
if (stagesetTimeout(init0);
   else 
addEventListener(Event.ADDED_TO_STAGEinit);
  
}
  
  
private function init(e:Event null):void
  {
   stage
.scaleMode StageScaleMode.NO_SCALE;
   
stage.align StageAlign.TOP_LEFT;
   
   
_view = new View3D();
   
addChild(_view);
   
   
_view.camera.= -600;
   
_view.camera.500;
   
_view.camera.lookAt(new Vector3D());
   
   
_plane = new Mesh(new PlaneGeometry(700700), new TextureMaterial(Cast.bitmapTexture(FloorDiffuse)));
   
_view.scene.addChild(_plane);
   
   
addEventListener(Event.ENTER_FRAME_onEnterFrame);
   
stage.addEventListener(Event.RESIZEonResize);
   
onResize();
  
}
  
  
private function _onEnterFrame(e:Event):void
  {
   _plane
.rotationY += 1;
   
   
_view.render();
  
}
  
  
private function onResize(event:Event null):void
  {
   _view
.width stage.stageWidth;
   
_view.height stage.stageHeight;
  
}
 }

 

   

u6792345, Newbie
Posted: 05 September 2013 02:30 AM   Total Posts: 12   [ # 7 ]

Thanks for reply but why i don’t see any loading screen with your code.

   

Avatar
dottob, Jr. Member
Posted: 05 September 2013 02:51 AM   Total Posts: 49   [ # 8 ]
ngtq97 - 05 September 2013 02:30 AM

Thanks for reply but why i don’t see any loading screen with your code.

Please make a new fla,and load “Basic_View.swf” into it

...
var 
preloader:TextField = new TextField();
preloader.embedFonts false;
preloader.textColor 0x000000;
preloader.border false;
preloader.autoSize "center";
preloader.text "Loading......" "\n";
preloader.x=(stage.stageWidth-preloader.width) * 0.5;
preloader.y=(stage.stageHeight-preloader.height) * 0.5;
addChild(preloader);
...
var 
away3d_Loader:Loader = new Loader();
away3d_Loader.contentLoaderInfo.addEventListener(Event.COMPLETEonAppLoaded);
 
away3d_Loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESSonProgress);
 
away3d_Loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERRORonAppIO);
 
away3d_Loader.load(new URLRequest("Basic_View.swf"));

function 
onProgress(e:ProgressEvent):void
{
 
var per:int = ((100 e.bytesTotal) * e.bytesLoaded);
 
preloader.text per "%";
}

function onAppLoaded(e:Event):void
{
 away3d_Loader
.contentLoaderInfo.removeEventListener(Event.COMPLETEonAppLoaded);
 
away3d_Loader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESSonProgress);
 
away3d_Loader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERRORonAppIO);
 
removeChild(preloader
 
addChild(e.target.content);
 return;
}
... 
   
   
‹‹ Smooth zoom

X

Away3D Forum

Member Login

Username

Password

Remember_me



X