dcsimg
A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 25

Thread: ezPreloader_v2.0 (custom component feedback)

  1. #1
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755

    ezPreloader_v2.0 (custom component feedback)

    Hey gang..

    I just made a revamped version of my ezPreloader_v1.0 component. (called: ezPreloader_v2.0)

    so without further 'ado', here is the documentation and .mxp (component) file

    install as you normally would install any Flash component (Extension manager)



    You can mix and match any colors/styles/sizes/speed to match your project

    Documentation:
    Welcome to the ezPreloader_v2.0 component.
    A light weight, easy to use, full customizable preloader component.
    This component makes use of the MovieClipLoader(): class, and along with letting you set a number of physical parameters (to control its look), you can also define the content you want to load (loadSource) and where you want to load it (loadTarget).

    Those are basically the only two parameters that are REQUIRED for the component to work. The rest are optional

    Because this component uses the MovieClipLoader(); class, it also allows us to make use of the listener/callBack functions. This is great for basing other actions or functions depending on the current state of the content being downloaded. The returned data from these callBacks helps power the ezPreloader_v2.0 conponent and is also passed onto any custom callback functions you may want to register and ustilize the same data.

    I go into more details below.


    User Controlled Component Properties:


    Code:
    PROPERTY:		VARIABLE NAME:				DESC:
    
    REQUIRED:
    Load Source		(Property Var: loadSource:String)	Defines the content (.swf/image/video) to load
    Load Target		(Property Var: loadTagret:String)	Defines the target (containerClip/_level) to load into
    
    OPTIONAL:
    Height   		(Property var= uHeight:Number)		Controls the height of the rotation/animation
    Width    		(Property var= uWidth:Number)		Controls the width of the rotation/animation
    Rotation Speed		(Property var= uSpeed:Number)		Controls the speed of the rotation/animation
    Rotation Visible 	(Property var= uVisible:Boolean)	Controls the visibility of the rotation/animation
    Color Choice		(Property var= uColor:Color)		Defines the color of the rotation/animation
    Rotation Alpha		(Property var= uAlpha:Number)		Defines the alpha of the rotation/animation
    Text Color   		(Property Var= tColor:Color)		Defines the color of the percentage text
    Text Alpha		(Property Var= tAlpha:Number)		Defines the alpha of the percentage text
    Text Size		(Property Var= tSize:Number)		Defines the size of the percentage text
    Text Visible		(Property Var= tVisible:Boolean)	Controls the visibility of the percentage text
    
    
    
    CallBack Register Vars (and returned parameters)
    
    completeCallback:String =   >>Returns: (targetMc:MovieClip, httpStatus:Number)
    errorCallback:String =      >>Returns: (targetMc:MovieClip, errorCode:String, httpStatus:Number)
    initCallback:String =       >>Returns: (targetMc:MovieClip)
    progressCallback:String =   >>Returns: (targetMc:MovieClip, loadedBytes:Number, totalBytes)
    startCallback:String =      >>Returns: (targetMc:MovieClip)
    
    Function Name:							Desc:
    startLoad(loadSource, loadTarget);				Start the load of the loadSource into the loadTarget

    Summary of usage:

    Ther are basically three ways the ezPreloader_v2.0 preloader can be used.
    The first two involves dragging the component to stage in the authoring environment.

    (Article assumes you have already successfully installed the ezPreloader_v2.0 component and it resides in your Flash IDE in the compoenents panel under the ezConponents folder)

    1.)(auto load/manual settings) The component is draged on the stage from the component panel onto the stage. Once the component is on the stage, you select/highlight it, and go to the properties panel and under the parameters tab you can set the options to match your project. The only properites that need to be set as the loadSource & loadTarget parameters. Once the component is on stage (and these parameters are filled with valid values) it will automatically start the load when your movie starts.


    2.)(manual load/manual settings) The component is draged on the stage from the component panel onto the stage. Once the component is on the stage, you select/highlight it, and go to the properties panel and under the parameters tab you can set the options to match your project. For this method (or not to automatically start loading your content when the movie starts) you should leave the loadSource & loadTarget parameters as alone or blank. You must also remember to give your component an INSTANCE NAME, so you can trigger the load action from another event (button click or something). The component has a public function call startLoad();. This function also accepts two parameters that are required.

    startLoad(loadSource, loadTarget);

    Those parameters are:
    loadSource: (which is the content you want to load)
    loadTarget: (which is the target you want to load your content into)

    If you didnt want to set any of the physical attribute parameters.. the minimal steps for using method #2 would be as follows:

    Code example: (assuming component is on stage with INSTANCE NAME of: ezPreloader)

    PHP Code:
    //create empty clip to load content into
    var containerClip:MovieClip _root.createEmptyMovieClip("containerClip"_root.getNextHighestDepth());
    button_btn.onPress = function(){
        
    //load code for manually placed components
        
    ezPreloader.startLoad("imagename.jpg"containerClip);

    3.)(manual load/dynamic setting) the 3rd & final method I see the that can be used is attching the component dynamically like most other movieClip/component are. You follow the same rules/code you would use to attach any other clip to the stage and assign properties to it once it initializes. This means that not only do you have to set all physical atributes through code, but you must also set the REQUIRED parameters: loadSource & loadTarget.

    NOTE: If you assign the REQUIRED parameters: loadSource & loadTarget upon attaching/initializing of the clip.. it will start to load content automatically (3a). If you do not assign the required parameter a values upon attachign the clip, you have to invoke the loading manually through another action with the startLoad(); function. (3b)

    Code example: (assuming component is on stage with INSTANCE NAME of: ezPreloader)

    3a.)dynamic autoload
    PHP Code:
    var attachLoader _root.attachMovie("ezPreloader_v2.0""ezPreloader"_root.getNextHighestDepth());
    //place ezPreloader_v2.0
    attachLoader._x 150;
    attachLoader._y 100;
    //animation details
    attachLoader.uWidth 33;
    attachLoader.uHeight 33;
    attachLoader.uSpeed 10;
    attachLoader.uColor 0x66CCFF;
    attachLoader.uAlpha 100;
    attachLoader.uVisible true;
    //text detail
    attachLoader.tColor 0x66CCFF;
    attachLoader.tAlpha 80;
    attachLoader.tVisible true;
    attachLoader.tSize 15;
    //start auto load
    attachLoader.loadSource "colorstest1.jpg";
    attachLoader.loadTarget "containerClip";
    //register custom callBack functions
    attachLoader.initCallback "onInit";
    attachLoader.startCallback "onStart";
    attachLoader.progressCallback "onProgress";
    attachLoader.completeCallback "onComplete";
    attachLoader.errorCallback "onError"

    3b.)dynamic manual load
    PHP Code:
    var attachLoader _root.attachMovie("ezPreloader_v2.0""ezPreloader"_root.getNextHighestDepth());
    //place ezPreloader_v2.0
    attachLoader._x 150;
    attachLoader._y 100;
    //animation details
    attachLoader.uWidth 33;
    attachLoader.uHeight 33;
    attachLoader.uSpeed 10;
    attachLoader.uColor 0x66CCFF;
    attachLoader.uAlpha 100;
    attachLoader.uVisible true;
    //text detail
    attachLoader.tColor 0x66CCFF;
    attachLoader.tAlpha 80;
    attachLoader.tVisible true;
    attachLoader.tSize 15;
    //register custom callBack functions
    attachLoader.initCallback "onInit";
    attachLoader.startCallback "onStart";
    attachLoader.progressCallback "onProgress";
    attachLoader.completeCallback "onComplete";
    attachLoader.errorCallback "onError";
    button_btn.onPress = function(){
        
    //load code for manually placed components
        
    ezPreloader.startLoad("colorstest1.jpg"containerClip1);


    Custom CallBack FunctionS:

    Every ezPreloader_v2.0 component has 5 callBack vars that you can use to register your OWN functions that get executed/triggered. when you list a function to use as that callbacks registered function, it also gets passed certain parameters that you can take advantage of and use in yoru callBack functions. (above is the chart that lists what callback function pass what parameters.

    Here is an example of how to make you own functions and use the data passed in as parameters. (function names have to match the vars you give the callBack vars.

    PHP Code:
    //create callBack functions:
    // create function that fires/executes when the content is loading
    function onProgress(target_mc:MovieClipbytesLoaded:NumberbytesTotal:Number):Void {
        
    trace(target_mc._name ".onLoadProgress with " bytesLoaded " bytes of " bytesTotal);
        
    trace(">> Invoked every time the loading content is written to the hard disk during the loading process (that is, between MovieClipLoader.onLoadStart and MovieClipLoader.onLoadComplete).");
    }
    // create function that fires/executes when the content is complete
    function onComplete(target_mc:MovieCliphttpStatus:Number):Void  {
        
    trace(">> targetListener.onLoadComplete()");
        
    trace(">> =============================");
        
    trace(">> "+target_mc._name+"._width: " target_mc._width);
        
    trace(newline);
    };
    // create function that fires/executes when the content has initialized and is ready for manipulation
    function onInit(target_mc:MovieClip):Void  {
        
    trace(">> targetListener.onLoadInit()");
        
    trace(">> =============================");
        
    trace(">> "+target_mc._name+"._width: " target_mc._width);
        
    trace(newline);
    };
    function 
    onStart(targetMc:MovieClip):Void  {
        
    trace(">> targetListener.onLoadStart() fired");
        
    trace(">> =============================");
        
    trace(newline);
    };
    function 
    onError(targetMc:MovieCliperrorCode:StringhttpStatus:Number):Void  {
        
    trace(">> targetListener.onLoadError() fired");
        
    trace(">> =============================");
        
    trace(newline);
    }; 


    If those 3 methods above are still confusing, may this will help clarify:
    "If the REQUIRED variables/properties: loadSource & loadTarget are given values when the clip is initialized (whether you dynamically attach or place on stage in the IDE) the clipLoader will automatically begin your load routine.



    This should about wrap up the documentation on to use the ezPreloader_v2.0 conponent. I hope you enjoy it and find it easy to use.

    If you have any questions, comments or sugestion on how to make the ezPreloader_v2.0 component better please drop me a line.

    Thanks
    Attached Files Attached Files

  2. #2
    -_-
    Join Date
    Oct 2005
    Location
    US
    Posts
    1,694
    You. Are. A. Life. Saver.
    I still use the first one. Nice work man!

  3. #3
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    yeah?.. you like it? Im glad.

    unfortunately..the more I learn.. the more I see these as 'knock-offs' of what 'could be' if I learned OOP properly and started writing my own classes.

    anyways.. any feedback or links to it 'in action' are always nice..


    thanks..

  4. #4
    Senior Member
    Join Date
    Mar 2005
    Location
    nyc
    Posts
    222
    This is really great, but I'm confused.
    I want to use this to preload my entire movie swf
    (put the preloader is scene 1, then have it jump to scene 2 when my swf is loaded).
    How do I set Load Source and Load Target for this?
    Thanks!

  5. #5
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    not really sure it was intended to work like that..

    its suppoed to LOAD something, content, images..video. (ie: source) into a movieClip or _level (ie: target)

  6. #6
    Senior Member
    Join Date
    Mar 2005
    Location
    nyc
    Posts
    222
    ok, this was exactly what I was looking for as a site beginner.
    Oh well.
    It's still great and I'll use it as it's supposed to be used!

  7. #7
    Junior Member
    Join Date
    Nov 2008
    Posts
    1
    Hello Whispers i'm a newbie

    how can i load something to a specific _level?

    thanks

  8. #8

  9. #9
    -_-
    Join Date
    Oct 2005
    Location
    US
    Posts
    1,694
    EDIT: I just noticed that this thread came back from the dead. lol.
    Last edited by Adobemedia; 11-18-2008 at 07:11 PM.

  10. #10
    http://www.paololazatin.com
    Join Date
    Mar 2004
    Posts
    21
    Before it dies again, I'll throw a punch--still don't get the level. I tried putting 0/_level 0/_level.0/level:0 for the target, and it doesn't load. Works fine when I use mcs though. Is there like a prefix that I need to put so the component can realize it's a level and not a clip?

  11. #11
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    well it was never designed to be used with _levels.. and 'thought' others have had success putting in the _level1 value in the params.. but maybe Im wrong?

    this seems to work..although its from a button event.. (and has quotes around it)

    PHP Code:
    button1.onPress = function(){
        
    ezLoader2.startLoad("image1.jpg""_level1");

    go figure.. I thought someone a while back had posted on this on my wordpress blog.. but either I erased..or Im nuts..LOL

  12. #12
    http://www.paololazatin.com
    Join Date
    Mar 2004
    Posts
    21
    Odd, still can't get it to work with levels. Anyway, this is a very useful component. Nuts or not, a million thanks to you sir

  13. #13
    Senior Member
    Join Date
    Jul 2004
    Posts
    264
    whispers --- I know this is an old thread, but i LOVE this component!!!

    it's great!

    I just wish there was a way to go in and change the way it looks from the spinning wheel. Really get in and change it to anything.


    Quick question ... When loading images from the web, the "errorCallback" dosnt seem to work if flash is blocked by my firewall, or if the images is unavailable. It just keeps looping and looking for it.

    Cheers for this great component!!!

  14. #14
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    hi..& thanks


    1.) if you could totally change it (aside from the size color/alpha percentage)..it would defeat the purpose of making a 'component'...no?

    2.) the onError() is taken directly from the MovieClipLoader() class in flash...

    have you tried to trace out anything?

    you'd have to read more into the MovieClipLoader() class to see how it handles firewalls, or unavailable images..


    actually (since I never use it).. I believe it should be onLoadError().. I'll have to go back and re-compile the component... if its like that in there..

  15. #15
    Senior Member
    Join Date
    Jul 2004
    Posts
    264
    Quote Originally Posted by whispers View Post
    1.) if you could totally change it (aside from the size color/alpha percentage)..it would defeat the purpose of making a 'component'...no?

    haha, yes, but still

    Anyway, just saying thanks!

  16. #16
    Senior Member
    Join Date
    Jul 2004
    Posts
    264
    Hi again,

    I'm still working on a project that uses your ezPreloader component.

    But i'm having a real strange problem.

    For some reason, the percentage text inside the circle doesnt always show. The spinning disk will always work fine, but the text will not show up.

    I'm sure this is somthing to with the way flash is loading my app (it's all in parts in many swfs).

    I have one swf that is nothing but a preloader. -- and that should solve the problem with the export in first frame.

    Do you have any ideas? the ezpreloader works great -- but if the text does not load, there is no way to get it back, even chaning the text alpha or anything.

    The ezPreloader will work -- the disk will spin, but there is no text.



    Cheers for any help.

  17. #17
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    does the animation (spin) go away eventually?..or does it just sit there?

    it isnt meant to load multiple images/content..

    1 ezPreloader per content loading..

    there is a multiLoader class floating around here created by memeber MyFriendIsATaco.. if you want to use that..but its just a class..

  18. #18
    PlayerForever adi4x's Avatar
    Join Date
    Feb 2005
    Posts
    753
    great work.. Thank's whispers
    Card Games - play many card games free
    Free Games many free online games

  19. #19

  20. #20
    Senior Member
    Join Date
    Jul 2004
    Posts
    264
    Quote Originally Posted by whispers View Post
    does the animation (spin) go away eventually?..or does it just sit there?
    Yep, it goes away -- it works perfect. 100% working great. It comes back when i need it to aswell -- but the text inside doesnt show up (somtimes -- it appears to be random depending on the loading of the swf)

    Quote Originally Posted by whispers View Post
    it isnt meant to load multiple images/content..

    1 ezPreloader per content loading..
    Yes, thats how im using it -- there is one on stage -- it loads an image/swf -- and waits until the init is finished - then loads somthing else. It is working great. so im sure this isnt the problem.

    Quote Originally Posted by whispers View Post
    there is a multiLoader class floating around here created by memeber MyFriendIsATaco.. if you want to use that..but its just a class..
    I'd rather use yours it's doing a great job! And is exactly what im looking for. It just dosnt seem to be loading the centre text sometimes. Which is so strange when the component is working great. and the disk spins good.

    Cheers for the help whispers!

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center