A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: UILoader with preloader

  1. #1
    Junior Member
    Join Date
    Nov 2008
    Posts
    2

    UILoader with preloader

    Hi guys please help if you can.

    I have a movieclip with a UILoader that loads an external .swf file and a preloader as it loads.

    I need the UILoader to swap the .swf file when a buttoon is clicked this works fine with the code below and when I click the button the .swf will load but the preloader will not it just loads the first time i open the movieclip.

    What do i need to add to refresh the preloader for each .swf file I want to load?

    Cheers guys this is probably very simple but i`m very new to actionscript.


    Code:
    import fl.transitions.Tween;
    import fl.transitions.easing.*;
    
    var request:URLRequest = new URLRequest("photoGallery.swf");
    myLoader.load(request);
    
    bensTattoos_mc.addEventListener(MouseEvent.CLICK, bensBtn);
    
    function bensBtn(event:MouseEvent):void{
    // Play video Behavior
    var request:URLRequest = new URLRequest("photoGallery.swf");
    myLoader.load(request);
    }
    
    stop();
    // preloader code
    myLoader.addEventListener(Event.COMPLETE, fadeIn);
    
    function fadeIn(e:Event):void
    {
    	preloader_mc.alpha=0;
    	new Tween(myLoader,"alpha",Strong.easeOut,0,1,1,true);
    }

  2. #2
    Member
    Join Date
    Sep 2008
    Posts
    95
    myLoader.addEventListener(Event.COMPLETE, fadeIn);
    change:
    myLoader.contentLoaderInfo.addEventListener(Event. COMPLETE, fadeIn);

  3. #3
    Junior Member
    Join Date
    Nov 2008
    Posts
    2
    Thanks for the help but I get the following error.

    1119: Access of possibly undefined property contentLoaderInfo through a reference with static type fl.containers:UILoader.

  4. #4
    Member
    Join Date
    Sep 2008
    Posts
    95
    i'm sorry.
    i make a mistake.

    All you need to add "preloader_mc.alpha=1;" to "bensBtn" function.

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