A Flash Developer Resource Site

Page 5 of 7 FirstFirst 1234567 LastLast
Results 81 to 100 of 134

Thread: dynamically loading jpgs and sizing the movie appropriately

  1. #81
    Junior Member
    Join Date
    Jun 2001
    Location
    .: somewhere south of the place I left my brain :.
    Posts
    19

    thanks!

    That's it. I appreciate it. I'm sure, from this thread, that it's possible to enter a dynamic form of this code once so that it doesn't have to be placed on every thumbnail clip, but what code is it and where does it go?

    Thanks again for the help.
    40 Rocks Design Studio...
    how can we help?

  2. #82
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    Its actually much better to load the variables into ONE place, the main timeline ( _root ) and reference them from the thumbnails. The path will always be...

    _root.variableName

    ..to reference them.


    ...like in a action....

    this.loadMovie(_root.variableName);

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  3. #83
    Junior Member
    Join Date
    Jun 2001
    Location
    .: somewhere south of the place I left my brain :.
    Posts
    19

    this stuff...

    ...is kickin my butt. I created a thumbnail MC and placed a dynamic text box inside it. I assigned it the var name image_name but can't get anything to display. If I rename it image_name1 then I get the same text in all 3 thumbnails. This dynamic stuff is turning my brain to mush. Well, what's left of it anyway.
    40 Rocks Design Studio...
    how can we help?

  4. #84
    Senior Member
    Join Date
    Oct 2000
    Location
    Nashville, Tennessee, USA
    Posts
    134
    post your code....

  5. #85
    Junior Member
    Join Date
    Jun 2001
    Location
    .: somewhere south of the place I left my brain :.
    Posts
    19

    here's the code

    AS is fairly new to me, so forgive any sloppy code. I hope it makes sense. OK, here goes...

    On the first frame on the main timeline:
    for(i=1;i<10;i++){
    this["thumbnailMovie"+i].loadVariables("imageData.txt", 0);
    this["thumbnailMovie"+i].picholder.loadMovie("images/x"+i+".jpg");
    //can't get this part to work
    //this["thumbnailMovie"+i].picholder.loadMovie("images/x"+eval("image_url"+i)+".jpg")
    }

    on MC thumbnailMovie1:
    on(release) {
    _root.container.loadMovie("images/1.jpg");
    }

    Inside the thumbnailMC is a dynamic textfield with the variable name:
    image_name

    I didn't include the AS from the canvas clip because it's working fine.
    40 Rocks Design Studio...
    how can we help?

  6. #86
    Senior Member
    Join Date
    Aug 2001
    Posts
    220
    the yapper 66 do you by any chance have a problem with the images disapearing after a minute or so? It's the strangest thing but after the jpg gets loaded in and everything is fine, the image just disapears! I don't get it, nothing in my code says to do anything after a jpg is loaded unless a button is clicked. I was just wondering if you have ever had the same problem..

  7. #87
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    digstance
    If you fade the alpha on images, you have to stop the alpha from going higher than 100, other wise it will just continue to a level where Flash wont recognize, and the image will disappear.

    the yapper 66
    One of your problems is that you load the textfile in the loop.It should be placec a couple of frames before the loop so it has some time to load, before you are trying to use its content.
    And you dont want to load it more than one time.
    To distribute the variables in the textfile you can use something like this in the loop...

    this["thumbnailMovie"+i].image_name=this["imageNameVariable"+i];

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  8. #88
    Senior Member
    Join Date
    Aug 2001
    Posts
    220
    Thanks! I changed the code from "_root.picholder._alpha += 20;" to "_root.picholder._alpha = 100;" and it works great, thanks!

  9. #89
    Senior Member
    Join Date
    Aug 2001
    Posts
    220
    pellepiano I was wondering if you could possible help me once again. I was wondering if it would be possible to have a movie clip attach itself the this resizing background I have in this movie so that when it resized to accomodate the jpg being loaded in, this movie clip would always stay in the in the same position in relation to the background. I hope I am making sense. If I place this MC inside of the background MC it of course gets scaled along with the background, this I don't want...

  10. #90
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    Im sorry , i dont get what you mean.Try naming the movieclips when you describe them so its easier to see what will be doing what. ( holderMC, shadowMC or whatever )

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  11. #91
    Senior Member
    Join Date
    Aug 2001
    Posts
    220
    right ok here goes:

    canvasMC is the border around the images that get loaded in. This MC gets resized to acccomodate the size of the jpg.


    infoMC is the MC that would contain the navigation to load in other jpg's as well as contact info etc..



    I would like infoMC to move and change it's positon in relation to how canvasMC gets resized. So lets say infoMC is positioned on the bottom left of canvasMC. When canvasMC get's resized to a larger or smaller size, depending on the jpg getting loaded in infoMC would have to adjust it's position so it could remain on the bottom left of canvasMC.

    Does that make any more sense?

  12. #92
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    Yes, completely. The equation goes lik this ( code ON the infoMC)

    onClipEvent (enterFrame) {
    this._x = (_parent.canvasMC._x+_parent.canvasMC._width)+5;
    this._y = (_parent.canvasMC._y+_parent.canvasMC._height)+5;
    }

    Change the (5) to finetune where the infoMC will be.

    This will work if the graphics inside infoMC starts at x 0 and y 0.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  13. #93
    Senior Member
    Join Date
    Aug 2001
    Posts
    220
    Thanks I'll give it a shot!

  14. #94
    Senior Member
    Join Date
    Aug 2001
    Posts
    220
    Awesome it works great!

  15. #95
    Senior Member
    Join Date
    Aug 2001
    Posts
    220
    pellepiano I was wondering if I could bother you yet again for some more help.

    I am having difficulty with the last piece of code you were so kind to give me. It works for other elements of the site but the trouble lies with the "picholderMC" which is where the jpg's get loaded in.

    I think the best way for you to see my problem is to look at it here:

    http://www.sandonephotography.com/test/aj_new.html

    this is in no way a fully working site I am just trying to get most of the elements working.

    If you could click on the first blue box under "fashion" you will see the gap at the top. This is not an error in your code I just don't know how to resolve this, I thought it was a registration issue but changing it doesnt seem to help. The first image that get's loaded in works great, basically there is supposed to be a 10 pixel border on the top, right & left of the image, as you will see it works great on the first photo, but the second photo is taller so the canvasMC resizes like it's supposed to, but I guess the picholder code should be adjusted? Not sure so here is how the movie is structured:

    on canvasMC i have this code:

    onClipEvent (enterFrame) {
    trace(math.round(_root.picholder._width));
    trace(math.round(this._width));
    // Make canvas dynamically resize to whatever is loaded in picholder clip and width and height matches (and only when tótally loaded )
    if (_root.picholder.getBytesLoaded()>=_root.picholder .getBytesTotal() && _root.picholder.getBytesLoaded()>1000) {
    this._width += (_root.picholder._width-this._width+20)/3;
    this._height += (_root.picholder._height-this._height+140)/3;
    }
    // Show picholder only when something is loaded into it
    if (math.round(_root.picholder._width+40) == math.round(this._width) && math.round(_root.picholder._height+140) == math.round(this._height) && _root.picholder.getBytesLoaded()>1000) {
    _root.picholder._alpha = 100;
    } else {
    _root.picholder._alpha = 0;
    }
    }

    on the picholderMC I have this code:

    onClipEvent (enterFrame) {
    this._x = (_parent.canvasMC._x+_parent.canvasMC._width)+-521.0;
    this._y = (_parent.canvasMC._y+_parent.canvasMC._height)+-523;
    }

    on the controlsMC i have this code:

    onClipEvent (enterFrame) {
    this._x = (_parent.canvasMC._x+_parent.canvasMC._width)+-353.5;
    this._y = (_parent.canvasMC._y+_parent.canvasMC._height)+-63;
    }

    any help is very much appreciated.

  16. #96
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    Its hard to say. Everything in your code is set to follow the dimensions of the loaded image. If the one image is slightly hifgher, the canvas will bi higher too, thus making everything interact.

    You may want to set a fixed distance for the space between the top of the image to the top of the canvas instead of the relative code I made..

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  17. #97
    Senior Member
    Join Date
    Aug 2001
    Posts
    220
    All of the images will vary in height and width so I think I need the relative code, do I?

    Is it possible to do both? having the canvas resize but also keep the minimum space at the top?

  18. #98
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    Try this....

    picholderMC

    onClipEvent (enterFrame) {
    this._x = (_parent.canvasMC._x+_parent.canvasMC._width)+-521.0;
    this._y = _parent.canvasMC._y+15;
    }

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  19. #99
    Senior Member
    Join Date
    Aug 2001
    Posts
    220
    You're amazing, it of course works. Thank you thank you thank you thank you thank you !

  20. #100
    Senior Member
    Join Date
    Aug 2001
    Posts
    220
    just when you thought it was safe..

    I have another problem, if you can please visit this url again and click on the first blue box under "fashion"

    http://www.sandonephotography.com/test/aj_new.html

    I seems like a registration point thing, I don't understand..

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