Packagecom.soma.utils
Classpublic class BasicLoader
InheritanceBasicLoader Inheritance flash.display.Sprite

Author: Romuald Quantin - www.soundstep.com

Information:
Blog page - SomaUI
How does it work - Soma Protest
Project Host - Google Code
Documentation - Soma ASDOC
Class version: 2.0
Actionscript version: 3.0

Copyright:

The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.mozilla.org/MPL/

Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied.
See the License for the specific language governing rights and
limitations under the License.

The Original Code is Soma.
The Initial Developer of the Original Code is Romuald Quantin.
Initial Developer are Copyright (C) 2008-2009 Soundstep. All Rights Reserved.

Usage:
BasicLoader is a utility class to load a swf file (and display a progress value in a text box centered on the screen). A LoaderContext instance can be used with the start method (set autoStart to false in the contructor).

Simple example:

addChild(new BasicLoader("Main.swf"));
     
Example with a custom textfield:
var tf:TextFormat = new TextFormat();
tf.font = "FFF Star Condensed";
tf.color = 0x00CCCC;
tf.size = 8;

var loader:BasicLoader = new BasicLoader("Main.swf", 0x000000, "Main", false);
loader.textFormat = tf;
loader.embedFont = true;
loader.text.autoSize = TextFieldAutoSize.NONE;
loader.text.width = 75;
loader.text.height = 18;
addChild(loader);
loader.start();
     



Public Properties
 PropertyDefined by
  embedFont : Boolean
Whether or not the TextField instance used to display the loading progress will use a font embedded.
BasicLoader
  file : String
[read-only] Get the url of the file.
BasicLoader
  loader : Loader
[read-only] Get the Loader instance used to process the loading.
BasicLoader
  text : TextField
[read-only] Get the TextField instance used to display the loading progress.
BasicLoader
  textFormat : TextFormat
Default TextFormat of the TextField instance used to display the loading progress.
BasicLoader
Public Methods
 MethodDefined by
  
BasicLoader(file:String, textColor:int = 0x000000, nameSprite:String = "Main", autoStart:Boolean = true)
Creates a BasicLoader instance.
BasicLoader
  
dispose():void
Removes TextField and listeners.
BasicLoader
  
start(loaderContext:LoaderContext = null):void
Starts the loading (in case autoStart has been set to false in the constructor), a LoaderContext instance can be used.
BasicLoader
Property detail
embedFontproperty
embedFont:Boolean  [read-write]

Whether or not the TextField instance used to display the loading progress will use a font embedded.

Implementation
    public function get embedFont():Boolean
    public function set embedFont(value:Boolean):void
fileproperty 
file:String  [read-only]

Get the url of the file.

Implementation
    public function get file():String
loaderproperty 
loader:Loader  [read-only]

Get the Loader instance used to process the loading.

Implementation
    public function get loader():Loader
textproperty 
text:TextField  [read-only]

Get the TextField instance used to display the loading progress.

Implementation
    public function get text():TextField
textFormatproperty 
textFormat:TextFormat  [read-write]

Default TextFormat of the TextField instance used to display the loading progress.

Implementation
    public function get textFormat():TextFormat
    public function set textFormat(value:TextFormat):void
Constructor detail
BasicLoader()constructor
public function BasicLoader(file:String, textColor:int = 0x000000, nameSprite:String = "Main", autoStart:Boolean = true)

Creates a BasicLoader instance.

Parameters
file:String — Name of the swf file to load.
 
textColor:int (default = 0x000000) — Color of the TextField that will display the progress value.
 
nameSprite:String (default = "Main") — Name of the swf that will be loaded.
 
autoStart:Boolean (default = true) — Automatically starts.
Method detail
dispose()method
public function dispose():void

Removes TextField and listeners.

start()method 
public function start(loaderContext:LoaderContext = null):void

Starts the loading (in case autoStart has been set to false in the constructor), a LoaderContext instance can be used.

Parameters
loaderContext:LoaderContext (default = null) — A LoaderContext instance.