A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: resizing after onLoad and multiple jpg's

  1. #1
    Member
    Join Date
    Jun 2002
    Posts
    61
    As I understand now it is a bit of a problem to use onLoad
    with jpg's in MX.

    I've overcome that problem with the help of flashguru and
    flashTampaDotCom.

    But I still can't get rid of one tiny little thing.

    I'm using an empty movie clip in wich I dynamicaly load
    a jpg.

    Then I use the the _width and _height of that empty
    movieclip to get the dimensions of the jpg.

    This works great for the first jpg, but when I load a
    second in the same movieclip, the dimension of the previous
    jpg are kept.

    Is there a way to reset the width and height?
    I tried setting it to 0, but then it stays 0
    Why does it only expand the first time?




  2. #2
    Senior Member
    Join Date
    Nov 2000
    Posts
    316
    i do it by putting the code:
    Code:
    on(data){
    //whatever you want to do
    }
    on the blank movie clip.
    check out teh gallery section on
    http://server.trikenit.com:81/us
    to see how mine ended up looking.

  3. #3
    Member
    Join Date
    Jun 2002
    Posts
    61
    Nice cars!

    Ok, but the on (Data) is a mouse event

    And if I put on the empty movieclip it gives me an error
    And if I put in in the movieclip also

    This seems logical, because on the movieclip it
    expects an onClipEvent.
    And in the movieclip an onEnterFrame maybe.

    So I'm curious. Can you tell me a bit more about how you did
    it?


  4. #4
    Member
    Join Date
    Jun 2002
    Posts
    61
    Still stuck.

    Is it true that when you fill a emtpy movie clip with
    a jpg and then (This is impportant) resizes it that the
    second time you're stuck with the dimensions of the first
    resized jpg?

    I realy need an anwer on that one.

    If my observation is correct, is there a way to get
    around this problem.

    And if I'm wrong, can someone give me a working code that

    A) loads a jpg in a empty MC
    B) shows the _width and _height
    C) resizes it a bit (smaller, larger I don't care)
    D) then loads a second jpg into the same MC
    E) shows the actual size of the jpg

    Would be great, tnx in advance!


  5. #5
    Member
    Join Date
    Jun 2002
    Posts
    61
    Anyone?

  6. #6
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    I played around a bit with createEmptyMovieClip and then used onEnterFrame width, height etc. I had 2 buttons on the scene as well not related to the MC. Somehow everything was resized including the buttons. In the next frames though I changed the width and height it was still the same.
    I don't any answer to this but have you tried to load into an empty MC and manipulate rather than using createEmptymovieClip, just the old-fashioned way?
    You could also try _xscale and _yscale. Just a couple of suggestions. may be something works.

  7. #7
    Member
    Join Date
    Jun 2002
    Posts
    61
    Yes I did. I started of with an empty MC, but that didn't
    work either.

    I just made the same test you described.

    Just two buttons for two different jpg's loaded in the same
    MC. I got it working but still with the same problem.

    I made 2 text fields for the width and height of the jpg.

    Once I loaded the first It showed up resized.
    In the textfields are the values
    Width=279
    Height=401
    These are the actual sizes

    Then I push the second button to load the next jpg
    then the values are changed to
    Width=137.35
    Height=95.8

    And here it's allready going wrong, because the actual
    size of the second picture is 400x279
    But it shows allright(Resized)

    And then when i pushed the first button again to load the
    first jpg the values change into
    Width=95.8
    Height=137.7

    And also funny, when you click the same button over and
    over again, the jpg gets smaller and smaller.

    ????????
    If any one likes you can check out the small test fla that
    I made. I included two test jpg's that must be placed
    in the same dir as the swf

    http://www.xs4all.nl/~biker66/jpgLoad.zip

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