A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: centering dynamically loaded jpg

  1. #1
    Junior Member
    Join Date
    May 2002
    Posts
    3
    Does anyone know a way to center a jpg whose size will not be known at design time?

    My current code:
    loadMovie(FileList[whichPic], "square");
    square._x = (750/2) - (square._width/2);


    I guess it doesn't work because the new pic isn't loaded when the centering happens. square._width is returning the width of the previous pic.

    thanks

  2. #2
    ActionScript.org
    Join Date
    Aug 2000
    Posts
    1,030
    You're right about why it's not working. You have to wait for the image to load first. Trigger your set _x statement using the onClipEvent (load) event handler (on the square MC) and see if that fixes it.

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