Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Mar 2005
    Posts
    240
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Resizing an SWF after loading it

    Hi
    I have a movie that loads SWF files using the following

    Code:
    on(release){
    loader.loadMovie("video.swf")
    }
    the video that I am loading is fairly big and I want to resize it when it's loaded... Is there a way to set the width and height in the "loader" so that the video loads a certain heigh and width?

    Thanks

  • #2
    Regular Coder Stooshie's Avatar
    Join Date
    Mar 2008
    Location
    Dundee, Scotland
    Posts
    379
    Thanks
    9
    Thanked 39 Times in 39 Posts
    add an event listener before loading it:
    Code:
    loader.addEventListener("ready", loaderReadyHandler);
    on(release){
    	loader.loadMovie("video.swf")
    }
    then write the loaderReadyHandler method
    Code:
    private function loaderReadyHandler(_event:Event):void
    {
    	// work out the loader object from the event
    	var _loader:Loader = (_event.currentTarget as Loader);
    	_loader.height = 200;
    	_loader.width = 200;
    }
    hope that helps
    Regards, Stooshie
    O

  • #3
    Regular Coder
    Join Date
    Mar 2005
    Posts
    240
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Where would I put the loaderReadyHandler ??

  • #4
    Regular Coder Stooshie's Avatar
    Join Date
    Mar 2008
    Location
    Dundee, Scotland
    Posts
    379
    Thanks
    9
    Thanked 39 Times in 39 Posts
    Straight after the first bit of code:
    Code:
    loader.addEventListener("ready", loaderReadyHandler);
    on(release){
    	loader.loadMovie("video.swf")
    }
    
    private function loaderReadyHandler(_event:Event):void
    {
    	// work out the loader object from the event
    	var _loader:Loader = (_event.currentTarget as Loader);
    	_loader.height = 200;
    	_loader.width = 200;
    }
    hope it helps!
    Regards, Stooshie
    O


  •  

    Posting Permissions

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