A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: loading swf into container...

  1. #1
    Animal Flasher RobbieC's Avatar
    Join Date
    Aug 2001
    Location
    England
    Posts
    242

    loading swf into container...

    hi there, I've successfully managed to load an external swf file into a movie, but I don't know how to resize it or position it... is this possible?

    I'm using this code to load the swf into a movieclip called 'Holder':
    Code:
    var Holder:Loader = new Loader();
    var urlrHome:URLRequest = new URLRequest("myMovie.swf")
    Holder.load(urlrHome);
    Holder.contentLoaderInfo.addEventListener(Event.COMPLETE, movieLoaded);
    
    function movieLoaded(event:Event):void
    {
    addChild(Holder);
    }
    My 'Holder' is bigger than the swf importing, but ideally i would like to resize and position it in the center of the stage... (at the moment, the movie loads in small and sits at the top left corner of the stage, even though my container is in the middle...

    Any thoughts would be gratefully received

    Thanks, Rob

  2. #2
    Senior Member Gohloum's Avatar
    Join Date
    Aug 2002
    Location
    Florida
    Posts
    185
    I don't see any size or position defined for your Holder, so when you call addchild, it's adding it to the 0,0 location (top left). Since holder does not have dimensions defined, it will conform to it's contents. simply try tracing out the values in your movieLoaded function:

    trace(Holder.x, Holder.y, Holder.width, Holder.height)
    The Early Bird may get the worm, but the second mouse to the trap gets the cheese...

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