A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Looking for advice and/or tutorials

  1. #1
    Senior Member Adam14's Avatar
    Join Date
    Feb 2004
    Location
    Ontario Canada
    Posts
    1,116

    Looking for advice and/or tutorials

    Hi guys and girls. I need help with something. I found a link that shows me how to allow a user to uplaod a jpeg/gif:

    http://website.lineone.net/~mitsos/s...orials/upload/

    But I was wondering if someone could help me, or point me in the direction of a tutorial that might help me, find out how to allow the jpeg to appear on the screen, and allow him/her to adjust the size of the file. The idea is a website, done in flash, that allows users to design his/her own tshirt. There are template designs, but I want him/her to be able to upload his/her own design. As it stands now, I have a main movie, with swfs loaded in with basic shirt styles. Is there a way to do this? Or am I just dreaming. Any and all help is much appreciated.

    Thanks,
    Adam

  2. #2
    ActionScript Insomniac
    Join Date
    Jan 2003
    Location
    43d03.21'N, 89d23.65'W
    Posts
    1,173
    I'm not sure quite what you mean when you say "size of the file." If you mean how many kilobytes, and what level of JPG compression, then you can't do that in Flash.

    If, on the other hand, you mean size of the image on the screen (and on the T-shirt), then you can do this. Load the image into a movie clip, attac "handles" to the clip, and set things up so that when the user drags a handle, the image gets resized, using _xscale and _yscale.

  3. #3
    Senior Member Adam14's Avatar
    Join Date
    Feb 2004
    Location
    Ontario Canada
    Posts
    1,116
    I did mean size of the image, and man, that's a brilliant idea!!! I never would have thought of that...of course getting it to work is another thing ...thanks so much...One last thing, I guess as far as them uploading an image, I could just direct it into a MC?...I guess I need more research on how to do that...but thank you so much for you help!

    Adam

  4. #4
    ActionScript Insomniac
    Join Date
    Jan 2003
    Location
    43d03.21'N, 89d23.65'W
    Posts
    1,173
    There are several tricky issues to deal with: when you load in a file, you have to wait for the loading to finish before you know the size. Also, when scaling things, you need to carefully coordinate several movie clips to avoid feedback loops. I've done this a couple of times, and each time I have to work the bugs out of it again.

    This will help you get started: put this code in Frame 1 of your timeline, insert your own file name, and try it out.

    code:


    // enter your picture file here
    var picToLoad = "head.jpg";

    var h = _root.createEmptyMovieClip("holder", 1);
    h._x = h._y = 100;
    var p = h.createEmptyMovieClip("picFrame", 1);

    h.onEnterFrame = function() {
    if (this._width > 0 && this._height > 0) {
    p.w = this._width;
    p.h = this._height;

    var lr = this.createEmptyMovieClip("handle", 100);
    lr.target = this.picFrame;
    lr.lineStyle(10, 0x880000);
    lr.lineTo(0, 1);
    lr._x = p.w;
    lr._y = p.h;
    lr.onPress = function() {
    this.onMouseMove = function() {
    this._x = this._parent._xmouse;
    this._y = this._parent._ymouse;
    this.target._xscale = this._parent._xmouse/this.target.w * 100;
    this.target._yscale = this._parent._ymouse/this.target.h * 100;
    };
    };
    lr.onRelease = lr.onReleaseOutside=function () {
    delete this.onMouseMove;
    };
    p.onPress = function() {this._parent.startDrag(false) };
    p.onRelease = p.onReleaseOutside = function() {this._parent.stopDrag()};

    delete this.onEnterFrame;
    }
    }

    p.loadMovie(picToLoad);


  5. #5
    Senior Member Adam14's Avatar
    Join Date
    Feb 2004
    Location
    Ontario Canada
    Posts
    1,116
    Wow!!! Man, that is absolutely amazing!!! Thank you very much!! You guys blow me away here. I obviously have more to do on this, but this gives me a huge head start!!

    Thanks,
    Adam

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