GreenSock animation platform learning notes (5) Loadermax-SWFLoader

Source: Internet
Author: User

SWFLoader is used to load swf files. Its usage is similar to that of ImageLoader.requireWithRootPointing to this root swf, the loading process of the sub-loaded object will be included in this root swf. Let's take a look at its usage.

Constructor SWFLoader (urlOrRequest: *, vars: Object = null)

Parameter: urlOrRequest: url (String type) or URLRequest of the swf file to be loaded

Vars: attribute object. It can be written as a {} style or directly transmitted as a SWFLoaderVars object.

Vars object attributes (the same is true for SWFLoaderVars)

Attribute/Method Type Function
GetClass (className: string) Function Obtain the loaded swf based on the class name or its class in the sub-swf loaded by LoaderMax. The class can be instantiated. This method returns a class
GetSWFChild (name: String) Function Obtain the top-level sub-Display object of the loaded swf by displaying the object name attribute. For example, swf1 is the swf file to be loaded, on the swf1 stage, there is a video clip called a, so you can use getSWFChild ("a") to get the video clip. This object returns a display object, if an error occurs, null is returned.
AutoPlay Boolean The default value is true. When the value is true, the video starts playing as long as the INIT event of SWFLoader is triggered.
Name String Used to identify a SWFLoader instance.LoaderMax.getLoader()OrLoaderMax.getContent()Can be trace at any time, must be unique, if no display settings, will be automatically created, such as "loader21"
Container DisplayObject
Container
ContentDisplay (a sprite) representing the image content will be added to the container specified by this parameter
Width Number Sets the width of ContentDisplay. If no value is set, it indicates the width of the video to be loaded.
Heigth Number Sets the height of ContentDisplay. If no value is set, it indicates the height of the video to be loaded.
CenterRegistration Boolean If it is true, the registration point of ContentDisplay will be in the center
ScaleMode String When the height and width of ContentDisplay are set, this parameter determines how the video to be loaded adapts to this region. The following modes are available:
"Stretch", default value, the film will be fully adapted to the height and width
"ProportionalInside", the film scales proportionally to fit the height and width, and never exceeds this area
"ProportionalOutside", the film scales proportionally to fit the height and width, and some of them exceed this area
"WidthOnly", only applicable to width
"HeightOnly", only applicable to high
"None", the film will keep the original size
HAlign String After defining the height and width of ContentDisplay, this parameter determines how the video is aligned horizontally in ContentDisplay. the following values are available:
"Center", default value, center alignment
"Left", left aligned
"Right", right alignment
VAlign String After defining the height and width of ContentDisplay, this parameter determines how the video is aligned in the vertical direction of ContentDisplay. the following values are available:
"Center", default value, center alignment
"Top", alignment on
"Bottom", bottom alignment
Crop Boolean When the height and width of ContentDisplay are set, content beyond this part of the video will be dropped.
X Number Set the x coordinate of ContentDisplay
Y Number Set y coordinates of ContentDisplay
ScaleX Number Set the scaleX value of ContentDisplay
ScaleY Number Set the scaleY value of ContentDisplay
Rotation Number Set ContentDisplay Rotation
Alpha Number Sets the transparency of ContentDisplay.
Visible Boolean Set ContentDisplay visibility
BlendMode String Set blendMode of ContentDisplay
BgColor Uint The color of the rectangle in ContentDisplay. This rectangle is automatically added and transparent by default.
BgAlpha Number Transparency of the rectangle in ContentDisplay
Context LoaderContext  
EstimatedBytes Uint  
AlternateUrl String Optional video url. If the initial url fails to be loaded, the system will try to load this url.
NoCache Boolean If this parameter is set to true, the video cache is disabled.
RequireWithRoot DisplayObject LoaderMax supports subloding, that is, the loading process of an object can be added to the loading process of its parent object to become part of the parent element loading process, if you want this ImageLoader to be part of its parent SWFLoader's loading process, set this value to your root swf
AutoDispose Boolean If this parameter is set to true, the ImageLoader object is automatically destroyed after loading. The default value is false.
     
OnOpen Function The function called when loading starts.LoaderEventEvent object parameters
OnInit Function The function called when the video starts to be downloaded.LoaderEventEvent object parameters
OnProgress Function If a function is called when data changes occur during the loading process,LoaderEventEvent object parameters
You can useLoaderEvent. Target. progress, or use it separatelytarget.bytesLoadedAndtarget.bytesTotal
OnComplete Function The function called when the load is complete will inputLoaderEventEvent object parameters
OnCancel Function When the function is called when the load is canceled or fails,LoaderEventEvent object parameters
OnError Function When a function is called when an error occurs during loading,LoaderEventEvent object parameters
OnFail Function  
OnIOError Function  
OnHTTPStatus Function  
OnSecurityError Function  
OnScriptAccessDenied Function  
OnChildOpen Function When its sub-loader (RequireWithRoot is set as the root SWF) When loading starts,LoaderEventEvent object parameters
OnChildProgress Function ......
OnChildComplete Function ......
OnChildCancel Function ......
OnChildFail Function ......

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.