A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: URGENT!!! centering loaded Jpeg??

  1. #1
    :: rolla :: bluedot's Avatar
    Join Date
    Mar 2001
    Location
    home
    Posts
    273
    hey,

    im working on a presentation for my teacher at school. i have to have it done within the next week so this is really important!

    i have a movie that loads jpegs with the loadMovie (); AS command. it works fine, and it loops back after its animation and gos to the next picture, bla, bla, bla. ok, now what i need is a way to center each picture that comes up in the movie. as most of you probably know, it has a default of loading the picture in the bottom right of the blank movie clip you load it into. is there any way to change this so that it will load into the center??? I REALLY NEED TO FIND THIS OUT! PLEASE HELP ME. IF YOU HAVE EVEN AN IDEA OF HOW TO DO THIS, PLEASE HELP!

    JÃ*©Ôß


  2. #2
    Senior Member
    Join Date
    May 2002
    Posts
    248
    You can't stop it from aligning the pic's top-left corner to the center of the holder clip. But you CAN tell the holder clip to move around after it's loaded the pic in. So using some math you can figure out where the left edge of the pic should be in relation to whatever you're centering it to. Like if your stage is 500 pixels wide and you load in a pic that's 400 pixels wide, you would move it so that it's 50 pixels from the left edge: (500-400)/2

    -Dan

  3. #3
    :: rolla :: bluedot's Avatar
    Join Date
    Mar 2001
    Location
    home
    Posts
    273

    thanks

    hey,

    that sounds like a really good idea, but i really dont know how to do that. if you would be kind enough to write some action script for me, i would really appreciate it. if you need my .fla for the movie, i will send it gladly. thanks!

    Jacob

  4. #4
    ?
    Join Date
    Feb 2002
    Location
    sweden
    Posts
    80
    If you have a fixed size on all your pictures you can have a MC that has it's registration point in the middle and in that have the MC where you load your pictures. So if all pictures you have are 200x200 px. you put the MC where you load the pictures at -100x, -100y in the MC with the centered registration point.
    I guess this isn't what your after but it is an easy way out for some operations, like rotating loaded pics and such...

    I think you could do something like this too;
    Code:
    //'myPic' is the instance name of your loaded jpg...
    myPic._x = myPic._x - myPic._width/2;
    myPic._y = myPic._y - myPic._height/2;
    I don't know if this works but I guess it will. Havn't tried it before...

    .b


  5. #5
    chatbugs.com ***** flashTampaDotCom's Avatar
    Join Date
    Mar 2002
    Location
    Tampa, Florida
    Posts
    171
    You might find a quick-and-dirty tutorial I made useful. It allows images to be resized proportionally, too.

    http://www.flashtampa.com/flashtutor...onalReSize.swf
    http://www.flashtampa.com/flashtutor...onalReSize.fla

  6. #6
    :: rolla :: bluedot's Avatar
    Join Date
    Mar 2001
    Location
    home
    Posts
    273

    estudio man is SUPER HUMAN!

    hey,

    thanks estudio!!!!!!!!!!!!!!!!!!!!!!!!! at first when i saw your post, i didnt understand it, but as i thought about it, i finally got it. it worked like a charm, and i wouldve never thought of it. that was an awesome idea, and works great. so now i have an engine, that will load pics consecutivley (i.e. 1.jpg, 2.jpg), you can set how many pics it will go through before going to the next scene, and they fade in and out. basically a powerpoint crappy thing haha but in flash!! plus, you can add in animations and stuff if ya want. its cool. thanks alot, you will soon see the engine in the movies section. thanks again.

    JÃ*©Ôß

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